forked from qt-creator/qt-creator
Fix build of standalone sdktool against earlier Qt versions
We want greater compatibility for sdktool, and that rules out QStringView. Use porting.h with Utils::StringView instead. Change-Id: I44745f4a765c29c5e33d77d80779c79d6a5666e3 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <utils/porting.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
// Read and write rectangle in X11 resource syntax "12x12+4+3"
|
||||
@@ -188,13 +189,13 @@ private:
|
||||
enum Element { QtCreatorElement, DataElement, VariableElement,
|
||||
SimpleValueElement, ListValueElement, MapValueElement, UnknownElement };
|
||||
|
||||
Element element(const QStringView &r) const;
|
||||
Element element(const StringView &r) const;
|
||||
static inline bool isValueElement(Element e)
|
||||
{ return e == SimpleValueElement || e == ListValueElement || e == MapValueElement; }
|
||||
QVariant readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttributes &attributes) const;
|
||||
|
||||
bool handleStartElement(QXmlStreamReader &r);
|
||||
bool handleEndElement(const QStringView &name);
|
||||
bool handleEndElement(const StringView &name);
|
||||
|
||||
static QString formatWarning(const QXmlStreamReader &r, const QString &message);
|
||||
|
||||
@@ -233,7 +234,7 @@ QVariantMap ParseContext::parse(QFile &file)
|
||||
|
||||
bool ParseContext::handleStartElement(QXmlStreamReader &r)
|
||||
{
|
||||
const QStringView name = r.name();
|
||||
const StringView name = r.name();
|
||||
const Element e = element(name);
|
||||
if (e == VariableElement) {
|
||||
m_currentVariableName = r.readElementText();
|
||||
@@ -268,7 +269,7 @@ bool ParseContext::handleStartElement(QXmlStreamReader &r)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParseContext::handleEndElement(const QStringView &name)
|
||||
bool ParseContext::handleEndElement(const StringView &name)
|
||||
{
|
||||
const Element e = element(name);
|
||||
if (ParseContext::isValueElement(e)) {
|
||||
@@ -297,7 +298,7 @@ QString ParseContext::formatWarning(const QXmlStreamReader &r, const QString &me
|
||||
return result;
|
||||
}
|
||||
|
||||
ParseContext::Element ParseContext::element(const QStringView &r) const
|
||||
ParseContext::Element ParseContext::element(const StringView &r) const
|
||||
{
|
||||
if (r == valueElement)
|
||||
return SimpleValueElement;
|
||||
@@ -317,7 +318,7 @@ ParseContext::Element ParseContext::element(const QStringView &r) const
|
||||
QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttributes &attributes) const
|
||||
{
|
||||
// Simple value
|
||||
const QStringView type = attributes.value(typeAttribute);
|
||||
const StringView type = attributes.value(typeAttribute);
|
||||
const QString text = r.readElementText();
|
||||
if (type == QLatin1String("QChar")) { // Workaround: QTBUG-12345
|
||||
QTC_ASSERT(text.size() == 1, return QVariant());
|
||||
|
||||
@@ -82,6 +82,7 @@ extend_qtc_executable(sdktool
|
||||
namevaluedictionary.cpp namevaluedictionary.h
|
||||
namevalueitem.cpp namevalueitem.h
|
||||
persistentsettings.cpp persistentsettings.h
|
||||
porting.h
|
||||
qtcassert.cpp qtcassert.h
|
||||
qtcprocess.cpp qtcprocess.h
|
||||
savefile.cpp savefile.h
|
||||
|
||||
@@ -73,6 +73,7 @@ HEADERS += \
|
||||
$$UTILS/qtcassert.h \
|
||||
$$UTILS/qtcprocess.h \
|
||||
$$UTILS/savefile.h \
|
||||
$$UTILS/porting.h
|
||||
|
||||
macos {
|
||||
OBJECTIVE_SOURCES += \
|
||||
|
||||
@@ -74,6 +74,7 @@ QtcTool {
|
||||
"namevaluedictionary.cpp", "namevaluedictionary.h",
|
||||
"namevalueitem.cpp", "namevalueitem.h",
|
||||
"persistentsettings.cpp", "persistentsettings.h",
|
||||
"porting.h",
|
||||
"qtcassert.cpp", "qtcassert.h",
|
||||
"qtcprocess.cpp", "qtcprocess.h",
|
||||
"savefile.cpp", "savefile.h",
|
||||
|
||||
Reference in New Issue
Block a user