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>
This commit is contained in:
Nikolai Kosjar
2013-12-13 18:41:15 +01:00
parent ba76baa65f
commit 126e69137a
32 changed files with 272 additions and 247 deletions

View File

@@ -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;
}