aboutsummaryrefslogtreecommitdiffstats
path: root/typesystem.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-09-20 11:36:45 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:09 -0300
commit5179bca73955373e087d6b51edcabf038c964ac8 (patch)
tree255a4ca87763fb6c203ee31aa91815a6c0d8f548 /typesystem.cpp
parentc182be3e4c89fe81c15722708d8b712598a528b8 (diff)
Anonymous enums now supported.
Diffstat (limited to 'typesystem.cpp')
-rw-r--r--typesystem.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/typesystem.cpp b/typesystem.cpp
index f92ea01dd..1cc9f1927 100644
--- a/typesystem.cpp
+++ b/typesystem.cpp
@@ -372,6 +372,7 @@ bool Handler::startElement(const QString &, const QString &n,
attributes["lower-bound"] = QString();
attributes["force-integer"] = "no";
attributes["extensible"] = "no";
+ attributes["identified-by-value"] = QString();
break;
case StackElement::ObjectTypeEntry:
case StackElement::ValueTypeEntry:
@@ -425,6 +426,15 @@ bool Handler::startElement(const QString &, const QString &n,
ReportHandler::warning(QString("Duplicate type entry: '%1'").arg(name));
}
+ if (element->type == StackElement::EnumTypeEntry) {
+ if (name.isEmpty()) {
+ name = attributes["identified-by-value"];
+ } else if (!attributes["identified-by-value"].isEmpty()) {
+ m_error = "can't specify both 'name' and 'identified-by-value' attributes";
+ return false;
+ }
+ }
+
if (name.isEmpty()) {
m_error = "no 'name' attribute specified";
return false;
@@ -485,6 +495,7 @@ bool Handler::startElement(const QString &, const QString &n,
m_currentEnum =
new EnumTypeEntry(QStringList(names.mid(0, names.size() - 1)).join("::"),
names.last(), since);
+ m_currentEnum->setAnonymous(!attributes["identified-by-value"].isEmpty());
element->entry = m_currentEnum;
m_currentEnum->setCodeGeneration(m_generate);
m_currentEnum->setTargetLangPackage(m_defaultPackage);