aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-09-23 17:19:15 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:10 -0300
commiteac6125bac2029389594c8bad0b0fa48cffe1d6b (patch)
tree410eef5116d5523b947ed6864a50a2d35dfb420f /abstractmetabuilder.cpp
parent5633a2dbe3aba94292e1e3d03ccabe8cf25b802a (diff)
Argument types that are arrays with specified sizes are correctly recognized.
The AbstractMetaBuilder::translateType method now tries to figure out properly the size of array argument types specified with enum items instead of literal numbers. Test cases were also added. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Ara├║jo <renato.filho@openbossa.org>
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index d5a2bb131..6b22a6ddf 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -401,6 +401,8 @@ bool AbstractMetaBuilder::build(QIODevice* input)
}
ReportHandler::flush();
+ figureOutEnumValues();
+
foreach (ClassModelItem item, typeValues)
traverseClassMembers(item);
foreach (NamespaceModelItem item, namespaceTypeValues)
@@ -560,7 +562,6 @@ bool AbstractMetaBuilder::build(QIODevice* input)
traverseStreamOperator(item);
}
- figureOutEnumValues();
figureOutDefaultEnumArguments();
checkFunctionModifications();
@@ -1943,8 +1944,25 @@ AbstractMetaType* AbstractMetaBuilder::translateType(const TypeInfo& _typei, boo
bool ok;
int elems = s.toInt(&ok);
- if (!ok)
- return 0;
+ if (!ok) {
+ AbstractMetaEnumValue* enumValue = m_metaClasses.findEnumValue(s);
+ if (!enumValue) {
+ foreach (AbstractMetaEnum* metaEnum, m_globalEnums) {
+ foreach (AbstractMetaEnumValue* ev, metaEnum->values()) {
+ if (ev->name() == s) {
+ enumValue = ev;
+ break;
+ }
+ }
+ if (enumValue)
+ break;
+ }
+ }
+
+ if (!enumValue)
+ return 0;
+ elems = enumValue->value();
+ }
AbstractMetaType* arrayType = createMetaType();
arrayType->setArrayElementCount(elems);