Use QList instead of QVector in other tools
Task-number: QTBUG-84469 Change-Id: I90d0e2e723bb4d205d7bf333b21cdf583fdf4ea0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
5bb3d64682
commit
e114e580e7
@ -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);
|
||||
|
@ -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 ())
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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"),
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user