aboutsummaryrefslogtreecommitdiffstats
path: root/typesystem.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-05-10 16:04:09 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:16 -0300
commit33eb60d19f0884d9c7ecbe26b571c82de2d77b51 (patch)
tree01fa10aa18a496fab3a6a6df4c26ce97c63bbbe2 /typesystem.cpp
parentdf47f8ad80e92952fcdb1f09a794cd15cc17f3ec (diff)
Fix bug 417 - "Support nested naming of flags"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'typesystem.cpp')
-rw-r--r--typesystem.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/typesystem.cpp b/typesystem.cpp
index a3543750b..896374a8b 100644
--- a/typesystem.cpp
+++ b/typesystem.cpp
@@ -422,7 +422,7 @@ bool Handler::startElement(const QString &, const QString &n,
attributes["type"] = QString();
break;
case StackElement::EnumTypeEntry:
- attributes["flags"] = "no";
+ attributes["flags"] = QString();
attributes["upper-bound"] = QString();
attributes["lower-bound"] = QString();
attributes["force-integer"] = "no";
@@ -591,10 +591,19 @@ bool Handler::startElement(const QString &, const QString &n,
m_currentEnum->setExtensible(convertBoolean(attributes["extensible"], "extensible", false));
// put in the flags parallel...
- if (!attributes["flags"].isEmpty() && attributes["flags"].toLower() != "no") {
+ QString flagName = attributes["flags"];
+ if (!flagName.isEmpty()) {
FlagsTypeEntry *ftype = new FlagsTypeEntry("QFlags<" + name + ">", since);
ftype->setOriginator(m_currentEnum);
- ftype->setOriginalName(attributes["flags"]);
+ // Try to get the guess the qualified flag name
+ if (!flagName.contains("::") && names.count() > 1) {
+ QStringList cpy(names);
+ cpy.removeLast();
+ cpy.append(flagName);
+ flagName = cpy.join("::");
+ }
+
+ ftype->setOriginalName(flagName);
ftype->setCodeGeneration(m_generate);
QString n = ftype->originalName();