Use QList instead of QVector in util

Task-number: QTBUG-84469
Change-Id: I077fb5c32456d438a457c1f73852313ea2ea9ae5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Jarek Kobus 2020-07-07 12:04:21 +02:00
parent c7c28b3406
commit a7f9d5a7fa
10 changed files with 34 additions and 35 deletions

View File

@ -129,7 +129,7 @@ int main(int argc, char **argv)
outFile.write(";\n"); outFile.write(";\n");
file.reset(); file.reset();
QVector<QString> strings(lineCount); QStringList strings(lineCount);
while (!file.atEnd()) { while (!file.atEnd()) {
QString st = QString::fromUtf8(file.readLine()).trimmed(); QString st = QString::fromUtf8(file.readLine()).trimmed();
int num = qt_hash(st) % lineCount; int num = qt_hash(st) % lineCount;

View File

@ -32,12 +32,12 @@
#include <algorithm> #include <algorithm>
#include <QByteArray> #include <QByteArray>
#include <QVector> #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonValue> #include <QJsonValue>
#include <QDebug> #include <QList>
#include <QColor> #include <QColor>
@ -174,7 +174,7 @@ static void printGradientStops(Printer &p, const QJsonArray &presets)
const QJsonArray stops = preset[QLatin1String("stops")].toArray(); const QJsonArray stops = preset[QLatin1String("stops")].toArray();
Q_ASSERT(!stops.isEmpty()); Q_ASSERT(!stops.isEmpty());
QVector<GradientStop> gradientStops; QList<GradientStop> gradientStops;
gradientStops.reserve(stops.size()); gradientStops.reserve(stops.size());
std::transform(stops.cbegin(), std::transform(stops.cbegin(),
stops.cend(), stops.cend(),

View File

@ -28,10 +28,10 @@
#ifndef CONFIGFILE_H #ifndef CONFIGFILE_H
#define CONFIGFILE_H #define CONFIGFILE_H
#include <QStringList>
#include <QMap>
#include <QVector>
#include <QIODevice> #include <QIODevice>
#include <QList>
#include <QMap>
#include <QStringList>
struct ConfigFile struct ConfigFile
{ {
@ -42,7 +42,7 @@ struct ConfigFile
QString key; QString key;
QString value; QString value;
}; };
struct Section : public QVector<Entry> struct Section : public QList<Entry>
{ {
inline bool contains(const QString &key) const inline bool contains(const QString &key) const
{ {

View File

@ -223,9 +223,9 @@ static inline bool adjacentKeys(int left, int right) { return left + 1 == right;
//static inline bool adjacentKeys(const InputType &left, const InputType &right) //static inline bool adjacentKeys(const InputType &left, const InputType &right)
//{ return left.val + 1 == right.val; } //{ return left.val + 1 == right.val; }
static QVector<Generator::TransitionSequence> convertToSequences(const TransitionMap &transitions) static QList<Generator::TransitionSequence> convertToSequences(const TransitionMap &transitions)
{ {
QVector<Generator::TransitionSequence> sequences; QList<Generator::TransitionSequence> sequences;
if (transitions.isEmpty()) if (transitions.isEmpty())
return sequences; return sequences;
@ -272,7 +272,7 @@ void Generator::generateTransitions(CodeBlock &body, const TransitionMap &transi
if (transitions.isEmpty()) if (transitions.isEmpty())
return; return;
QVector<TransitionSequence> sequences = convertToSequences(transitions); QList<TransitionSequence> sequences = convertToSequences(transitions);
bool needsCharFunction = false; bool needsCharFunction = false;
if (!charFunctionRanges.isEmpty()) { if (!charFunctionRanges.isEmpty()) {

View File

@ -161,9 +161,9 @@ private:
QString cname; QString cname;
struct Section struct Section
{ {
QVector<Function> functions; QList<Function> functions;
QStringList variables; QStringList variables;
QVector<Function> constructors; QList<Function> constructors;
inline bool isEmpty() const inline bool isEmpty() const
{ return functions.isEmpty() && variables.isEmpty() && constructors.isEmpty(); } { return functions.isEmpty() && variables.isEmpty() && constructors.isEmpty(); }
@ -202,7 +202,7 @@ public:
QString testFunction; QString testFunction;
}; };
private: private:
QVector<TransitionSequence> charFunctionRanges; QList<TransitionSequence> charFunctionRanges;
}; };
#endif #endif

View File

@ -203,7 +203,7 @@ static DFA generateMachine(const Config &cfg)
return DFA(); return DFA();
} }
QVector<NFA> tokens; QList<NFA> tokens;
foreach (ConfigFile::Entry e, cfg.configSections.value("Tokens")) { foreach (ConfigFile::Entry e, cfg.configSections.value("Tokens")) {
int errCol = 0; int errCol = 0;

View File

@ -430,7 +430,7 @@ void DFA::debug() const
DFA DFA::minimize() const DFA DFA::minimize() const
{ {
QVector<bool> inequivalentStates(count() * count()); QList<bool> inequivalentStates(count() * count());
inequivalentStates.fill(false); inequivalentStates.fill(false);
for (int i = 0; i < count(); ++i) for (int i = 0; i < count(); ++i)

View File

@ -29,13 +29,13 @@
#ifndef NFA_H #ifndef NFA_H
#define NFA_H #define NFA_H
#include <QMap>
#include <QHash>
#include <QString>
#include <QVector>
#include <QDebug>
#include <QStack>
#include <QByteArray> #include <QByteArray>
#include <QDebug>
#include <QHash>
#include <QList>
#include <QMap>
#include <QStack>
#include <QString>
#include "global.h" #include "global.h"
@ -57,7 +57,7 @@ inline QDataStream &operator>>(QDataStream &stream, State &state)
return stream >> state.symbol >> state.transitions; return stream >> state.symbol >> state.transitions;
} }
struct DFA : public QVector<State> struct DFA : public QList<State>
{ {
void debug() const; void debug() const;
DFA minimize() const; DFA minimize() const;
@ -107,7 +107,7 @@ public:
int initialState; int initialState;
int finalState; int finalState;
QVector<State> states; QList<State> states;
}; };
#endif // NFA_H #endif // NFA_H

View File

@ -92,7 +92,7 @@ private:
void tokenize(const QString &input); void tokenize(const QString &input);
QMap<QString, NFA> macros; QMap<QString, NFA> macros;
QVector<Symbol> symbols; QList<Symbol> symbols;
int index; int index;
int errorColumn; int errorColumn;
const QSet<InputType> maxInputSet; const QSet<InputType> maxInputSet;

View File

@ -26,14 +26,13 @@
** **
****************************************************************************/ ****************************************************************************/
#include <qlist.h>
#include <qhash.h>
#include <qfile.h>
#include <qbytearray.h> #include <qbytearray.h>
#include <qstring.h>
#include <qchar.h> #include <qchar.h>
#include <qvector.h>
#include <qdebug.h> #include <qdebug.h>
#include <qfile.h>
#include <qhash.h>
#include <qlist.h>
#include <qstring.h>
#if 0 #if 0
#include <private/qunicodetables_p.h> #include <private/qunicodetables_p.h>
#endif #endif
@ -2310,7 +2309,7 @@ struct UniqueBlock {
{ return values == other.values; } { return values == other.values; }
int index; int index;
QVector<int> values; QList<int> values;
}; };
static QByteArray createPropertyInfo() static QByteArray createPropertyInfo()
@ -2332,7 +2331,7 @@ static QByteArray createPropertyInfo()
const int SMP_SHIFT = 8; const int SMP_SHIFT = 8;
QList<UniqueBlock> uniqueBlocks; QList<UniqueBlock> uniqueBlocks;
QVector<int> blockMap; QList<int> blockMap;
int used = 0; int used = 0;
for (int block = 0; block < BMP_END/BMP_BLOCKSIZE; ++block) { for (int block = 0; block < BMP_END/BMP_BLOCKSIZE; ++block) {
@ -2617,11 +2616,11 @@ static QByteArray createCompositionInfo()
if (SMP_END <= highestComposedCharacter) if (SMP_END <= highestComposedCharacter)
qFatal("end of table smaller than highest composed character 0x%x", highestComposedCharacter); qFatal("end of table smaller than highest composed character 0x%x", highestComposedCharacter);
QVector<unsigned short> decompositions; QList<unsigned short> decompositions;
int tableIndex = 0; int tableIndex = 0;
QList<UniqueBlock> uniqueBlocks; QList<UniqueBlock> uniqueBlocks;
QVector<int> blockMap; QList<int> blockMap;
int used = 0; int used = 0;
for (int block = 0; block < BMP_END/BMP_BLOCKSIZE; ++block) { for (int block = 0; block < BMP_END/BMP_BLOCKSIZE; ++block) {
@ -2832,7 +2831,7 @@ static QByteArray createLigatureInfo()
int tableIndex = 0; int tableIndex = 0;
QList<UniqueBlock> uniqueBlocks; QList<UniqueBlock> uniqueBlocks;
QVector<int> blockMap; QList<int> blockMap;
int used = 0; int used = 0;
for (int block = 0; block < BMP_END/BMP_BLOCKSIZE; ++block) { for (int block = 0; block < BMP_END/BMP_BLOCKSIZE; ++block) {