aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystemparser.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-24 07:39:50 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-24 07:49:07 +0200
commit9881b68c4c7bc1715cd266c41c63a3a918d83b07 (patch)
tree5252e3e767e64d98383f6103d9d5941a206a52bc /sources/shiboken2/ApiExtractor/typesystemparser.cpp
parent17a20f95151368a3b92b949b905325865643ca45 (diff)
parentcad869b619fdc0969216e6e9b63fd1afb5edb7db (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystemparser.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.cpp b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
index df36689ed..f54ad50f4 100644
--- a/sources/shiboken2/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
@@ -366,6 +366,7 @@ ENUM_LOOKUP_BEGIN(StackElement::ElementType, Qt::CaseInsensitive,
{u"object-type", StackElement::ObjectTypeEntry},
{u"parent", StackElement::ParentOwner},
{u"primitive-type", StackElement::PrimitiveTypeEntry},
+ {u"property", StackElement::Property},
{u"reference-count", StackElement::ReferenceCount},
{u"reject-enum-value", StackElement::RejectEnumValue},
{u"rejection", StackElement::Rejection},
@@ -2238,6 +2239,36 @@ bool TypeSystemParser::parseAddFunction(const QXmlStreamReader &,
return true;
}
+bool TypeSystemParser::parseProperty(const QXmlStreamReader &, const StackElement &topElement,
+ QXmlStreamAttributes *attributes)
+{
+ if ((topElement.type & StackElement::ComplexTypeEntryMask) == 0) {
+ m_error = QString::fromLatin1("Add property requires a complex type as parent"
+ ", was=%1").arg(topElement.type, 0, 16);
+ return false;
+ }
+
+ TypeSystemProperty property;
+ for (int i = attributes->size() - 1; i >= 0; --i) {
+ const auto name = attributes->at(i).qualifiedName();
+ if (name == nameAttribute()) {
+ property.name = attributes->takeAt(i).value().toString();
+ } else if (name == QLatin1String("get")) {
+ property.read = attributes->takeAt(i).value().toString();
+ } else if (name == QLatin1String("type")) {
+ property.type = attributes->takeAt(i).value().toString();
+ } else if (name == QLatin1String("set")) {
+ property.write = attributes->takeAt(i).value().toString();
+ }
+ }
+ if (!property.isValid()) {
+ m_error = QLatin1String("<property> element is missing required attibutes (name/type/get).");
+ return false;
+ }
+ static_cast<ComplexTypeEntry *>(topElement.entry)->addProperty(property);
+ return true;
+}
+
bool TypeSystemParser::parseModifyFunction(const QXmlStreamReader &reader,
const StackElement &topElement,
QXmlStreamAttributes *attributes)
@@ -3006,6 +3037,10 @@ bool TypeSystemParser::startElement(const QXmlStreamReader &reader)
if (!parseAddFunction(reader, topElement, &attributes))
return false;
break;
+ case StackElement::Property:
+ if (!parseProperty(reader, topElement, &attributes))
+ return false;
+ break;
case StackElement::ModifyFunction:
if (!parseModifyFunction(reader, topElement, &attributes))
return false;