optimize: use constData() if possible
This commit is contained in:
parent
43e795e791
commit
f4d3ebc9bc
|
@ -148,7 +148,7 @@ int Compiler::getLineNumberFromOutputLine(QString &line)
|
||||||
pos = line.indexOf(',');
|
pos = line.indexOf(',');
|
||||||
}
|
}
|
||||||
if (pos>=0) {
|
if (pos>=0) {
|
||||||
result = QStringView(line.data(), pos).toInt();
|
result = QStringView(line.constData(), pos).toInt();
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
line.remove(0,pos+1);
|
line.remove(0,pos+1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -168,7 +168,7 @@ int Compiler::getColunmnFromOutputLine(QString &line)
|
||||||
pos = line.indexOf(',');
|
pos = line.indexOf(',');
|
||||||
}
|
}
|
||||||
if (pos>=0) {
|
if (pos>=0) {
|
||||||
result = QStringView(line.data(), pos).toInt();
|
result = QStringView(line.constData(), pos).toInt();
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
line.remove(0,pos+1);
|
line.remove(0,pos+1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1037,7 +1037,7 @@ QStringList CppPreprocessor::removeComments(const QStringList &text)
|
||||||
currentType=ContentType::Other;
|
currentType=ContentType::Other;
|
||||||
break;
|
break;
|
||||||
case ContentType::RawString:
|
case ContentType::RawString:
|
||||||
if (QStringView(line.data(), pos).endsWith(')'+delimiter))
|
if (QStringView(line.constData(), pos).endsWith(')'+delimiter))
|
||||||
currentType = ContentType::Other;
|
currentType = ContentType::Other;
|
||||||
break;
|
break;
|
||||||
case ContentType::Other:
|
case ContentType::Other:
|
||||||
|
|
|
@ -49,7 +49,8 @@ void CppTokenizer::tokenize(const QStringList &buffer)
|
||||||
mBufferStr+='\n';
|
mBufferStr+='\n';
|
||||||
mBufferStr+=mBuffer[i];
|
mBufferStr+=mBuffer[i];
|
||||||
}
|
}
|
||||||
mStart = mBufferStr.data();
|
mBufferStr.append(QChar(0));
|
||||||
|
mStart = mBufferStr.constData();
|
||||||
mCurrent = mStart;
|
mCurrent = mStart;
|
||||||
mLineCount = mStart;
|
mLineCount = mStart;
|
||||||
QString s = "";
|
QString s = "";
|
||||||
|
@ -271,7 +272,7 @@ QString CppTokenizer::getNextToken(TokenType *pTokenType)
|
||||||
if (*(mCurrent+1)!='[') {
|
if (*(mCurrent+1)!='[') {
|
||||||
*pTokenType=TokenType::LambdaCaptures;
|
*pTokenType=TokenType::LambdaCaptures;
|
||||||
countLines();
|
countLines();
|
||||||
QChar* backup=mCurrent;
|
const QChar* backup=mCurrent;
|
||||||
skipPair('[',']');
|
skipPair('[',']');
|
||||||
result = QString(backup,mCurrent-backup);
|
result = QString(backup,mCurrent-backup);
|
||||||
done = true;
|
done = true;
|
||||||
|
@ -399,7 +400,7 @@ QString CppTokenizer::getNextToken(TokenType *pTokenType)
|
||||||
|
|
||||||
QString CppTokenizer::getNumber()
|
QString CppTokenizer::getNumber()
|
||||||
{
|
{
|
||||||
QChar* offset = mCurrent;
|
const QChar* offset = mCurrent;
|
||||||
|
|
||||||
if (isDigitChar(*mCurrent)) {
|
if (isDigitChar(*mCurrent)) {
|
||||||
while (isDigitChar(*mCurrent) || isHexChar(*mCurrent)) {
|
while (isDigitChar(*mCurrent) || isHexChar(*mCurrent)) {
|
||||||
|
@ -424,7 +425,7 @@ QString CppTokenizer::getNumber()
|
||||||
|
|
||||||
QString CppTokenizer::getPreprocessor()
|
QString CppTokenizer::getPreprocessor()
|
||||||
{
|
{
|
||||||
QChar *offset = mCurrent;
|
const QChar *offset = mCurrent;
|
||||||
skipToEOL();
|
skipToEOL();
|
||||||
return QString(offset, mCurrent-offset);
|
return QString(offset, mCurrent-offset);
|
||||||
}
|
}
|
||||||
|
@ -436,7 +437,7 @@ QString CppTokenizer::getWord()
|
||||||
skipToNextToken();
|
skipToNextToken();
|
||||||
|
|
||||||
// Get next word...
|
// Get next word...
|
||||||
QChar* offset = mCurrent;
|
const QChar* offset = mCurrent;
|
||||||
|
|
||||||
mCurrent++;
|
mCurrent++;
|
||||||
// Copy the word ahead of us
|
// Copy the word ahead of us
|
||||||
|
@ -474,7 +475,7 @@ QString CppTokenizer::getWord()
|
||||||
if (currentWord!="operator") {
|
if (currentWord!="operator") {
|
||||||
// Skip template contents, but keep template variable types
|
// Skip template contents, but keep template variable types
|
||||||
if (*mCurrent == '<') {
|
if (*mCurrent == '<') {
|
||||||
offset = mCurrent;
|
const QChar* offset = mCurrent;
|
||||||
|
|
||||||
if (bFoundTemplate) {
|
if (bFoundTemplate) {
|
||||||
skipTemplateArgs();
|
skipTemplateArgs();
|
||||||
|
@ -486,7 +487,7 @@ QString CppTokenizer::getWord()
|
||||||
if (*(mCurrent+1)!='[') {
|
if (*(mCurrent+1)!='[') {
|
||||||
// Append array stuff
|
// Append array stuff
|
||||||
while(true) {
|
while(true) {
|
||||||
offset = mCurrent;
|
const QChar* offset = mCurrent;
|
||||||
skipPair('[', ']');
|
skipPair('[', ']');
|
||||||
result += QString(offset,mCurrent-offset);
|
result += QString(offset,mCurrent-offset);
|
||||||
simplifyArgs(result);
|
simplifyArgs(result);
|
||||||
|
@ -647,7 +648,7 @@ void CppTokenizer::skipPair(const QChar &cStart, const QChar cEnd)
|
||||||
|
|
||||||
bool CppTokenizer::skipAngleBracketPair()
|
bool CppTokenizer::skipAngleBracketPair()
|
||||||
{
|
{
|
||||||
QChar* backup=mCurrent;
|
const QChar* backup=mCurrent;
|
||||||
QVector<QChar> stack;
|
QVector<QChar> stack;
|
||||||
while (*mCurrent != '\0') {
|
while (*mCurrent != '\0') {
|
||||||
switch((*mCurrent).unicode()) {
|
switch((*mCurrent).unicode()) {
|
||||||
|
@ -732,7 +733,7 @@ void CppTokenizer::skipRawString()
|
||||||
case ')':
|
case ')':
|
||||||
if (noEscape) {
|
if (noEscape) {
|
||||||
bool ok=true;
|
bool ok=true;
|
||||||
QChar* pChar=mCurrent+1;
|
const QChar* pChar=mCurrent+1;
|
||||||
for (int i=0;i<dCharSeq.length();i++) {
|
for (int i=0;i<dCharSeq.length();i++) {
|
||||||
if (*pChar!=dCharSeq[i]) {
|
if (*pChar!=dCharSeq[i]) {
|
||||||
ok=false;
|
ok=false;
|
||||||
|
@ -787,7 +788,7 @@ void CppTokenizer::skipTemplateArgs()
|
||||||
|
|
||||||
if (skipAngleBracketPair())
|
if (skipAngleBracketPair())
|
||||||
return;
|
return;
|
||||||
QChar* lastBracketPos = mCurrent;
|
const QChar* lastBracketPos = mCurrent;
|
||||||
bool shouldExit=false;
|
bool shouldExit=false;
|
||||||
while (true) {
|
while (true) {
|
||||||
switch(mCurrent->unicode()) {
|
switch(mCurrent->unicode()) {
|
||||||
|
|
|
@ -146,9 +146,9 @@ private:
|
||||||
private:
|
private:
|
||||||
QStringList mBuffer;
|
QStringList mBuffer;
|
||||||
QString mBufferStr;
|
QString mBufferStr;
|
||||||
QChar* mStart;
|
const QChar* mStart;
|
||||||
QChar* mCurrent;
|
const QChar* mCurrent;
|
||||||
QChar* mLineCount;
|
const QChar* mLineCount;
|
||||||
int mCurrentLine;
|
int mCurrentLine;
|
||||||
QString mLastToken;
|
QString mLastToken;
|
||||||
TokenList mTokenList;
|
TokenList mTokenList;
|
||||||
|
|
|
@ -88,8 +88,9 @@ void EnvironmentAppearanceWidget::doSave()
|
||||||
pMainWindow->applySettings();
|
pMainWindow->applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnvironmentAppearanceWidget::updateIcons(const QSize &size)
|
void EnvironmentAppearanceWidget::updateIcons(const QSize & size)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(size);
|
||||||
pIconsManager->setIcon(ui->btnCustomize, IconsManager::ACTION_EDIT_COPY);
|
pIconsManager->setIcon(ui->btnCustomize, IconsManager::ACTION_EDIT_COPY);
|
||||||
pIconsManager->setIcon(ui->btnOpenCustomThemeFolder, IconsManager::ACTION_MISC_FOLDER);
|
pIconsManager->setIcon(ui->btnOpenCustomThemeFolder, IconsManager::ACTION_MISC_FOLDER);
|
||||||
pIconsManager->setIcon(ui->btnRemoveCustomTheme, IconsManager::ACTION_MISC_REMOVE);
|
pIconsManager->setIcon(ui->btnRemoveCustomTheme, IconsManager::ACTION_MISC_REMOVE);
|
||||||
|
|
Loading…
Reference in New Issue