diff options
Diffstat (limited to 'src/qml/qmldirparser')
-rw-r--r-- | src/qml/qmldirparser/qqmldirparser.cpp | 18 | ||||
-rw-r--r-- | src/qml/qmldirparser/qqmldirparser_p.h | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/qml/qmldirparser/qqmldirparser.cpp b/src/qml/qmldirparser/qqmldirparser.cpp index 047323a3d4..152e840318 100644 --- a/src/qml/qmldirparser/qqmldirparser.cpp +++ b/src/qml/qmldirparser/qqmldirparser.cpp @@ -205,7 +205,7 @@ bool QQmlDirParser::parse(const QString &source) } Component entry(sections[1], sections[2], -1, -1); entry.internal = true; - _components.insertMulti(entry.typeName, entry); + _components.insert(entry.typeName, entry); } else if (sections[0] == QLatin1String("singleton")) { if (sectionCount < 3 || sectionCount > 4) { reportError(lineNumber, 0, @@ -216,7 +216,7 @@ bool QQmlDirParser::parse(const QString &source) // singleton TestSingletonType TestSingletonType.qml Component entry(sections[1], sections[2], -1, -1); entry.singleton = true; - _components.insertMulti(entry.typeName, entry); + _components.insert(entry.typeName, entry); } else { // handle qmldir module listing case where singleton is defined in the following pattern: // singleton TestSingletonType 2.0 TestSingletonType20.qml @@ -225,7 +225,7 @@ bool QQmlDirParser::parse(const QString &source) const QString &fileName = sections[3]; Component entry(sections[1], fileName, major, minor); entry.singleton = true; - _components.insertMulti(entry.typeName, entry); + _components.insert(entry.typeName, entry); } else { reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[2])); } @@ -271,7 +271,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sectionCount == 2) { // No version specified (should only be used for relative qmldir files) const Component entry(sections[0], sections[1], -1, -1); - _components.insertMulti(entry.typeName, entry); + _components.insert(entry.typeName, entry); } else if (sectionCount == 3) { int major, minor; if (parseVersion(sections[1], &major, &minor)) { @@ -283,7 +283,7 @@ bool QQmlDirParser::parse(const QString &source) _scripts.append(entry); } else { const Component entry(sections[0], fileName, major, minor); - _components.insertMulti(entry.typeName, entry); + _components.insert(entry.typeName, entry); } } else { reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[1])); @@ -302,8 +302,8 @@ bool QQmlDirParser::parse(const QString &source) void QQmlDirParser::reportError(quint16 line, quint16 column, const QString &description) { QQmlJS::DiagnosticMessage error; - error.line = line; - error.column = column; + error.loc.startLine = line; + error.loc.startColumn = column; error.message = description; _errors.append(error); } @@ -319,7 +319,7 @@ bool QQmlDirParser::hasError() const void QQmlDirParser::setError(const QQmlJS::DiagnosticMessage &e) { _errors.clear(); - reportError(e.line, e.column, e.message); + reportError(e.loc.startLine, e.loc.startColumn, e.message); } QList<QQmlJS::DiagnosticMessage> QQmlDirParser::errors(const QString &uri) const @@ -350,7 +350,7 @@ QList<QQmlDirParser::Plugin> QQmlDirParser::plugins() const return _plugins; } -QHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const +QMultiHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const { return _components; } diff --git a/src/qml/qmldirparser/qqmldirparser_p.h b/src/qml/qmldirparser/qqmldirparser_p.h index 9fdeadfb0e..3696a1aa12 100644 --- a/src/qml/qmldirparser/qqmldirparser_p.h +++ b/src/qml/qmldirparser/qqmldirparser_p.h @@ -85,7 +85,7 @@ public: struct Plugin { - Plugin() {} + Plugin() = default; Plugin(const QString &name, const QString &path) : name(name), path(path) @@ -99,7 +99,7 @@ public: struct Component { - Component() {} + Component() = default; Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion), @@ -118,7 +118,7 @@ public: struct Script { - Script() {} + Script() = default; Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) @@ -132,7 +132,7 @@ public: int minorVersion = 0; }; - QHash<QString,Component> components() const; + QMultiHash<QString,Component> components() const; QHash<QString,Component> dependencies() const; QStringList imports() const; QList<Script> scripts() const; @@ -141,7 +141,7 @@ public: struct TypeInfo { - TypeInfo() {} + TypeInfo() = default; TypeInfo(const QString &fileName) : fileName(fileName) {} @@ -159,7 +159,7 @@ private: private: QList<QQmlJS::DiagnosticMessage> _errors; QString _typeNamespace; - QHash<QString,Component> _components; // multi hash + QMultiHash<QString,Component> _components; QHash<QString,Component> _dependencies; QStringList _imports; QList<Script> _scripts; @@ -169,9 +169,9 @@ private: QString _className; }; -typedef QHash<QString,QQmlDirParser::Component> QQmlDirComponents; -typedef QList<QQmlDirParser::Script> QQmlDirScripts; -typedef QList<QQmlDirParser::Plugin> QQmlDirPlugins; +using QQmlDirComponents = QMultiHash<QString,QQmlDirParser::Component>; +using QQmlDirScripts = QList<QQmlDirParser::Script>; +using QQmlDirPlugins = QList<QQmlDirParser::Plugin>; QDebug &operator<< (QDebug &, const QQmlDirParser::Component &); QDebug &operator<< (QDebug &, const QQmlDirParser::Script &); |