summaryrefslogtreecommitdiffstats
path: root/generator/headergenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-12-22 14:58:37 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-12-23 11:03:04 -0300
commit1f28cdd2994f9a60e05ce887ad5568e3a9c648e9 (patch)
tree5ed35322e068795a932e6e4e7c26501434a91902 /generator/headergenerator.cpp
parentec2ca67a1b93b5890dacaa3683c0a6079906bd5b (diff)
downloadshiboken-1f28cdd2994f9a60e05ce887ad5568e3a9c648e9.tar.gz
shiboken-1f28cdd2994f9a60e05ce887ad5568e3a9c648e9.tar.xz
shiboken-1f28cdd2994f9a60e05ce887ad5568e3a9c648e9.zip
Added support for promoting enums from removed namespaces to upper scope.
Classes in namespaces marked not to be generated are always moved to upper scopes, the current modification add this same behaviour to enums. Tests were also added. Reviewed by Lauro Moura <lauro.neto@openbossa.org> Reviewed by Renato Ara├║jo <renato.filho@openbossa.org>
Diffstat (limited to 'generator/headergenerator.cpp')
-rw-r--r--generator/headergenerator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/generator/headergenerator.cpp b/generator/headergenerator.cpp
index 7a49a8c4..9a28cdb9 100644
--- a/generator/headergenerator.cpp
+++ b/generator/headergenerator.cpp
@@ -311,9 +311,12 @@ void HeaderGenerator::finishGeneration()
macrosStream << "// Type indices" << endl;
int idx = 0;
- foreach (const AbstractMetaClass* metaClass, classes())
+ AbstractMetaEnumList globalEnums = this->globalEnums();
+ foreach (const AbstractMetaClass* metaClass, classes()) {
writeTypeIndexDefine(macrosStream, metaClass, idx);
- foreach (const AbstractMetaEnum* metaEnum, globalEnums())
+ lookForEnumsInClassesNotToBeGenerated(globalEnums, metaClass);
+ }
+ foreach (const AbstractMetaEnum* metaEnum, globalEnums)
writeTypeIndexDefineLine(macrosStream, metaEnum->typeEntry(), idx);
macrosStream << "#define ";
macrosStream.setFieldWidth(60);
@@ -324,7 +327,7 @@ void HeaderGenerator::finishGeneration()
macrosStream << "extern PyTypeObject** " << cppApiVariableName() << ';' << endl << endl;
macrosStream << "// Macros for type check" << endl;
- foreach (const AbstractMetaEnum* cppEnum, globalEnums()) {
+ foreach (const AbstractMetaEnum* cppEnum, globalEnums) {
if (cppEnum->isAnonymous() || cppEnum->isPrivate())
continue;
includes << cppEnum->typeEntry()->include();