diff options
author | George Kiagiadakis <kiagiadakis.george@gmail.com> | 2010-03-31 18:47:04 +0300 |
---|---|---|
committer | George Kiagiadakis <kiagiadakis.george@gmail.com> | 2010-03-31 18:47:04 +0300 |
commit | fae9b7e738ae36e90ac2ade2117fe06ba04616e3 (patch) | |
tree | 4df12f637af22867908e3ea6c58f3748140a3728 /codegen | |
parent | 84d015bd2af4b5400100862d076d3e011056303c (diff) |
Improve enum assertions generation.
Make it possible to use enums that are not part of some class and make use
of the class name in the gst-style output if the enum belongs to a class.
Diffstat (limited to 'codegen')
-rw-r--r-- | codegen/generator.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/codegen/generator.cpp b/codegen/generator.cpp index 3b4a527..6987763 100644 --- a/codegen/generator.cpp +++ b/codegen/generator.cpp @@ -106,13 +106,19 @@ void CodeGen::printEnumAssertions(QTextStream& outStream, const Enum & enumDef) foreach(const QByteArray & value, enumDef.values) { outStream << " BOOST_STATIC_ASSERT(static_cast<int>("; - outStream << enumDef.options["class"] << "::" << value; + if (enumDef.options.contains("class") && !enumDef.options["class"].isEmpty()) { + outStream << enumDef.options["class"] << "::"; + } + outStream << value; outStream << ") == static_cast<int>("; if (enumDef.options.contains("prefix")) { outStream << enumDef.options["prefix"]; } else { - outStream << (enumDef.options["namespace"] == "QGst" ? "GST_TYPE_" : "G_TYPE_"); + outStream << (enumDef.options["namespace"] == "QGst" ? "GST_" : "G_"); + if (enumDef.options.contains("class") && !enumDef.options["class"].isEmpty()) { + outStream << toGstStyle(enumDef.options["class"]) << "_"; + } } if (enumDef.options.contains(value)) { |