summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodeformatter.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-12-13 18:41:15 +0100
committerNikolai Kosjar <nikolai.kosjar@digia.com>2014-05-15 15:55:38 +0200
commit126e69137a7b3cfdf86832c2561f1dde311e9ad6 (patch)
treea884d65be6c50dfbd876091c295bfd0245f8f30d /src/plugins/cpptools/cppcodeformatter.cpp
parentba76baa65fa9ad4d1f3154639be385c7b49dc1dd (diff)
downloadqt-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/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index 9ee2fa8815..4d98a0c1c2 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -1012,7 +1012,7 @@ int CodeFormatter::column(int index) const
QStringRef CodeFormatter::currentTokenText() const
{
- return m_currentLine.midRef(m_currentToken.begin(), m_currentToken.length());
+ return m_currentLine.midRef(m_currentToken.bytesBegin(), m_currentToken.bytes());
}
void CodeFormatter::turnInto(int newState)
@@ -1189,10 +1189,10 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
const Token &tk = currentToken();
const bool firstToken = (tokenIndex() == 0);
const bool lastToken = (tokenIndex() == tokenCount() - 1);
- const int tokenPosition = column(tk.begin());
- const int nextTokenPosition = lastToken ? tokenPosition + tk.length()
- : column(tokenAt(tokenIndex() + 1).begin());
- const int spaceOrNextTokenPosition = lastToken ? tokenPosition + tk.length() + 1
+ const int tokenPosition = column(tk.bytesBegin());
+ const int nextTokenPosition = lastToken ? tokenPosition + tk.bytes()
+ : column(tokenAt(tokenIndex() + 1).bytesBegin());
+ const int spaceOrNextTokenPosition = lastToken ? tokenPosition + tk.bytes() + 1
: nextTokenPosition;
if (shouldClearPaddingOnEnter(newState))
@@ -1474,7 +1474,7 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i
if (topState.type == multiline_comment_start
|| topState.type == multiline_comment_cont) {
if (!tokens.isEmpty()) {
- *indentDepth = column(tokens.at(0).begin());
+ *indentDepth = column(tokens.at(0).bytesBegin());
return;
}
}