aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystem.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-20 14:52:21 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-05 11:10:28 +0000
commit2bfd1de3495b18c0ecc251260442a9a46009861e (patch)
tree73e8392e8f3059fac87bd80d59bccb4d6b74898c /sources/shiboken2/ApiExtractor/typesystem.h
parent194df4ac3203546193dc7fb03267ede5d112009f (diff)
shiboken: Add a typedef typesystem entry
The intention is be able to specify typedef std::optional<int> OptionalInt in the typesystem file and generate code for it (without having a typedef in C++). Task-number: PYSIDE-725 Change-Id: I5847a3c3f68556ac1d0ea3635f65a29caa6cb208 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystem.h')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 51a8ec937..26f94e3ee 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -545,7 +545,8 @@ public:
CustomType,
TargetLangType,
FunctionType,
- SmartPointerType
+ SmartPointerType,
+ TypedefType
};
Q_ENUM(Type)
@@ -873,6 +874,8 @@ public:
virtual TypeEntry *clone() const;
+ void useAsTypedef(const TypeEntry *source);
+
#ifndef QT_NO_DEBUG_STREAM
virtual void formatDebug(QDebug &d) const;
#endif
@@ -1366,6 +1369,8 @@ public:
TypeEntry *clone() const override;
+ void useAsTypedef(const ComplexTypeEntry *source);
+
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &d) const override;
#endif
@@ -1395,6 +1400,36 @@ private:
const ComplexTypeEntry* m_baseContainerType = nullptr;
};
+class TypedefEntry : public ComplexTypeEntry
+{
+public:
+ explicit TypedefEntry(const QString &name,
+ const QString &sourceType,
+ const QVersionNumber &vr);
+
+ QString sourceType() const { return m_sourceType; }
+ void setSourceType(const QString &s) { m_sourceType =s; }
+
+ TypeEntry *clone() const override;
+
+ ComplexTypeEntry *source() const { return m_source; }
+ void setSource(ComplexTypeEntry *source) { m_source = source; }
+
+ ComplexTypeEntry *target() const { return m_target; }
+ void setTarget(ComplexTypeEntry *target) { m_target = target; }
+
+#ifndef QT_NO_DEBUG_STREAM
+ virtual void formatDebug(QDebug &d) const override;
+#endif
+protected:
+ TypedefEntry(const TypedefEntry &);
+
+private:
+ QString m_sourceType;
+ ComplexTypeEntry *m_source;
+ ComplexTypeEntry *m_target;
+};
+
class ContainerTypeEntry : public ComplexTypeEntry
{
Q_GADGET