diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-22 14:20:34 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-25 22:30:54 +0200 |
commit | e114e580e751b5deb19ab489a8b11f830ff6356f (patch) | |
tree | 84de468bc796a524eda9abaf768990fce5efbf62 /src | |
parent | 5bb3d64682cea8698a0229d10620e0861d461431 (diff) | |
download | qtbase-e114e580e751b5deb19ab489a8b11f830ff6356f.tar.gz |
Use QList instead of QVector in other tools
Task-number: QTBUG-84469
Change-Id: I90d0e2e723bb4d205d7bf333b21cdf583fdf4ea0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 9 | ||||
-rw-r--r-- | src/tools/qlalr/compress.cpp | 23 | ||||
-rw-r--r-- | src/tools/qlalr/compress.h | 6 | ||||
-rw-r--r-- | src/tools/qlalr/cppgenerator.cpp | 2 | ||||
-rw-r--r-- | src/tools/qlalr/cppgenerator.h | 4 | ||||
-rw-r--r-- | src/tools/qlalr/lalr.g | 2 | ||||
-rw-r--r-- | src/tools/qlalr/recognizer.h | 2 | ||||
-rw-r--r-- | src/tools/qvkgen/qvkgen.cpp | 17 | ||||
-rw-r--r-- | src/tools/tracegen/helpers.cpp | 8 | ||||
-rw-r--r-- | src/tools/tracegen/helpers.h | 4 | ||||
-rw-r--r-- | src/tools/tracegen/provider.h | 6 |
11 files changed, 42 insertions, 41 deletions
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 768594efb4..5d6ee665c7 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -81,8 +81,7 @@ static const char help[] = " -V Show the program version and quit.\n" "\n"; - -int qDBusParametersForMethod(const FunctionDef &mm, QVector<int>& metaTypes, QString &errorMsg) +int qDBusParametersForMethod(const FunctionDef &mm, QList<int> &metaTypes, QString &errorMsg) { QList<QByteArray> parameterTypes; parameterTypes.reserve(mm.arguments.size()); @@ -125,8 +124,8 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) { return QString(); // wasn't a valid type } } - QVector<ArgumentDef> names = mm.arguments; - QVector<int> types; + QList<ArgumentDef> names = mm.arguments; + QList<int> types; QString errorMsg; int inputCount = qDBusParametersForMethod(mm, types, errorMsg); if (inputCount == -1) { @@ -398,7 +397,7 @@ int main(int argc, char **argv) args.append(QString::fromLocal8Bit(argv[n])); parseCmdLine(args); - QVector<ClassDef> classes; + QList<ClassDef> classes; for (int i = 0; i < args.count(); ++i) { const QString arg = args.at(i); diff --git a/src/tools/qlalr/compress.cpp b/src/tools/qlalr/compress.cpp index 0ededbd920..eb4ccdc783 100644 --- a/src/tools/qlalr/compress.cpp +++ b/src/tools/qlalr/compress.cpp @@ -53,17 +53,15 @@ struct _PerfectMatch struct _GenerateCheck { - QVector<int>::const_iterator iterator; - int initial; + QList<int>::const_iterator iterator; + int initial; - _GenerateCheck (QVector<int>::const_iterator it, int i): - iterator (it), - initial (i) {} + _GenerateCheck(QList<int>::const_iterator it, int i) : iterator(it), initial(i) { } - inline int operator () () - { - int check = initial++; - return *iterator++ ? check : -1; + inline int operator()() + { + int check = initial++; + return *iterator++ ? check : -1; } }; @@ -151,7 +149,7 @@ void Compress::operator () (int *table, int row_count, int column_count) info.clear (); check.clear (); - QVector<UncompressedRow> sortedTable (row_count); + QList<UncompressedRow> sortedTable(row_count); for (int i = 0; i < row_count; ++i) { @@ -181,14 +179,15 @@ void Compress::operator () (int *table, int row_count, int column_count) for (const UncompressedRow &row : qAsConst(sortedTable)) { int first_token = std::distance (row.begin (), row.beginNonZeros ()); - QVector<int>::iterator pos = info.begin (); + QList<int>::iterator pos = info.begin(); while (pos != info.end ()) { if (pos == info.begin ()) { // try to find a perfect match - QVector<int>::iterator pm = std::search (pos, info.end (), row.beginNonZeros (), row.endNonZeros (), _PerfectMatch ()); + QList<int>::iterator pm = std::search(pos, info.end(), row.beginNonZeros(), + row.endNonZeros(), _PerfectMatch()); if (pm != info.end ()) { diff --git a/src/tools/qlalr/compress.h b/src/tools/qlalr/compress.h index 09a1c0cd64..e61ba32440 100644 --- a/src/tools/qlalr/compress.h +++ b/src/tools/qlalr/compress.h @@ -39,9 +39,9 @@ public: void operator () (int *table, int row_count, int column_count); public: - QVector<int> index; - QVector<int> info; - QVector<int> check; + QList<int> index; + QList<int> info; + QList<int> check; }; #endif // COMPRESS_H diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index 95f70dc988..cff97b132a 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -51,7 +51,7 @@ void generateSeparator(int i, QTextStream &out) } } -void generateList(const QVector<int> &list, QTextStream &out) +void generateList(const QList<int> &list, QTextStream &out) { for (int i = 0; i < list.size(); ++i) { generateSeparator(i, out); diff --git a/src/tools/qlalr/cppgenerator.h b/src/tools/qlalr/cppgenerator.h index 4b09460774..a83ec101fd 100644 --- a/src/tools/qlalr/cppgenerator.h +++ b/src/tools/qlalr/cppgenerator.h @@ -78,8 +78,8 @@ private: bool copyright; Compress compressed_action; Compress compressed_goto; - QVector<int> count; - QVector<int> defgoto; + QList<int> count; + QList<int> defgoto; }; #endif // CPPGENERATOR_H diff --git a/src/tools/qlalr/lalr.g b/src/tools/qlalr/lalr.g index a849800dd5..3c1d1d3ebd 100644 --- a/src/tools/qlalr/lalr.g +++ b/src/tools/qlalr/lalr.g @@ -139,7 +139,7 @@ protected: // recognizer int tos; int stack_size; - QVector<QString> sym_stack; + QList<QString> sym_stack; int *state_stack; QString _M_contents; diff --git a/src/tools/qlalr/recognizer.h b/src/tools/qlalr/recognizer.h index ac05d9f33f..001de3bcf1 100644 --- a/src/tools/qlalr/recognizer.h +++ b/src/tools/qlalr/recognizer.h @@ -76,7 +76,7 @@ protected: // recognizer int tos; int stack_size; - QVector<QString> sym_stack; + QList<QString> sym_stack; int *state_stack; QString _M_contents; diff --git a/src/tools/qvkgen/qvkgen.cpp b/src/tools/qvkgen/qvkgen.cpp index 4db3f26161..74137c8a63 100644 --- a/src/tools/qvkgen/qvkgen.cpp +++ b/src/tools/qvkgen/qvkgen.cpp @@ -45,11 +45,11 @@ public: struct Command { TypedName cmd; - QVector<TypedName> args; + QList<TypedName> args; bool deviceLevel; }; - QVector<Command> commands() const { return m_commands; } + QList<Command> commands() const { return m_commands; } void setFileName(const QString &fn) { m_fn = fn; } @@ -62,7 +62,7 @@ private: QFile m_file; QXmlStreamReader m_reader; - QVector<Command> m_commands; + QList<Command> m_commands; QString m_fn; }; @@ -262,7 +262,8 @@ QByteArray Preamble::get(const QString &fn) return m_str; } -bool genVulkanFunctionsH(const QVector<VkSpecParser::Command> &commands, const QString &licHeaderFn, const QString &outputBase) +bool genVulkanFunctionsH(const QList<VkSpecParser::Command> &commands, const QString &licHeaderFn, + const QString &outputBase) { QFile f(outputBase + QStringLiteral(".h")); if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -342,7 +343,8 @@ bool genVulkanFunctionsH(const QVector<VkSpecParser::Command> &commands, const Q return true; } -bool genVulkanFunctionsPH(const QVector<VkSpecParser::Command> &commands, const QString &licHeaderFn, const QString &outputBase) +bool genVulkanFunctionsPH(const QList<VkSpecParser::Command> &commands, const QString &licHeaderFn, + const QString &outputBase) { QFile f(outputBase + QStringLiteral("_p.h")); if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -401,7 +403,8 @@ bool genVulkanFunctionsPH(const QVector<VkSpecParser::Command> &commands, const return true; } -bool genVulkanFunctionsPC(const QVector<VkSpecParser::Command> &commands, const QString &licHeaderFn, const QString &outputBase) +bool genVulkanFunctionsPC(const QList<VkSpecParser::Command> &commands, const QString &licHeaderFn, + const QString &outputBase) { QFile f(outputBase + QStringLiteral("_p.cpp")); if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -499,7 +502,7 @@ int main(int argc, char **argv) if (!parser.parse()) return 1; - QVector<VkSpecParser::Command> commands = parser.commands(); + QList<VkSpecParser::Command> commands = parser.commands(); QStringList ignoredFuncs { QStringLiteral("vkCreateInstance"), QStringLiteral("vkDestroyInstance"), diff --git a/src/tools/tracegen/helpers.cpp b/src/tools/tracegen/helpers.cpp index a5526065d6..8ffc088fed 100644 --- a/src/tools/tracegen/helpers.cpp +++ b/src/tools/tracegen/helpers.cpp @@ -52,8 +52,8 @@ QString includeGuard(const QString &filename) return guard; } -template <typename T> -static QString joinArguments(const QVector<Tracepoint::Argument> &args, T joinFunction) +template<typename T> +static QString joinArguments(const QList<Tracepoint::Argument> &args, T joinFunction) { QString ret; bool first = true; @@ -70,14 +70,14 @@ static QString joinArguments(const QVector<Tracepoint::Argument> &args, T joinFu return ret; } -QString formatFunctionSignature(const QVector<Tracepoint::Argument> &args) +QString formatFunctionSignature(const QList<Tracepoint::Argument> &args) { return joinArguments(args, [](const Tracepoint::Argument &arg) { return QStringLiteral("%1 %2").arg(arg.type).arg(arg.name); }); } -QString formatParameterList(const QVector<Tracepoint::Argument> &args, ParamType type) +QString formatParameterList(const QList<Tracepoint::Argument> &args, ParamType type) { if (type == LTTNG) { QString ret; diff --git a/src/tools/tracegen/helpers.h b/src/tools/tracegen/helpers.h index 77f16a0da6..d55a956834 100644 --- a/src/tools/tracegen/helpers.h +++ b/src/tools/tracegen/helpers.h @@ -51,7 +51,7 @@ enum ParamType { }; QString includeGuard(const QString &filename); -QString formatFunctionSignature(const QVector<Tracepoint::Argument> &args); -QString formatParameterList(const QVector<Tracepoint::Argument> &args, ParamType type); +QString formatFunctionSignature(const QList<Tracepoint::Argument> &args); +QString formatParameterList(const QList<Tracepoint::Argument> &args, ParamType type); #endif // HELPERS_H diff --git a/src/tools/tracegen/provider.h b/src/tools/tracegen/provider.h index a4baf56815..b9ebc2ec5a 100644 --- a/src/tools/tracegen/provider.h +++ b/src/tools/tracegen/provider.h @@ -79,14 +79,14 @@ struct Tracepoint }; QString name; - QVector<Argument> args; - QVector<Field> fields; + QList<Argument> args; + QList<Field> fields; }; struct Provider { QString name; - QVector<Tracepoint> tracepoints; + QList<Tracepoint> tracepoints; QStringList prefixText; }; |