aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-04-28 15:07:51 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:01 -0300
commitc615b9c1db720d97034263081ad83f80496404a7 (patch)
treecc519df93fab2170b5decaf311a44494fe70bc00 /abstractmetabuilder.cpp
parent3026fe34cabf67394c7d45becccf30e8fd9e0a2e (diff)
Add EnumValueTypeEntry.
Enum values are in global namespace, so sometimes you need to get them from TypeDatabase, a use case for this is a template class where the template parameter is a enum value.
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index d6b348ae..0f3e5461 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -909,6 +909,19 @@ AbstractMetaEnum *AbstractMetaBuilder::traverseEnum(EnumModelItem enumItem, Abst
metaEnum->setOriginalAttributes(metaEnum->attributes());
+ // Register all enum values on Type database
+ TypeDatabase* typeDb = TypeDatabase::instance();
+ foreach(EnumeratorModelItem e, enumItem->enumerators()) {
+ QString name;
+ if (enclosing) {
+ name += enclosing->name();
+ name += "::";
+ }
+ name += e->name();
+ EnumValueTypeEntry* enumValue = new EnumValueTypeEntry(name, e->value(), static_cast<EnumTypeEntry*>(typeEntry));
+ typeDb->addType(enumValue);
+ }
+
return metaEnum;
}