aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/SimpleLexer.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <[email protected]>2013-12-12 21:37:46 +0100
committerNikolai Kosjar <[email protected]>2014-05-23 14:23:51 +0200
commit41aa2cb3bdd247898b32941270838ec6348cd755 (patch)
tree36650fa82d6868a6e96e65d2a5501ad87320f306 /src/libs/cplusplus/SimpleLexer.cpp
parent57ff992961fcf8d0ff479a7038c2e517b5bc31a1 (diff)
C++: Use Token::utf16chars{Begin,End} where appropriate
...especially in CppTools/CppEditor where the offsets are used with a QString/QTextDocument. Change-Id: Ic6d18fbc01fb9cc899a9bd2d7424cd2edae487f1 Reviewed-by: Erik Verbruggen <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/SimpleLexer.cpp')
-rw-r--r--src/libs/cplusplus/SimpleLexer.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp
index 7ce50a06c31..9e98f0aecd5 100644
--- a/src/libs/cplusplus/SimpleLexer.cpp
+++ b/src/libs/cplusplus/SimpleLexer.cpp
@@ -112,11 +112,11 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state)
return tokens;
}
-int SimpleLexer::tokenAt(const QList<Token> &tokens, unsigned offset)
+int SimpleLexer::tokenAt(const QList<Token> &tokens, unsigned utf16charsOffset)
{
for (int index = tokens.size() - 1; index >= 0; --index) {
const Token &tk = tokens.at(index);
- if (tk.bytesBegin() <= offset && tk.bytesEnd() >= offset)
+ if (tk.utf16charsBegin() <= utf16charsOffset && tk.utf16charsEnd() >= utf16charsOffset)
return index;
}
@@ -124,7 +124,7 @@ int SimpleLexer::tokenAt(const QList<Token> &tokens, unsigned offset)
}
Token SimpleLexer::tokenAt(const QString &text,
- unsigned offset,
+ unsigned utf16charsOffset,
int state,
bool qtMocRunEnabled)
{
@@ -138,15 +138,15 @@ Token SimpleLexer::tokenAt(const QString &text,
SimpleLexer tokenize;
tokenize.setLanguageFeatures(features);
const QList<Token> tokens = tokenize(text, state);
- const int tokenIdx = tokenAt(tokens, offset);
+ const int tokenIdx = tokenAt(tokens, utf16charsOffset);
return (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
}
-int SimpleLexer::tokenBefore(const QList<Token> &tokens, unsigned offset)
+int SimpleLexer::tokenBefore(const QList<Token> &tokens, unsigned utf16charsOffset)
{
for (int index = tokens.size() - 1; index >= 0; --index) {
const Token &tk = tokens.at(index);
- if (tk.bytesBegin() <= offset)
+ if (tk.utf16charsBegin() <= utf16charsOffset)
return index;
}