diff options
Diffstat (limited to 'sources/shiboken6/ApiExtractor/typedatabase.h')
-rw-r--r-- | sources/shiboken6/ApiExtractor/typedatabase.h | 108 |
1 files changed, 52 insertions, 56 deletions
diff --git a/sources/shiboken6/ApiExtractor/typedatabase.h b/sources/shiboken6/ApiExtractor/typedatabase.h index 0ea7097be..d5adca324 100644 --- a/sources/shiboken6/ApiExtractor/typedatabase.h +++ b/sources/shiboken6/ApiExtractor/typedatabase.h @@ -5,26 +5,19 @@ #define TYPEDATABASE_H #include "include.h" +#include "modifications_typedefs.h" #include "typedatabase_typedefs.h" -#include "typesystem_enums.h" -#include "typesystem_typedefs.h" #include <QtCore/QRegularExpression> #include <QtCore/QStringList> #include <QtCore/QVersionNumber> -#include <QtCore/QSharedPointer> -QT_FORWARD_DECLARE_CLASS(QIODevice) +#include <memory> -class ComplexTypeEntry; -class ContainerTypeEntry; -class FlagsTypeEntry; -class FunctionTypeEntry; -class NamespaceTypeEntry; -class ObjectTypeEntry; -class TemplateEntry; -class TypeEntry; +QT_FORWARD_DECLARE_CLASS(QIODevice) +struct OptionDescription; +class OptionsParser; struct TypeDatabasePrivate; struct TypeDatabaseParserContext; @@ -32,10 +25,6 @@ QT_FORWARD_DECLARE_CLASS(QDebug) int getMaxTypeIndex(); -class ContainerTypeEntry; -class PrimitiveTypeEntry; -class TypeSystemTypeEntry; - struct VersionRange { bool isNull() const @@ -62,7 +51,9 @@ struct TypeRejection QRegularExpression className; QRegularExpression pattern; - MatchType matchType; + MatchType matchType = ExcludeClass; + bool generate; // Current type system + mutable bool matched = false; }; #ifndef QT_NO_DEBUG_STREAM @@ -72,10 +63,14 @@ QDebug operator<<(QDebug d, const TypeRejection &r); class TypeDatabase { TypeDatabase(); - Q_DISABLE_COPY(TypeDatabase) public: + Q_DISABLE_COPY_MOVE(TypeDatabase) + ~TypeDatabase(); + static QList<OptionDescription> options(); + std::shared_ptr<OptionsParser> createOptionsParser(); + /** * Return the type system instance. * \param newInstance This parameter is useful just for unit testing, because singletons causes @@ -90,39 +85,37 @@ public: void addRequiredTargetImport(const QString &moduleName); - void addTypesystemPath(const QString &typesystem_paths); - - void setTypesystemKeywords(const QStringList &keywords); QStringList typesystemKeywords() const; IncludeList extraIncludes(const QString &className) const; - const QStringList &systemIncludes() const; - void addSystemInclude(const QString &name); + const QStringList &forceProcessSystemIncludes() const; + void addForceProcessSystemInclude(const QString &name); - void addInlineNamespaceLookups(const NamespaceTypeEntry *n); + void addInlineNamespaceLookups(const NamespaceTypeEntryCPtr &n); - PrimitiveTypeEntry *findPrimitiveType(const QString &name) const; - ComplexTypeEntry *findComplexType(const QString &name) const; - ObjectTypeEntry *findObjectType(const QString &name) const; + PrimitiveTypeEntryPtr findPrimitiveType(const QString &name) const; + ComplexTypeEntryPtr findComplexType(const QString &name) const; + ObjectTypeEntryPtr findObjectType(const QString &name) const; NamespaceTypeEntryList findNamespaceTypes(const QString &name) const; - NamespaceTypeEntry *findNamespaceType(const QString &name, const QString &fileName = QString()) const; - ContainerTypeEntry *findContainerType(const QString &name) const; - FunctionTypeEntry *findFunctionType(const QString &name) const; - const TypeSystemTypeEntry *findTypeSystemType(const QString &name) const; - const TypeSystemTypeEntry *defaultTypeSystemType() const; + NamespaceTypeEntryPtr findNamespaceType(const QString &name, const QString &fileName = QString()) const; + ContainerTypeEntryPtr findContainerType(const QString &name) const; + FunctionTypeEntryPtr findFunctionType(const QString &name) const; + TypeSystemTypeEntryCPtr findTypeSystemType(const QString &name) const; + TypeSystemTypeEntryCPtr defaultTypeSystemType() const; + QString loadedTypeSystemNames() const; QString defaultPackageName() const; - TypeEntry *findType(const QString &name) const; - TypeEntries findTypes(const QString &name) const; - TypeEntries findCppTypes(const QString &name) const; + TypeEntryPtr findType(const QString &name) const; + TypeEntryCList findTypes(const QString &name) const; + TypeEntryCList findCppTypes(const QString &name) const; const TypeEntryMultiMap &entries() const; const TypedefEntryMap &typedefEntries() const; - PrimitiveTypeEntryList primitiveTypes() const; + PrimitiveTypeEntryCList primitiveTypes() const; - ContainerTypeEntryList containerTypes() const; + ContainerTypeEntryCList containerTypes() const; SmartPointerTypeEntryList smartPointerTypes() const; @@ -139,21 +132,21 @@ public: bool isReturnTypeRejected(const QString &className, const QString &typeName, QString *reason = nullptr) const; - bool addType(TypeEntry *e, QString *errorMessage = nullptr); - ConstantValueTypeEntry *addConstantValueTypeEntry(const QString &value, - const TypeEntry *parent); - void addTypeSystemType(const TypeSystemTypeEntry *e); + bool addType(const TypeEntryPtr &e, QString *errorMessage = nullptr); + ConstantValueTypeEntryPtr addConstantValueTypeEntry(const QString &value, + const TypeEntryCPtr &parent); + void addTypeSystemType(const TypeSystemTypeEntryCPtr &e); - static ComplexTypeEntry * - initializeTypeDefEntry(TypedefEntry *typedefEntry, - const ComplexTypeEntry *source); + static ComplexTypeEntryPtr + initializeTypeDefEntry(const TypedefEntryPtr &typedefEntry, + const ComplexTypeEntryCPtr &source); - FlagsTypeEntry *findFlagsType(const QString &name) const; - void addFlagsType(FlagsTypeEntry *fte); + FlagsTypeEntryPtr findFlagsType(const QString &name) const; + void addFlagsType(const FlagsTypeEntryPtr &fte); - TemplateEntry *findTemplate(const QString &name) const; + TemplateEntryPtr findTemplate(const QString &name) const; - void addTemplate(TemplateEntry *t); + void addTemplate(const TemplateEntryPtr &t); void addTemplate(const QString &name, const QString &code); AddedFunctionList globalUserFunctions() const; @@ -164,24 +157,23 @@ public: void addGlobalUserFunctionModifications(const FunctionModificationList &functionModifications); - FunctionModificationList functionModifications(const QString &signature) const; + FunctionModificationList + globalFunctionModifications(const QStringList &signatures) const; - void setSuppressWarnings(bool on); - - bool addSuppressedWarning(const QString &warning, QString *errorMessage); + bool addSuppressedWarning(const QString &warning, bool generate, QString *errorMessage); bool isSuppressedWarning(QStringView s) const; - static QString globalNamespaceClassName(const TypeEntry *te); + static QString globalNamespaceClassName(const TypeEntryCPtr &te); // Top level file parsing bool parseFile(const QString &filename, bool generate = true); - bool parseFile(const QSharedPointer<TypeDatabaseParserContext> &context, + bool parseFile(const std::shared_ptr<TypeDatabaseParserContext> &context, const QString &filename, const QString ¤tPath, bool generate); // Top level QIODevice parsing for tests. bool parseFile(QIODevice *device, bool generate = true); - bool parseFile(const QSharedPointer<TypeDatabaseParserContext> &context, + bool parseFile(const std::shared_ptr<TypeDatabaseParserContext> &context, QIODevice *device, bool generate = true); static bool setApiVersion(const QString &package, const QString &version); @@ -193,19 +185,23 @@ public: bool shouldDropTypeEntry(const QString &fullTypeName) const; - void setDropTypeEntries(QStringList dropTypeEntries); + void setDropTypeEntries(const QStringList &dropTypeEntries); QString modifiedTypesystemFilepath(const QString &tsFile, const QString ¤tPath = QString()) const; + void logUnmatched() const; + #ifndef QT_NO_DEBUG_STREAM void formatDebug(QDebug &d) const; #endif + void formatBuiltinTypes(QDebug debug) const; private: TypeDatabasePrivate *d; }; #ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug d, const TypeEntryCPtr &te); QDebug operator<<(QDebug d, const TypeEntry *te); QDebug operator<<(QDebug d, const TypeDatabase &db); #endif |