diff options
Diffstat (limited to 'src/tools/moc/moc.h')
-rw-r--r-- | src/tools/moc/moc.h | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index af2a95c391..c1759fb0a3 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -7,11 +7,10 @@ #include "parser.h" #include <qstringlist.h> #include <qmap.h> -#include <qpair.h> #include <qjsondocument.h> #include <qjsonarray.h> #include <qjsonobject.h> -#include <qversionnumber.h> +#include <qtyperevision.h> #include <stdio.h> #include <private/qtools_p.h> @@ -43,10 +42,12 @@ struct EnumDef { QByteArray name; QByteArray enumName; + QByteArray type; QList<QByteArray> values; bool isEnumClass; // c++11 enum class EnumDef() : isEnumClass(false) {} QJsonObject toJson(const ClassDef &cdef) const; + QByteArray qualifiedType(const ClassDef *cdef) const; }; Q_DECLARE_TYPEINFO(EnumDef, Q_RELOCATABLE_TYPE); @@ -102,6 +103,8 @@ Q_DECLARE_TYPEINFO(FunctionDef, Q_RELOCATABLE_TYPE); struct PropertyDef { bool stdCppSet() const { + if (name.isEmpty()) + return false; QByteArray s("set"); s += QtMiscUtils::toAsciiUpper(name[0]); s += name.mid(1); @@ -118,7 +121,7 @@ struct PropertyDef bool required = false; int relativeIndex = -1; // property index in current metaobject - int location = -1; // token index, used for error reporting + qsizetype location = -1; // token index, used for error reporting QJsonObject toJson() const; }; @@ -148,12 +151,19 @@ struct BaseDef { QMap<QByteArray, bool> enumDeclarations; QList<EnumDef> enumList; QMap<QByteArray, QByteArray> flagAliases; - int begin = 0; - int end = 0; + qsizetype begin = 0; + qsizetype end = 0; }; +struct SuperClass { + QByteArray classname; + QByteArray qualified; + FunctionDef::Access access; +}; +Q_DECLARE_TYPEINFO(SuperClass, Q_RELOCATABLE_TYPE); + struct ClassDef : BaseDef { - QList<QPair<QByteArray, FunctionDef::Access>> superclassList; + QList<SuperClass> superclassList; struct Interface { @@ -197,6 +207,8 @@ Q_DECLARE_TYPEINFO(NamespaceDef, Q_RELOCATABLE_TYPE); class Moc : public Parser { public: + enum PropertyMode { Named, Anonymous }; + Moc() : noInclude(false), mustIncludeQPluginH(false), requireCompleteTypes(false) {} @@ -229,6 +241,10 @@ public: return index > def->begin && index < def->end - 1; } + const QByteArray &toFullyQualified(const QByteArray &name) const noexcept; + + void prependNamespaces(BaseDef &def, const QList<NamespaceDef> &namespaceList) const; + Type parseType(); bool parseEnum(EnumDef *def); @@ -238,9 +254,11 @@ public: void parseSlots(ClassDef *def, FunctionDef::Access access); void parseSignals(ClassDef *def); - void parseProperty(ClassDef *def); + void parseProperty(ClassDef *def, PropertyMode mode); void parsePluginData(ClassDef *def); - void createPropertyDef(PropertyDef &def, int propertyIndex); + + void createPropertyDef(PropertyDef &def, int propertyIndex, PropertyMode mode); + void parsePropertyAttributes(PropertyDef &propDef); void parseEnumOrFlag(BaseDef *def, bool isFlag); void parseFlag(BaseDef *def); @@ -253,7 +271,7 @@ public: void parseMocInclude(); void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access); QByteArray parsePropertyAccessor(); - void parsePrivateProperty(ClassDef *def); + void parsePrivateProperty(ClassDef *def, PropertyMode mode); void parseFunctionArguments(FunctionDef *def); @@ -271,6 +289,9 @@ public: void checkSuperClasses(ClassDef *def); void checkProperties(ClassDef* cdef); + bool testForFunctionModifiers(FunctionDef *def); + + void checkListSizes(const ClassDef &def); }; inline QByteArray noRef(const QByteArray &type) |