diff options
-rw-r--r-- | typesystem.cpp | 16 | ||||
-rw-r--r-- | typesystem.h | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/typesystem.cpp b/typesystem.cpp index b407f2e0b..3c09524a3 100644 --- a/typesystem.cpp +++ b/typesystem.cpp @@ -2001,6 +2001,22 @@ QString ContainerTypeEntry::typeName() const } } +static bool strLess(const char* a, const char* b) +{ + return ::strcmp(a, b) < 0; +} + +bool TypeEntry::isCppPrimitive() const +{ + if (m_name.contains(' ')) + return true; + // Keep this sorted!! + static const char* cppTypes[] = { "bool", "char", "double", "float", "int", "long", "short", "wchar_t"}; + const int N = sizeof(cppTypes)/sizeof(char*); + + const char** res = qBinaryFind(&cppTypes[0], &cppTypes[N], m_name.toAscii().constData(), strLess); + return res != &cppTypes[N]; +} /* static void injectCode(ComplexTypeEntry *e, diff --git a/typesystem.h b/typesystem.h index 62d041892..6961cbda5 100644 --- a/typesystem.h +++ b/typesystem.h @@ -952,7 +952,7 @@ public: return m_conversionRule.startsWith(TARGET_CONVERSION_RULE_FLAG); } - + bool isCppPrimitive() const; private: QString m_name; Type m_type; |