diff options
author | Francois Ferrand <thetypz@gmail.com> | 2010-11-03 11:02:25 +0100 |
---|---|---|
committer | Leandro Melo <leandro.melo@nokia.com> | 2012-04-13 02:07:37 +0200 |
commit | 85609aff8e3bd09a68d7868ad6cf3158e261d713 (patch) | |
tree | 9a09fa06d8277f779b3a4471974f34558f632256 /src/plugins/cpptools/cpptoolsreuse.cpp | |
parent | 85ce5aba6211385785476164ab95b37140e5b20d (diff) | |
download | qt-creator-85609aff8e3bd09a68d7868ad6cf3158e261d713.tar.gz |
CppHighlighter: highlight macro references.
Change-Id: I7c90957aa67e03a109af0a722160d4e1c759d716
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cpptoolsreuse.cpp')
-rw-r--r-- | src/plugins/cpptools/cpptoolsreuse.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index 305e84aded..81eb9986d6 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -40,6 +40,7 @@ #include <QSet> #include <QTextDocument> #include <QTextCursor> +#include <QStringRef> using namespace CPlusPlus; @@ -131,5 +132,49 @@ bool isValidIdentifier(const QString &s) return true; } +bool isQtKeyword(const QStringRef &text) +{ + switch (text.length()) { + case 4: + switch (text.at(0).toLatin1()) { + case 'e': + if (text == QLatin1String("emit")) + return true; + break; + case 'S': + if (text == QLatin1String("SLOT")) + return true; + break; + } + break; + + case 5: + if (text.at(0) == QLatin1Char('s') && text == QLatin1String("slots")) + return true; + break; + + case 6: + if (text.at(0) == QLatin1Char('S') && text == QLatin1String("SIGNAL")) + return true; + break; + + case 7: + switch (text.at(0).toLatin1()) { + case 's': + if (text == QLatin1String("signals")) + return true; + break; + case 'f': + if (text == QLatin1String("foreach") || text == QLatin1String("forever")) + return true; + break; + } + break; + + default: + break; + } + return false; +} } // CppTools |