| abstractmetalang.h | | abstractmetalang.h | |
| | | | |
| skipping to change at line 317 | | skipping to change at line 317 | |
| enum TypeUsagePattern { | | enum TypeUsagePattern { | |
| InvalidPattern, | | InvalidPattern, | |
| PrimitivePattern, | | PrimitivePattern, | |
| FlagsPattern, | | FlagsPattern, | |
| EnumPattern, | | EnumPattern, | |
| ValuePattern, | | ValuePattern, | |
| StringPattern, | | StringPattern, | |
| CharPattern, | | CharPattern, | |
| ObjectPattern, | | ObjectPattern, | |
| QObjectPattern, | | QObjectPattern, | |
|
| | | ValuePointerPattern, | |
| NativePointerPattern, | | NativePointerPattern, | |
| ContainerPattern, | | ContainerPattern, | |
| VariantPattern, | | VariantPattern, | |
| JObjectWrapperPattern, | | JObjectWrapperPattern, | |
| ArrayPattern, | | ArrayPattern, | |
| ThreadPattern | | ThreadPattern | |
| }; | | }; | |
| | | | |
| AbstractMetaType() : | | AbstractMetaType() : | |
| m_typeEntry(0), | | m_typeEntry(0), | |
| | | | |
| skipping to change at line 344 | | skipping to change at line 345 | |
| m_indirections(0), | | m_indirections(0), | |
| m_reserved(0) | | m_reserved(0) | |
| {} | | {} | |
| | | | |
| QString package() const | | QString package() const | |
| { | | { | |
| return m_typeEntry->targetLangPackage(); | | return m_typeEntry->targetLangPackage(); | |
| } | | } | |
| QString name() const | | QString name() const | |
| { | | { | |
|
| return m_typeEntry->targetLangName(); | | return QString(m_typeEntry->targetLangName()).split("::").last(); | |
| } | | } | |
| QString fullName() const | | QString fullName() const | |
| { | | { | |
| return m_typeEntry->qualifiedTargetLangName(); | | return m_typeEntry->qualifiedTargetLangName(); | |
| } | | } | |
| | | | |
| void setTypeUsagePattern(TypeUsagePattern pattern) | | void setTypeUsagePattern(TypeUsagePattern pattern) | |
| { | | { | |
| m_pattern = pattern; | | m_pattern = pattern; | |
| } | | } | |
| | | | |
| skipping to change at line 427 | | skipping to change at line 428 | |
| { | | { | |
| return m_pattern == ArrayPattern; | | return m_pattern == ArrayPattern; | |
| } | | } | |
| | | | |
| // returns true if the type is used as a value type (X or const X &) | | // returns true if the type is used as a value type (X or const X &) | |
| bool isValue() const | | bool isValue() const | |
| { | | { | |
| return m_pattern == ValuePattern; | | return m_pattern == ValuePattern; | |
| } | | } | |
| | | | |
|
| | | bool isValuePointer() const | |
| | | { | |
| | | return m_pattern == ValuePointerPattern; | |
| | | } | |
| | | | |
| // returns true for more complex types... | | // returns true for more complex types... | |
| bool isNativePointer() const | | bool isNativePointer() const | |
| { | | { | |
| return m_pattern == NativePointerPattern; | | return m_pattern == NativePointerPattern; | |
| } | | } | |
| | | | |
| // returns true if the type was originally a QString or const QString &
or equivalent for QLatin1String | | // returns true if the type was originally a QString or const QString &
or equivalent for QLatin1String | |
| bool isTargetLangString() const | | bool isTargetLangString() const | |
| { | | { | |
| return m_pattern == StringPattern; | | return m_pattern == StringPattern; | |
| | | | |
| skipping to change at line 1358 | | skipping to change at line 1364 | |
| AbstractMetaFunctionList functionsInShellClass() const; | | AbstractMetaFunctionList functionsInShellClass() const; | |
| inline AbstractMetaFunctionList cppInconsistentFunctions() const; | | inline AbstractMetaFunctionList cppInconsistentFunctions() const; | |
| inline AbstractMetaFunctionList cppSignalFunctions() const; | | inline AbstractMetaFunctionList cppSignalFunctions() const; | |
| AbstractMetaFunctionList publicOverrideFunctions() const; | | AbstractMetaFunctionList publicOverrideFunctions() const; | |
| AbstractMetaFunctionList virtualOverrideFunctions() const; | | AbstractMetaFunctionList virtualOverrideFunctions() const; | |
| AbstractMetaFunctionList virtualFunctions() const; | | AbstractMetaFunctionList virtualFunctions() const; | |
| AbstractMetaFunctionList nonVirtualShellFunctions() const; | | AbstractMetaFunctionList nonVirtualShellFunctions() const; | |
| AbstractMetaFunctionList implicitConversions() const; | | AbstractMetaFunctionList implicitConversions() const; | |
| | | | |
| /** | | /** | |
|
| * Retrives all class' operator overloads that meet | | * Retrieves all class' operator overloads that meet | |
| * query crieteria defined with the OperatorQueryOption | | * query crieteria defined with the OperatorQueryOption | |
| * enum. | | * enum. | |
| * /param query composition of OperatorQueryOption enum values | | * /param query composition of OperatorQueryOption enum values | |
| * /return list of operator overload methods that meet the | | * /return list of operator overload methods that meet the | |
| * query criteria | | * query criteria | |
| */ | | */ | |
| AbstractMetaFunctionList operatorOverloads(uint query = AllOperators) c
onst; | | AbstractMetaFunctionList operatorOverloads(uint query = AllOperators) c
onst; | |
| | | | |
| bool hasOperatorOverload() const; | | bool hasOperatorOverload() const; | |
| bool hasArithmeticOperatorOverload() const; | | bool hasArithmeticOperatorOverload() const; | |
| | | | |
| skipping to change at line 1421 | | skipping to change at line 1427 | |
| return m_interfaces; | | return m_interfaces; | |
| } | | } | |
| void addInterface(AbstractMetaClass *interface); | | void addInterface(AbstractMetaClass *interface); | |
| void setInterfaces(const AbstractMetaClassList &interface); | | void setInterfaces(const AbstractMetaClassList &interface); | |
| | | | |
| QString fullName() const | | QString fullName() const | |
| { | | { | |
| return package() + "." + name(); | | return package() + "." + name(); | |
| } | | } | |
| | | | |
|
| | | /** | |
| | | * Retrieves the class name without any namespace/scope information. | |
| | | * /return the class name without scope information | |
| | | */ | |
| QString name() const; | | QString name() const; | |
| | | | |
| QString baseClassName() const | | QString baseClassName() const | |
| { | | { | |
| return m_baseClass ? m_baseClass->name() : QString(); | | return m_baseClass ? m_baseClass->name() : QString(); | |
| } | | } | |
| | | | |
| AbstractMetaClass *baseClass() const | | AbstractMetaClass *baseClass() const | |
| { | | { | |
| return m_baseClass; | | return m_baseClass; | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 12 lines changed or added | |
|
| apiextractor.h | | apiextractor.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * You should have received a copy of the GNU General Public License | | * You should have received a copy of the GNU General Public License | |
| * along with this program; if not, write to the Free Software | | * along with this program; if not, write to the Free Software | |
| * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| * 02110-1301 USA | | * 02110-1301 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef APIEXTRACTOR_H | | #ifndef APIEXTRACTOR_H | |
| #define APIEXTRACTOR_H | | #define APIEXTRACTOR_H | |
| | | | |
|
| #include <QLinkedList> | | #include "reporthandler.h" | |
| #include <QMap> | | #include "abstractmetalang.h" | |
| #include <QString> | | #include <QStringList> | |
| | | | |
|
| class Generator; | | class AbstractMetaBuilder; | |
| | | class QIODevice; | |
| | | | |
| class ApiExtractor | | class ApiExtractor | |
| { | | { | |
| public: | | public: | |
|
| ApiExtractor(int argc, char** argv); | | ApiExtractor(); | |
| ~ApiExtractor(); | | ~ApiExtractor(); | |
| | | | |
|
| void addGenerator(Generator* generator); | | void setTypeSystem(const QString& typeSystemFileName); | |
| void setVersionHandler(void (*versionHandler)(const char*)) | | void setCppFileName(const QString& cppFileName); | |
| { | | void setDebugLevel(ReportHandler::DebugLevel debugLevel); | |
| m_versionHandler = versionHandler; | | void setSuppressWarnings(bool value); | |
| } | | void setSilent(bool value); | |
| | | void addTypesystemSearchPath(const QString& path); | |
| | | void addTypesystemSearchPath(const QStringList& paths); | |
| | | void addIncludePath(const QString& path); | |
| | | void addIncludePath(const QStringList& paths); | |
| | | | |
|
| int exec(); | | AbstractMetaEnumList globalEnums() const; | |
| | | AbstractMetaFunctionList globalFunctions() const; | |
| | | AbstractMetaClassList classes() const; | |
| | | PrimitiveTypeEntryList primitiveTypes() const; | |
| | | ContainerTypeEntryList containerTypes() const; | |
| | | QSet<QString> qtMetaTypeDeclaredTypeNames() const; | |
| | | | |
|
| | | int classCount() const; | |
| | | | |
| | | bool run(); | |
| private: | | private: | |
|
| QLinkedList<Generator*> m_generators; | | | |
| QMap<QString, QString> m_args; | | | |
| QString m_typeSystemFileName; | | QString m_typeSystemFileName; | |
|
| QString m_globalHeaderFileName; | | QString m_cppFileName; | |
| const char* m_programName; | | QStringList m_includePaths; | |
| void (*m_versionHandler)(const char*); | | AbstractMetaBuilder* m_builder; | |
| | | | |
| bool parseGeneralArgs(); | | | |
| void printUsage(); | | | |
| | | | |
| // disable copy | | // disable copy | |
| ApiExtractor(const ApiExtractor&); | | ApiExtractor(const ApiExtractor&); | |
| ApiExtractor& operator=(const ApiExtractor&); | | ApiExtractor& operator=(const ApiExtractor&); | |
| }; | | }; | |
| | | | |
| #endif // APIEXTRACTOR_H | | #endif // APIEXTRACTOR_H | |
| | | | |
End of changes. 8 change blocks. |
| 19 lines changed or deleted | | 27 lines changed or added | |
|
| typesystem.h | | typesystem.h | |
| | | | |
| skipping to change at line 250 | | skipping to change at line 250 | |
| // QtScript | | // QtScript | |
| Declaration, | | Declaration, | |
| PrototypeInitialization, | | PrototypeInitialization, | |
| ConstructorInitialization, | | ConstructorInitialization, | |
| Constructor | | Constructor | |
| }; | | }; | |
| | | | |
| CodeSnip() : language(TypeSystem::TargetLangCode) { } | | CodeSnip() : language(TypeSystem::TargetLangCode) { } | |
| CodeSnip(TypeSystem::Language lang) : language(lang) { } | | CodeSnip(TypeSystem::Language lang) : language(lang) { } | |
| | | | |
|
| // Very simple, easy to make code ugly if you try | | | |
| QTextStream &formattedCode(QTextStream &s, Indentor &indentor) const; | | | |
| | | | |
| TypeSystem::Language language; | | TypeSystem::Language language; | |
| Position position; | | Position position; | |
| ArgumentMap argumentMap; | | ArgumentMap argumentMap; | |
| }; | | }; | |
| typedef QList<CodeSnip> CodeSnipList; | | typedef QList<CodeSnip> CodeSnipList; | |
| | | | |
| struct ArgumentModification | | struct ArgumentModification | |
| { | | { | |
| ArgumentModification(int idx) | | ArgumentModification(int idx) | |
| : removedDefaultExpression(false), removed(false), | | : removedDefaultExpression(false), removed(false), | |
| | | | |
| skipping to change at line 768 | | skipping to change at line 765 | |
| | | | |
| void setDocModification(const DocModificationList& docMods) | | void setDocModification(const DocModificationList& docMods) | |
| { | | { | |
| m_docModifications << docMods; | | m_docModifications << docMods; | |
| } | | } | |
| DocModificationList docModifications() const | | DocModificationList docModifications() const | |
| { | | { | |
| return m_docModifications; | | return m_docModifications; | |
| } | | } | |
| | | | |
|
| | | IncludeList extraIncludes() const | |
| | | { | |
| | | return m_extraIncludes; | |
| | | } | |
| | | void setExtraIncludes(const IncludeList &includes) | |
| | | { | |
| | | m_extraIncludes = includes; | |
| | | } | |
| | | void addExtraInclude(const Include &include) | |
| | | { | |
| | | if (!m_includesUsed.value(include.name, false)) { | |
| | | m_extraIncludes << include; | |
| | | m_includesUsed[include.name] = true; | |
| | | } | |
| | | } | |
| | | | |
| | | Include include() const | |
| | | { | |
| | | return m_include; | |
| | | } | |
| | | void setInclude(const Include &inc) | |
| | | { | |
| | | m_include = inc; | |
| | | } | |
| | | | |
| private: | | private: | |
| QString m_name; | | QString m_name; | |
| Type m_type; | | Type m_type; | |
| uint m_codeGeneration; | | uint m_codeGeneration; | |
| CustomFunction m_customConstructor; | | CustomFunction m_customConstructor; | |
| CustomFunction m_customDestructor; | | CustomFunction m_customDestructor; | |
| bool m_preferredConversion; | | bool m_preferredConversion; | |
| CodeSnipList m_codeSnips; | | CodeSnipList m_codeSnips; | |
| DocModificationList m_docModifications; | | DocModificationList m_docModifications; | |
|
| | | IncludeList m_extraIncludes; | |
| | | Include m_include; | |
| | | QHash<QString, bool> m_includesUsed; | |
| }; | | }; | |
| typedef QHash<QString, QList<TypeEntry *> > TypeEntryHash; | | typedef QHash<QString, QList<TypeEntry *> > TypeEntryHash; | |
| typedef QHash<QString, TypeEntry *> SingleTypeEntryHash; | | typedef QHash<QString, TypeEntry *> SingleTypeEntryHash; | |
| | | | |
| class TypeSystemTypeEntry : public TypeEntry | | class TypeSystemTypeEntry : public TypeEntry | |
| { | | { | |
| public: | | public: | |
| TypeSystemTypeEntry(const QString &name) | | TypeSystemTypeEntry(const QString &name) | |
| : TypeEntry(name, TypeSystemType) | | : TypeEntry(name, TypeSystemType) | |
| { | | { | |
| | | | |
| skipping to change at line 963 | | skipping to change at line 988 | |
| } | | } | |
| | | | |
| private: | | private: | |
| QString m_targetLangName; | | QString m_targetLangName; | |
| QString m_targetLangApiName; | | QString m_targetLangApiName; | |
| uint m_preferredConversion : 1; | | uint m_preferredConversion : 1; | |
| uint m_preferredTargetLangType : 1; | | uint m_preferredTargetLangType : 1; | |
| PrimitiveTypeEntry* m_aliasedTypeEntry; | | PrimitiveTypeEntry* m_aliasedTypeEntry; | |
| }; | | }; | |
| | | | |
|
| | | typedef QList<const PrimitiveTypeEntry*> PrimitiveTypeEntryList; | |
| | | | |
| struct EnumValueRedirection | | struct EnumValueRedirection | |
| { | | { | |
| EnumValueRedirection(const QString &rej, const QString &us) | | EnumValueRedirection(const QString &rej, const QString &us) | |
| : rejected(rej), | | : rejected(rej), | |
| used(us) | | used(us) | |
| { | | { | |
| } | | } | |
| QString rejected; | | QString rejected; | |
| QString used; | | QString used; | |
| }; | | }; | |
| | | | |
| skipping to change at line 1209 | | skipping to change at line 1236 | |
| m_copyableFlag(Unknown), | | m_copyableFlag(Unknown), | |
| m_hashFunction("") | | m_hashFunction("") | |
| { | | { | |
| } | | } | |
| | | | |
| bool isComplex() const | | bool isComplex() const | |
| { | | { | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| IncludeList extraIncludes() const | | | |
| { | | | |
| return m_extraIncludes; | | | |
| } | | | |
| void setExtraIncludes(const IncludeList &includes) | | | |
| { | | | |
| m_extraIncludes = includes; | | | |
| } | | | |
| void addExtraInclude(const Include &include) | | | |
| { | | | |
| if (!m_includesUsed.value(include.name, false)) { | | | |
| m_extraIncludes << include; | | | |
| m_includesUsed[include.name] = true; | | | |
| } | | | |
| } | | | |
| | | | |
| ComplexTypeEntry *copy() const | | ComplexTypeEntry *copy() const | |
| { | | { | |
| ComplexTypeEntry *centry = new ComplexTypeEntry(name(), type()); | | ComplexTypeEntry *centry = new ComplexTypeEntry(name(), type()); | |
| centry->setInclude(include()); | | centry->setInclude(include()); | |
| centry->setExtraIncludes(extraIncludes()); | | centry->setExtraIncludes(extraIncludes()); | |
| centry->setFunctionModifications(functionModifications()); | | centry->setFunctionModifications(functionModifications()); | |
| centry->setFieldModifications(fieldModifications()); | | centry->setFieldModifications(fieldModifications()); | |
| centry->setQObject(isQObject()); | | centry->setQObject(isQObject()); | |
| centry->setDefaultSuperclass(defaultSuperclass()); | | centry->setDefaultSuperclass(defaultSuperclass()); | |
| centry->setCodeSnips(codeSnips()); | | centry->setCodeSnips(codeSnips()); | |
| | | | |
| skipping to change at line 1255 | | skipping to change at line 1266 | |
| virtual QString lookupName() const | | virtual QString lookupName() const | |
| { | | { | |
| return m_lookupName.isEmpty() ? targetLangName() : m_lookupName; | | return m_lookupName.isEmpty() ? targetLangName() : m_lookupName; | |
| } | | } | |
| | | | |
| QString targetLangApiName() const | | QString targetLangApiName() const | |
| { | | { | |
| return strings_jobject; | | return strings_jobject; | |
| } | | } | |
| | | | |
|
| Include include() const | | | |
| { | | | |
| return m_include; | | | |
| } | | | |
| void setInclude(const Include &inc) | | | |
| { | | | |
| m_include = inc; | | | |
| } | | | |
| | | | |
| void setTypeFlags(TypeFlags flags) | | void setTypeFlags(TypeFlags flags) | |
| { | | { | |
| m_typeFlags = flags; | | m_typeFlags = flags; | |
| } | | } | |
| | | | |
| TypeFlags typeFlags() const | | TypeFlags typeFlags() const | |
| { | | { | |
| return m_typeFlags; | | return m_typeFlags; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 1414 | | skipping to change at line 1416 | |
| QString hashFunction() const | | QString hashFunction() const | |
| { | | { | |
| return m_hashFunction; | | return m_hashFunction; | |
| } | | } | |
| void setHashFunction(QString hashFunction) | | void setHashFunction(QString hashFunction) | |
| { | | { | |
| m_hashFunction = hashFunction; | | m_hashFunction = hashFunction; | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| IncludeList m_extraIncludes; | | | |
| Include m_include; | | | |
| QHash<QString, bool> m_includesUsed; | | | |
| FunctionModificationList m_functionMods; | | FunctionModificationList m_functionMods; | |
| FieldModificationList m_fieldMods; | | FieldModificationList m_fieldMods; | |
| QString m_package; | | QString m_package; | |
| QString m_defaultSuperclass; | | QString m_defaultSuperclass; | |
| QString m_qualifiedCppName; | | QString m_qualifiedCppName; | |
| QString m_targetLangName; | | QString m_targetLangName; | |
| | | | |
| uint m_qobject : 1; | | uint m_qobject : 1; | |
| uint m_polymorphicBase : 1; | | uint m_polymorphicBase : 1; | |
| uint m_genericClass : 1; | | uint m_genericClass : 1; | |
| | | | |
| skipping to change at line 1495 | | skipping to change at line 1494 | |
| m_stringToContainerType["multi-hash"] = MultiHashContainer; | | m_stringToContainerType["multi-hash"] = MultiHashContainer; | |
| m_stringToContainerType["pair"] = PairContainer; | | m_stringToContainerType["pair"] = PairContainer; | |
| } | | } | |
| return m_stringToContainerType.value(typeName, NoContainer); | | return m_stringToContainerType.value(typeName, NoContainer); | |
| } | | } | |
| | | | |
| private: | | private: | |
| Type m_type; | | Type m_type; | |
| }; | | }; | |
| | | | |
|
| | | typedef QList<const ContainerTypeEntry*> ContainerTypeEntryList; | |
| | | | |
| class NamespaceTypeEntry : public ComplexTypeEntry | | class NamespaceTypeEntry : public ComplexTypeEntry | |
| { | | { | |
| public: | | public: | |
| NamespaceTypeEntry(const QString &name) : ComplexTypeEntry(name, Namesp
aceType) { } | | NamespaceTypeEntry(const QString &name) : ComplexTypeEntry(name, Namesp
aceType) { } | |
| }; | | }; | |
| | | | |
| class ValueTypeEntry : public ComplexTypeEntry | | class ValueTypeEntry : public ComplexTypeEntry | |
| { | | { | |
| public: | | public: | |
| ValueTypeEntry(const QString &name) : ComplexTypeEntry(name, BasicValue
Type) { } | | ValueTypeEntry(const QString &name) : ComplexTypeEntry(name, BasicValue
Type) { } | |
| | | | |
End of changes. 8 change blocks. |
| 31 lines changed or deleted | | 32 lines changed or added | |
|