From 85609aff8e3bd09a68d7868ad6cf3158e261d713 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Wed, 3 Nov 2010 11:02:25 +0100 Subject: CppHighlighter: highlight macro references. Change-Id: I7c90957aa67e03a109af0a722160d4e1c759d716 Reviewed-by: Leandro Melo --- src/plugins/cpptools/cpptoolsreuse.cpp | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/plugins/cpptools/cpptoolsreuse.cpp') 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 #include #include +#include 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 -- cgit v1.2.1