C++: Extract function quickfix

Task-number: QTCREATORBUG-5485

Change-Id: Ib6aaeaadad4b421480d22399392768d4bad85bda
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Leandro Melo
2011-12-21 18:24:14 +01:00
parent ea04aa9385
commit c25f0585d1
5 changed files with 588 additions and 60 deletions

View File

@@ -102,5 +102,21 @@ bool isOwnershipRAIIType(CPlusPlus::Symbol *symbol, const LookupContext &context
return false;
}
bool isValidIdentifier(const QString &s)
{
const int length = s.length();
for (int i = 0; i < length; ++i) {
const QChar &c = s.at(i);
if (i == 0) {
if (!c.isLetter() && c != QLatin1Char('_'))
return false;
} else {
if (!c.isLetterOrNumber() && c != QLatin1Char('_'))
return false;
}
}
return true;
}
} // CppTools