aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystemparser.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-24 11:10:24 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-28 11:19:29 +0200
commitcb073f6eee9e21b62d7c14e0357beb6cecf33e31 (patch)
tree36a32fae9cf3f9c8d505a8dbaf31b228b08844f9 /sources/shiboken2/ApiExtractor/typesystemparser.cpp
parent5a7429cc895824a4eafd27e1a5c95b40bba86bdf (diff)
shiboken2: Generate properties as fields
- Add an XML attribute specifying whether code is to be generated to the XML properties. - Split the generator functions for field setters and getters apart so that they can be used for generating property setters and getters. - Generate code for all properties from XML when the PySide extension is not used, otherwise only for those with the attribute set. Task-number: PYSIDE-1019 Change-Id: Iab2ba38b90038edc667a233c23c7113fdc6fb438 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystemparser.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.cpp b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
index 04aadbb63..27e613280 100644
--- a/sources/shiboken2/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
@@ -70,6 +70,7 @@ static inline QString formatAttribute() { return QStringLiteral("format"); }
static inline QString generateUsingAttribute() { return QStringLiteral("generate-using"); }
static inline QString classAttribute() { return QStringLiteral("class"); }
static inline QString generateAttribute() { return QStringLiteral("generate"); }
+static inline QString generateGetSetDefAttribute() { return QStringLiteral("generate-getsetdef"); }
static inline QString genericClassAttribute() { return QStringLiteral("generic-class"); }
static inline QString indexAttribute() { return QStringLiteral("index"); }
static inline QString invalidateAfterUseAttribute() { return QStringLiteral("invalidate-after-use"); }
@@ -2256,6 +2257,10 @@ bool TypeSystemParser::parseProperty(const QXmlStreamReader &, const StackElemen
property.type = attributes->takeAt(i).value().toString();
} else if (name == QLatin1String("set")) {
property.write = attributes->takeAt(i).value().toString();
+ } else if (name == generateGetSetDefAttribute()) {
+ property.generateGetSetDef =
+ convertBoolean(attributes->takeAt(i).value(),
+ generateGetSetDefAttribute(), false);
}
}
if (!property.isValid()) {