diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-05-10 16:04:09 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:16 -0300 |
commit | 33eb60d19f0884d9c7ecbe26b571c82de2d77b51 (patch) | |
tree | 01fa10aa18a496fab3a6a6df4c26ce97c63bbbe2 | |
parent | df47f8ad80e92952fcdb1f09a794cd15cc17f3ec (diff) |
Fix bug 417 - "Support nested naming of flags"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Renato Araújo <renato.filho@openbossa.org>
-rw-r--r-- | typesystem.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/typesystem.cpp b/typesystem.cpp index a354375..896374a 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(); |