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.h | |
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.h')
-rw-r--r-- | src/lib/corelib/language/itemdeclaration.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/corelib/language/itemdeclaration.h b/src/lib/corelib/language/itemdeclaration.h index 960e4ad75..be0017d29 100644 --- a/src/lib/corelib/language/itemdeclaration.h +++ b/src/lib/corelib/language/itemdeclaration.h @@ -31,6 +31,7 @@ #ifndef QBS_ITEMDECLARATION_H #define QBS_ITEMDECLARATION_H +#include "itemtype.h" #include "propertydeclaration.h" #include <QSet> @@ -42,10 +43,10 @@ namespace Internal { class ItemDeclaration { public: - ItemDeclaration(const QString &typeName = QString()); + ItemDeclaration(ItemType type = ItemType::Unknown); ItemDeclaration(const ItemDeclaration &other); - const QString &typeName() const { return m_typeName; } + ItemType type() const { return m_type; } typedef QList<PropertyDeclaration> Properties; void setProperties(const Properties &props) { m_properties = props; } @@ -53,13 +54,13 @@ public: ItemDeclaration &operator<<(const PropertyDeclaration &decl); - typedef QSet<QString> TypeNames; + typedef QSet<ItemType> TypeNames; void setAllowedChildTypes(const TypeNames &typeNames) { m_allowedChildTypes = typeNames; } const TypeNames &allowedChildTypes() const { return m_allowedChildTypes; } - bool isChildTypeAllowed(const QString &typeName) const; + bool isChildTypeAllowed(ItemType type) const; private: - QString m_typeName; + ItemType m_type; Properties m_properties; TypeNames m_allowedChildTypes; }; |