diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-12-13 18:41:15 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-05-15 15:55:38 +0200 |
commit | 126e69137a7b3cfdf86832c2561f1dde311e9ad6 (patch) | |
tree | a884d65be6c50dfbd876091c295bfd0245f8f30d /src/libs/cplusplus/SimpleLexer.cpp | |
parent | ba76baa65fa9ad4d1f3154639be385c7b49dc1dd (diff) | |
download | qt-creator-126e69137a7b3cfdf86832c2561f1dde311e9ad6.tar.gz |
C++: Clarify units of a Token
This will avoid confusion when later more length and indices methods are
added.
In Token:
length() --> bytes()
begin() --> bytesBegin()
end() --> bytesEnd()
Change-Id: I244c69b022e239ee762b4114559e707f93ff344f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/cplusplus/SimpleLexer.cpp')
-rw-r--r-- | src/libs/cplusplus/SimpleLexer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index 6ab2f4db91..26030ae09f 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -89,7 +89,7 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state) break; } - QStringRef spell = text.midRef(tk.begin(), tk.length()); + QStringRef spell = text.midRef(tk.bytesBegin(), tk.bytes()); lex.setScanAngleStringLiteralTokens(false); if (tk.newline() && tk.is(T_POUND)) @@ -116,7 +116,7 @@ int SimpleLexer::tokenAt(const QList<Token> &tokens, unsigned offset) { for (int index = tokens.size() - 1; index >= 0; --index) { const Token &tk = tokens.at(index); - if (tk.begin() <= offset && tk.end() >= offset) + if (tk.bytesBegin() <= offset && tk.bytesEnd() >= offset) return index; } @@ -144,7 +144,7 @@ int SimpleLexer::tokenBefore(const QList<Token> &tokens, unsigned offset) { for (int index = tokens.size() - 1; index >= 0; --index) { const Token &tk = tokens.at(index); - if (tk.begin() <= offset) + if (tk.bytesBegin() <= offset) return index; } |