diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-08-12 15:53:28 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-08-14 13:47:04 +0000 |
commit | e9ea57525002e03389921121806269e1ef004618 (patch) | |
tree | 62ecb7e657dc8934249ccc3332ad5bc1f8619248 /src/lib/corelib/language/itemdeclaration.cpp | |
parent | 4bb536e9aacac02c3157c00fc98c6072105f7401 (diff) |
Give the Item class a proper type attribute.
This replaces both the m_flags member and conceptually also the
m_typeName one. We still keep the latter, but do not change it
anymore when resolving item inheritance; this makes for potentially
somewhat nicer error messages.
As a side effect, project resolving becomes slightly faster, presumably
due to having to do fewer string comparisons.
Change-Id: Ieeea0eca74c4cf744b005730efeccf5ebc44589b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/lib/corelib/language/itemdeclaration.cpp')
-rw-r--r-- | src/lib/corelib/language/itemdeclaration.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/corelib/language/itemdeclaration.cpp b/src/lib/corelib/language/itemdeclaration.cpp index 9cf09e99a..aa6f06b1b 100644 --- a/src/lib/corelib/language/itemdeclaration.cpp +++ b/src/lib/corelib/language/itemdeclaration.cpp @@ -33,13 +33,13 @@ namespace qbs { namespace Internal { -ItemDeclaration::ItemDeclaration(const QString &typeName) - : m_typeName(typeName) +ItemDeclaration::ItemDeclaration(ItemType type) + : m_type(type) { } ItemDeclaration::ItemDeclaration(const qbs::Internal::ItemDeclaration &other) - : m_typeName(other.m_typeName) + : m_type(other.m_type) , m_properties(other.m_properties) , m_allowedChildTypes(other.m_allowedChildTypes) { @@ -51,9 +51,11 @@ ItemDeclaration &ItemDeclaration::operator<<(const PropertyDeclaration &decl) return *this; } -bool ItemDeclaration::isChildTypeAllowed(const QString &typeName) const +bool ItemDeclaration::isChildTypeAllowed(ItemType type) const { - return m_allowedChildTypes.contains(typeName); + if (m_type > ItemType::LastActualItem || type > ItemType::LastActualItem) + return true; + return m_allowedChildTypes.contains(type); } } // namespace Internal |