diff options
Diffstat (limited to 'src/libs/cplusplus')
-rw-r--r-- | src/libs/cplusplus/BackwardsScanner.cpp | 4 | ||||
-rw-r--r-- | src/libs/cplusplus/BackwardsScanner.h | 2 | ||||
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.cpp | 10 | ||||
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.h | 9 |
4 files changed, 13 insertions, 12 deletions
diff --git a/src/libs/cplusplus/BackwardsScanner.cpp b/src/libs/cplusplus/BackwardsScanner.cpp index ddf1e4c598..67807ff1d2 100644 --- a/src/libs/cplusplus/BackwardsScanner.cpp +++ b/src/libs/cplusplus/BackwardsScanner.cpp @@ -59,7 +59,7 @@ BackwardsScanner::BackwardsScanner(const QTextCursor &cursor, if (! suffix.isEmpty()) _text += suffix; - _tokens.append(_tokenize(_text, previousBlockState(_block))); + _tokens += _tokenize(_text, previousBlockState(_block)); _startToken = _tokens.size(); } @@ -85,7 +85,7 @@ const Token &BackwardsScanner::fetchToken(int tokenIndex) _text.prepend(QLatin1Char('\n')); _text.prepend(blockText); - QList<Token> adaptedTokens; + Tokens adaptedTokens; for (int i = 0; i < _tokens.size(); ++i) { Token t = _tokens.at(i); t.utf16charOffset += blockText.length() + 1; diff --git a/src/libs/cplusplus/BackwardsScanner.h b/src/libs/cplusplus/BackwardsScanner.h index 9ddc26d3ed..38c5e19e20 100644 --- a/src/libs/cplusplus/BackwardsScanner.h +++ b/src/libs/cplusplus/BackwardsScanner.h @@ -77,7 +77,7 @@ private: const Token &fetchToken(int tokenIndex); private: - QList<Token> _tokens; + Tokens _tokens; int _offset; int _blocksTokenized; QTextBlock _block; diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index cec749eba0..db76bb4c09 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -62,9 +62,9 @@ bool SimpleLexer::endedJoined() const return _endedJoined; } -QList<Token> SimpleLexer::operator()(const QString &text, int state) +Tokens SimpleLexer::operator()(const QString &text, int state) { - QList<Token> tokens; + Tokens tokens; const QByteArray bytes = text.toUtf8(); const char *firstChar = bytes.constData(); @@ -113,7 +113,7 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state) return tokens; } -int SimpleLexer::tokenAt(const QList<Token> &tokens, unsigned utf16charsOffset) +int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset) { for (int index = tokens.size() - 1; index >= 0; --index) { const Token &tk = tokens.at(index); @@ -138,12 +138,12 @@ Token SimpleLexer::tokenAt(const QString &text, features.cxx11Enabled = qtMocRunEnabled; SimpleLexer tokenize; tokenize.setLanguageFeatures(features); - const QList<Token> tokens = tokenize(text, state); + const QVector<Token> tokens = tokenize(text, state); const int tokenIdx = tokenAt(tokens, utf16charsOffset); return (tokenIdx == -1) ? Token() : tokens.at(tokenIdx); } -int SimpleLexer::tokenBefore(const QList<Token> &tokens, unsigned utf16charsOffset) +int SimpleLexer::tokenBefore(const Tokens &tokens, unsigned utf16charsOffset) { for (int index = tokens.size() - 1; index >= 0; --index) { const Token &tk = tokens.at(index); diff --git a/src/libs/cplusplus/SimpleLexer.h b/src/libs/cplusplus/SimpleLexer.h index 8692e7975e..d4cba997e0 100644 --- a/src/libs/cplusplus/SimpleLexer.h +++ b/src/libs/cplusplus/SimpleLexer.h @@ -34,12 +34,13 @@ #include <cplusplus/Token.h> #include <QString> -#include <QList> +#include <QVector> namespace CPlusPlus { class SimpleLexer; class Token; +typedef QVector<Token> Tokens; class CPLUSPLUS_EXPORT SimpleLexer { @@ -55,18 +56,18 @@ public: bool endedJoined() const; - QList<Token> operator()(const QString &text, int state = 0); + Tokens operator()(const QString &text, int state = 0); int state() const { return _lastState; } - static int tokenAt(const QList<Token> &tokens, unsigned utf16charsOffset); + static int tokenAt(const Tokens &tokens, unsigned utf16charsOffset); static Token tokenAt(const QString &text, unsigned utf16charsOffset, int state, bool qtMocRunEnabled = false); - static int tokenBefore(const QList<Token> &tokens, unsigned utf16charsOffset); + static int tokenBefore(const Tokens &tokens, unsigned utf16charsOffset); private: int _lastState; |