summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolsreuse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cpptools/cpptoolsreuse.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolsreuse.cpp45
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