diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-01 14:28:08 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-05 14:58:42 +0200 |
commit | 2059c8be904541a31e75c1de9d3b5afa37c6954d (patch) | |
tree | 38cf8eb8876f31581c87e506248d5a4610db4a1d /src/qmlcompiler | |
parent | d200ccf92017ebc10a4ccdb5d944e1d803b87c1d (diff) |
QmlCompiler: Rename metatypes_p.h
Those are specific to QML/JS.
Change-Id: I45a5d4eb6c53bd5ca4026e042af83c4afaa4953c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler')
-rw-r--r-- | src/qmlcompiler/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/qmlcompiler/importedmembersvisitor.cpp | 14 | ||||
-rw-r--r-- | src/qmlcompiler/qmlcompiler.pro | 2 | ||||
-rw-r--r-- | src/qmlcompiler/qmljstypereader.cpp | 4 | ||||
-rw-r--r-- | src/qmlcompiler/qqmljsmetatypes_p.h (renamed from src/qmlcompiler/metatypes_p.h) | 22 | ||||
-rw-r--r-- | src/qmlcompiler/qqmljsscope.cpp | 4 | ||||
-rw-r--r-- | src/qmlcompiler/qqmljsscope_p.h | 24 | ||||
-rw-r--r-- | src/qmlcompiler/typedescriptionreader.cpp | 14 | ||||
-rw-r--r-- | src/qmlcompiler/typedescriptionreader_p.h | 4 |
9 files changed, 45 insertions, 45 deletions
diff --git a/src/qmlcompiler/CMakeLists.txt b/src/qmlcompiler/CMakeLists.txt index 62853541e5..c015a339a9 100644 --- a/src/qmlcompiler/CMakeLists.txt +++ b/src/qmlcompiler/CMakeLists.txt @@ -9,10 +9,10 @@ qt_add_module(QmlCompiler INTERNAL_MODULE SOURCES importedmembersvisitor.cpp importedmembersvisitor_p.h - metatypes_p.h qmljsimporter.cpp qmljsimporter_p.h qmljstypereader.cpp qmljstypereader_p.h qmlstreamwriter.cpp qmlstreamwriter_p.h + qqmljsmetatypes_p.h qqmljsscope.cpp qqmljsscope_p.h resourcefilemapper.cpp resourcefilemapper_p.h typedescriptionreader.cpp typedescriptionreader_p.h diff --git a/src/qmlcompiler/importedmembersvisitor.cpp b/src/qmlcompiler/importedmembersvisitor.cpp index 6b0cd1b9c9..95edc74d27 100644 --- a/src/qmlcompiler/importedmembersvisitor.cpp +++ b/src/qmlcompiler/importedmembersvisitor.cpp @@ -83,8 +83,8 @@ bool ImportedMembersVisitor::visit(UiPublicMember *publicMember) switch (publicMember->type) { case UiPublicMember::Signal: { UiParameterList *param = publicMember->parameters; - MetaMethod method; - method.setMethodType(MetaMethod::Signal); + QQmlJSMetaMethod method; + method.setMethodType(QQmlJSMetaMethod::Signal); method.setMethodName(publicMember->name.toString()); while (param) { method.addParameter(param->name.toString(), param->type->name.toString()); @@ -101,7 +101,7 @@ bool ImportedMembersVisitor::visit(UiPublicMember *publicMember) if (const auto idExpression = cast<IdentifierExpression *>(expression->expression)) typeName = idExpression->name; } - MetaProperty prop { + QQmlJSMetaProperty prop { publicMember->name.toString(), typeName.toString(), false, @@ -120,9 +120,9 @@ bool ImportedMembersVisitor::visit(UiPublicMember *publicMember) bool ImportedMembersVisitor::visit(UiSourceElement *sourceElement) { if (FunctionExpression *fexpr = sourceElement->sourceElement->asFunctionDefinition()) { - MetaMethod method; + QQmlJSMetaMethod method; method.setMethodName(fexpr->name.toString()); - method.setMethodType(MetaMethod::Method); + method.setMethodType(QQmlJSMetaMethod::Method); FormalParameterList *parameters = fexpr->formals; while (parameters) { method.addParameter(parameters->element->bindingIdentifier.toString(), QString()); @@ -130,7 +130,7 @@ bool ImportedMembersVisitor::visit(UiSourceElement *sourceElement) } currentObject()->addMethod(method); } else if (ClassExpression *clexpr = sourceElement->sourceElement->asClassDefinition()) { - MetaProperty prop { clexpr->name.toString(), QString(), false, false, false, false, 1 }; + QQmlJSMetaProperty prop { clexpr->name.toString(), QString(), false, false, false, false, 1 }; currentObject()->addProperty(prop); } else if (cast<VariableStatement *>(sourceElement->sourceElement)) { // nothing to do @@ -156,7 +156,7 @@ bool ImportedMembersVisitor::visit(UiScriptBinding *scriptBinding) bool ImportedMembersVisitor::visit(QQmlJS::AST::UiEnumDeclaration *uied) { - MetaEnum qmlEnum(uied->name.toString()); + QQmlJSMetaEnum qmlEnum(uied->name.toString()); for (const auto *member = uied->members; member; member = member->next) qmlEnum.addKey(member->member.toString()); currentObject()->addEnum(qmlEnum); diff --git a/src/qmlcompiler/qmlcompiler.pro b/src/qmlcompiler/qmlcompiler.pro index 2605eb8daf..159c7c40ed 100644 --- a/src/qmlcompiler/qmlcompiler.pro +++ b/src/qmlcompiler/qmlcompiler.pro @@ -17,7 +17,7 @@ HEADERS = \ importedmembersvisitor_p.h \ qmljsimporter_p.h \ qmljstypereader_p.h \ - metatypes_p.h \ + qqmljsmetatypes_p.h \ qqmljsscope_p.h \ typedescriptionreader_p.h \ qmlstreamwriter_p.h diff --git a/src/qmlcompiler/qmljstypereader.cpp b/src/qmlcompiler/qmljstypereader.cpp index 1b7587c107..2ffa10d3f4 100644 --- a/src/qmlcompiler/qmljstypereader.cpp +++ b/src/qmlcompiler/qmljstypereader.cpp @@ -73,8 +73,8 @@ static QQmlJSScope::Ptr parseProgram(QQmlJS::AST::Program *program, const QStrin result->setInternalName(name); for (auto *statement = program->statements; statement; statement = statement->next) { if (auto *function = cast<FunctionDeclaration *>(statement->statement)) { - MetaMethod method(function->name.toString()); - method.setMethodType(MetaMethod::Method); + QQmlJSMetaMethod method(function->name.toString()); + method.setMethodType(QQmlJSMetaMethod::Method); for (auto *parameters = function->formals; parameters; parameters = parameters->next) method.addParameter(parameters->element->bindingIdentifier.toString(), QString()); result->addMethod(method); diff --git a/src/qmlcompiler/metatypes_p.h b/src/qmlcompiler/qqmljsmetatypes_p.h index a821e3f0b6..fdd93ed71a 100644 --- a/src/qmlcompiler/metatypes_p.h +++ b/src/qmlcompiler/qqmljsmetatypes_p.h @@ -26,8 +26,8 @@ ** ****************************************************************************/ -#ifndef METATYPES_H -#define METATYPES_H +#ifndef QQMLJSMETATYPES_P_H +#define QQMLJSMETATYPES_P_H // // W A R N I N G @@ -54,7 +54,7 @@ // some other Item with custom properties. class QQmlJSScope; -class MetaEnum +class QQmlJSMetaEnum { QStringList m_keys; QString m_name; @@ -62,8 +62,8 @@ class MetaEnum bool m_isFlag = false; public: - MetaEnum() = default; - explicit MetaEnum(QString name) : m_name(std::move(name)) {} + QQmlJSMetaEnum() = default; + explicit QQmlJSMetaEnum(QString name) : m_name(std::move(name)) {} bool isValid() const { return !m_name.isEmpty(); } @@ -80,7 +80,7 @@ public: QStringList keys() const { return m_keys; } }; -class MetaMethod +class QQmlJSMetaMethod { public: enum Type { @@ -95,8 +95,8 @@ public: Public }; - MetaMethod() = default; - explicit MetaMethod(QString name, QString returnType = QString()) + QQmlJSMetaMethod() = default; + explicit QQmlJSMetaMethod(QString name, QString returnType = QString()) : m_name(std::move(name)) , m_returnTypeName(std::move(returnType)) , m_methodType(Method) @@ -160,7 +160,7 @@ private: int m_revision = 0; }; -class MetaProperty +class QQmlJSMetaProperty { QString m_propertyName; QString m_typeName; @@ -172,7 +172,7 @@ class MetaProperty int m_revision; public: - MetaProperty(QString propertyName, QString typeName, + QQmlJSMetaProperty(QString propertyName, QString typeName, bool isList, bool isWritable, bool isPointer, bool isAlias, int revision) : m_propertyName(std::move(propertyName)) @@ -197,4 +197,4 @@ public: int revision() const { return m_revision; } }; -#endif // METATYPES_H +#endif // QQMLJSMETATYPES_P_H diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp index 0d226e5c5c..6f02070b71 100644 --- a/src/qmlcompiler/qqmljsscope.cpp +++ b/src/qmlcompiler/qqmljsscope.cpp @@ -64,10 +64,10 @@ void QQmlJSScope::insertJSIdentifier(const QString &name, const JavaScriptIdenti } } -void QQmlJSScope::insertPropertyIdentifier(const MetaProperty &property) +void QQmlJSScope::insertPropertyIdentifier(const QQmlJSMetaProperty &property) { addProperty(property); - MetaMethod method(property.propertyName() + QLatin1String("Changed"), QLatin1String("void")); + QQmlJSMetaMethod method(property.propertyName() + QLatin1String("Changed"), QLatin1String("void")); addMethod(method); } diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h index 9d38ee7047..3fb501f976 100644 --- a/src/qmlcompiler/qqmljsscope_p.h +++ b/src/qmlcompiler/qqmljsscope_p.h @@ -39,7 +39,7 @@ // // We mean it. -#include "metatypes_p.h" +#include "qqmljsmetatypes_p.h" #include <QtQml/private/qqmljssourcelocation_p.h> @@ -126,18 +126,18 @@ public: void insertJSIdentifier(const QString &name, const JavaScriptIdentifier &identifier); // inserts property as qml identifier as well as the corresponding - void insertPropertyIdentifier(const MetaProperty &prop); + void insertPropertyIdentifier(const QQmlJSMetaProperty &prop); bool isIdInCurrentScope(const QString &id) const; ScopeType scopeType() const { return m_scopeType; } - void addMethods(const QMultiHash<QString, MetaMethod> &methods) { m_methods.unite(methods); } - void addMethod(const MetaMethod &method) { m_methods.insert(method.methodName(), method); } - QMultiHash<QString, MetaMethod> methods() const { return m_methods; } + void addMethods(const QMultiHash<QString, QQmlJSMetaMethod> &methods) { m_methods.unite(methods); } + void addMethod(const QQmlJSMetaMethod &method) { m_methods.insert(method.methodName(), method); } + QMultiHash<QString, QQmlJSMetaMethod> methods() const { return m_methods; } - void addEnum(const MetaEnum &fakeEnum) { m_enums.insert(fakeEnum.name(), fakeEnum); } - QHash<QString, MetaEnum> enums() const { return m_enums; } + void addEnum(const QQmlJSMetaEnum &fakeEnum) { m_enums.insert(fakeEnum.name(), fakeEnum); } + QHash<QString, QQmlJSMetaEnum> enums() const { return m_enums; } QString fileName() const { return m_fileName; } void setFileName(const QString &file) { m_fileName = file; } @@ -157,8 +157,8 @@ public: QString baseTypeName() const { return m_baseTypeName; } QQmlJSScope::ConstPtr baseType() const { return m_baseType; } - void addProperty(const MetaProperty &prop) { m_properties.insert(prop.propertyName(), prop); } - QHash<QString, MetaProperty> properties() const { return m_properties; } + void addProperty(const QQmlJSMetaProperty &prop) { m_properties.insert(prop.propertyName(), prop); } + QHash<QString, QQmlJSMetaProperty> properties() const { return m_properties; } QString defaultPropertyName() const { return m_defaultPropertyName; } void setDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; } @@ -195,9 +195,9 @@ private: QHash<QString, JavaScriptIdentifier> m_jsIdentifiers; - QMultiHash<QString, MetaMethod> m_methods; - QHash<QString, MetaProperty> m_properties; - QHash<QString, MetaEnum> m_enums; + QMultiHash<QString, QQmlJSMetaMethod> m_methods; + QHash<QString, QQmlJSMetaProperty> m_properties; + QHash<QString, QQmlJSMetaEnum> m_enums; QVector<QQmlJSScope::Ptr> m_childScopes; QQmlJSScope::WeakPtr m_parentScope; diff --git a/src/qmlcompiler/typedescriptionreader.cpp b/src/qmlcompiler/typedescriptionreader.cpp index c5df5f12a6..4c7d655385 100644 --- a/src/qmlcompiler/typedescriptionreader.cpp +++ b/src/qmlcompiler/typedescriptionreader.cpp @@ -263,12 +263,12 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast) void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isMethod, const QQmlJSScope::Ptr &scope) { - MetaMethod metaMethod; + QQmlJSMetaMethod metaMethod; // ### confusion between Method and Slot. Method should be removed. if (isMethod) - metaMethod.setMethodType(MetaMethod::Slot); + metaMethod.setMethodType(QQmlJSMetaMethod::Slot); else - metaMethod.setMethodType(MetaMethod::Signal); + metaMethod.setMethodType(QQmlJSMetaMethod::Signal); for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) { UiObjectMember *member = it->member; @@ -352,12 +352,12 @@ void TypeDescriptionReader::readProperty(UiObjectDefinition *ast, const QQmlJSSc return; } - scope->addProperty(MetaProperty(name, type, isList, !isReadonly, isPointer, false, revision)); + scope->addProperty(QQmlJSMetaProperty(name, type, isList, !isReadonly, isPointer, false, revision)); } void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, const QQmlJSScope::Ptr &scope) { - MetaEnum metaEnum; + QQmlJSMetaEnum metaEnum; for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) { UiObjectMember *member = it->member; @@ -385,7 +385,7 @@ void TypeDescriptionReader::readEnum(UiObjectDefinition *ast, const QQmlJSScope: scope->addEnum(metaEnum); } -void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, MetaMethod *metaMethod) +void TypeDescriptionReader::readParameter(UiObjectDefinition *ast, QQmlJSMetaMethod *metaMethod) { QString name; QString type; @@ -647,7 +647,7 @@ void TypeDescriptionReader::readMetaObjectRevisions(UiScriptBinding *ast, } } -void TypeDescriptionReader::readEnumValues(UiScriptBinding *ast, MetaEnum *metaEnum) +void TypeDescriptionReader::readEnumValues(UiScriptBinding *ast, QQmlJSMetaEnum *metaEnum) { if (!ast) return; diff --git a/src/qmlcompiler/typedescriptionreader_p.h b/src/qmlcompiler/typedescriptionreader_p.h index 91fc373656..f2f80d9d01 100644 --- a/src/qmlcompiler/typedescriptionreader_p.h +++ b/src/qmlcompiler/typedescriptionreader_p.h @@ -70,7 +70,7 @@ private: const QQmlJSScope::Ptr &scope); void readProperty(QQmlJS::AST::UiObjectDefinition *ast, const QQmlJSScope::Ptr &scope); void readEnum(QQmlJS::AST::UiObjectDefinition *ast, const QQmlJSScope::Ptr &scope); - void readParameter(QQmlJS::AST::UiObjectDefinition *ast, MetaMethod *metaMethod); + void readParameter(QQmlJS::AST::UiObjectDefinition *ast, QQmlJSMetaMethod *metaMethod); QString readStringBinding(QQmlJS::AST::UiScriptBinding *ast); bool readBoolBinding(QQmlJS::AST::UiScriptBinding *ast); @@ -79,7 +79,7 @@ private: int readIntBinding(QQmlJS::AST::UiScriptBinding *ast); void readExports(QQmlJS::AST::UiScriptBinding *ast, const QQmlJSScope::Ptr &scope); void readMetaObjectRevisions(QQmlJS::AST::UiScriptBinding *ast, const QQmlJSScope::Ptr &scope); - void readEnumValues(QQmlJS::AST::UiScriptBinding *ast, MetaEnum *metaEnum); + void readEnumValues(QQmlJS::AST::UiScriptBinding *ast, QQmlJSMetaEnum *metaEnum); void addError(const QQmlJS::SourceLocation &loc, const QString &message); void addWarning(const QQmlJS::SourceLocation &loc, const QString &message); |