diff options
Diffstat (limited to 'sources')
6 files changed, 28 insertions, 33 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 8325a06e4..05dc7185b 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -263,11 +263,6 @@ </conversion-rule> </primitive-type> - <primitive-type name="QStringRef"> - <conversion-rule> - <native-to-target file="../glue/qtcore.cpp" snippet="return-pyunicode-qstringref"/> - </conversion-rule> - </primitive-type> <primitive-type name="QChar"> <conversion-rule> <native-to-target file="../glue/qtcore.cpp" snippet="return-pyunicode-qchar"/> @@ -2708,6 +2703,9 @@ <modify-function signature="push_front(QXmlStreamAttribute)" remove="all"/> <modify-function signature="pop_front()" remove="all"/> <modify-function signature="toList()const" remove="all"/> + <!-- Remove methods from QList --> + <modify-function signature="value(qsizetype,const QXmlStreamAttribute&) const" remove="all"/> + <modify-function signature="value(qsizetype) const" remove="all"/> <modify-function signature="fromList(const QList<QXmlStreamAttribute> &)" remove="all"/> <modify-function signature="operator+=(QVector<QXmlStreamAttribute>)" remove="all"/> <!-- Expose operator==, != inherited from QList, which the parser does diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 6061b27d6..8d25907d6 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1917,15 +1917,6 @@ QByteArray ba = %in.toUtf8(); return PyUnicode_FromStringAndSize(ba.constData(), ba.size()); // @snippet return-pyunicode -// @snippet return-pyunicode-qstringref - const int N = %in.length(); - wchar_t *str = new wchar_t[N]; - %in.toString().toWCharArray(str); - PyObject *%out = PyUnicode_FromWideChar(str, N); - delete[] str; - return %out; -// @snippet return-pyunicode-qstringref - // @snippet return-pyunicode-qchar wchar_t c = (wchar_t)%in.unicode(); return PyUnicode_FromWideChar(&c, 1); diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h index 9d97f5c93..3fb326b76 100644 --- a/sources/shiboken2/ApiExtractor/typesystem.h +++ b/sources/shiboken2/ApiExtractor/typesystem.h @@ -117,7 +117,7 @@ public: QString code() const; void addCode(const QString &code); - void addCode(const QStringRef &code) { addCode(code.toString()); } + void addCode(QStringView code) { addCode(code.toString()); } void addTemplateInstance(TemplateInstance *ti) { @@ -516,7 +516,7 @@ public: m_signature(signature), m_mode(mode) {} void setCode(const QString& code); - void setCode(const QStringRef& code) { setCode(code.toString()); } + void setCode(QStringView code) { setCode(code.toString()); } QString code() const { diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.cpp b/sources/shiboken2/ApiExtractor/typesystemparser.cpp index 51c0f2816..d23e96c77 100644 --- a/sources/shiboken2/ApiExtractor/typesystemparser.cpp +++ b/sources/shiboken2/ApiExtractor/typesystemparser.cpp @@ -425,7 +425,7 @@ static QString msgInvalidAttributeValue(const QXmlStreamAttribute &attribute) return result; } -static QString msgUnusedAttributes(const QStringRef &tag, const QXmlStreamAttributes &attributes) +static QString msgUnusedAttributes(QStringView tag, const QXmlStreamAttributes &attributes) { QString result; QTextStream str(&result); @@ -541,18 +541,20 @@ static QString msgReaderError(const QXmlStreamReader &reader, const QString &wha } static QString msgUnimplementedElementWarning(const QXmlStreamReader &reader, - const QStringRef &name) + QStringView name) { - const QString message = QLatin1String("The element \"") + - name + QLatin1String("\" is not implemented."); + QString message; + QTextStream(&message) << "The element \"" << name + << "\" is not implemented."; return msgReaderMessage(reader, "Warning", message); } static QString msgUnimplementedAttributeWarning(const QXmlStreamReader &reader, - const QStringRef &name) + QStringView name) { - const QString message = QLatin1String("The attribute \"") + - name + QLatin1String("\" is not implemented."); + QString message; + QTextStream(&message) << "The attribute \"" << name + << "\" is not implemented."; return msgReaderMessage(reader, "Warning", message); } @@ -742,7 +744,7 @@ bool TypeSystemParser::setupSmartPointerInstantiations() return true; } -bool TypeSystemParser::endElement(const QStringRef &localName) +bool TypeSystemParser::endElement(QStringView localName) { if (m_ignoreDepth) { --m_ignoreDepth; @@ -1616,7 +1618,8 @@ bool TypeSystemParser::parseInjectDocumentation(const QXmlStreamReader &, const auto modeName = attributes->takeAt(i).value(); mode = docModificationFromAttribute(modeName); if (mode == TypeSystem::DocModificationInvalid) { - m_error = QLatin1String("Unknown documentation injection mode: ") + modeName; + m_error = QLatin1String("Unknown documentation injection mode: "); + m_error += modeName; return false; } } else if (name == formatAttribute()) { @@ -2397,8 +2400,9 @@ bool TypeSystemParser::parseReferenceCount(const QXmlStreamReader &reader, rc.action = referenceCountFromAttribute(attribute.value()); switch (rc.action) { case ReferenceCount::Invalid: - m_error = QLatin1String("unrecognized value '") + attribute.value() - + QLatin1String("' for action attribute."); + m_error = QLatin1String("unrecognized value '"); + m_error += attribute.value(); + m_error += QLatin1String("' for action attribute."); return false; case ReferenceCount::AddAll: case ReferenceCount::Ignore: @@ -2436,7 +2440,9 @@ bool TypeSystemParser::parseParentOwner(const QXmlStreamReader &, const auto action = attributes->takeAt(i).value(); ao.action = argumentOwnerActionFromAttribute(action); if (ao.action == ArgumentOwner::Invalid) { - m_error = QLatin1String("Invalid parent actionr '") + action + QLatin1String("'."); + m_error = QLatin1String("Invalid parent action '"); + m_error += action; + m_error += QLatin1String("'."); return false; } } diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.h b/sources/shiboken2/ApiExtractor/typesystemparser.h index 66d61f4a1..49ef1f17d 100644 --- a/sources/shiboken2/ApiExtractor/typesystemparser.h +++ b/sources/shiboken2/ApiExtractor/typesystemparser.h @@ -160,7 +160,7 @@ private: const QString &name, const QVersionNumber &since, QXmlStreamAttributes *attributes); - bool endElement(const QStringRef& localName); + bool endElement(QStringView localName); template <class String> // QString/QStringRef bool characters(const String &ch); diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index 28d91c9aa..967c8fcc9 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -147,12 +147,12 @@ static int writeEscapedRstText(QTextStream &str, const String &s) class escape { public: - explicit escape(const QStringRef &s) : m_string(s) {} + explicit escape(QStringView s) : m_string(s) {} void write(QTextStream &str) const { writeEscapedRstText(str, m_string); } private: - const QStringRef m_string; + const QStringView m_string; }; inline QTextStream &operator<<(QTextStream &str, const escape &e) @@ -675,7 +675,7 @@ void QtXmlToSphinx::handleArgumentTag(QXmlStreamReader& reader) static inline QString functionLinkType() { return QStringLiteral("function"); } static inline QString classLinkType() { return QStringLiteral("class"); } -static inline QString fixLinkType(const QStringRef &type) +static inline QString fixLinkType(QStringView type) { // TODO: create a flag PROPERTY-AS-FUNCTION to ask if the properties // are recognized as such or not in the binding @@ -902,7 +902,7 @@ void QtXmlToSphinx::handleRowTag(QXmlStreamReader& reader) enum ListType { BulletList, OrderedList, EnumeratedList }; -static inline ListType webXmlListType(const QStringRef &t) +static inline ListType webXmlListType(QStringView t) { if (t == QLatin1String("enum")) return EnumeratedList; |