diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-11-23 12:23:52 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-11-23 13:30:22 -0200 |
commit | 47b1d999f30183c3acff3cfb5084fd21c2875e6c (patch) | |
tree | 9fa9e47418908469cfd27900224bcb8bc83dcd5c | |
parent | a657085b40c2ab1fb45298836a741fe0f0bb0a2c (diff) |
Obey ExcludeConst and ExcludeReference arg in translateType function for QFlags.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r-- | generator.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/generator.cpp b/generator.cpp index 3798eff51..f11eed77f 100644 --- a/generator.cpp +++ b/generator.cpp @@ -288,11 +288,8 @@ QString Generator::translateType(const AbstractMetaType *cType, s = "void"; } else if (cType->isArray()) { s = translateType(cType->arrayElementType(), context, options) + "[]"; - } else if (cType->isEnum() || cType->isFlags()) { - if (options & Generator::EnumAsInts) - s = "int"; - else - s = cType->cppSignature(); + } else if (options & Generator::EnumAsInts && (cType->isEnum() || cType->isFlags())) { + s = "int"; } else { if (options & Generator::OriginalName) { s = cType->originalTypeDescription().trimmed(); @@ -306,8 +303,8 @@ QString Generator::translateType(const AbstractMetaType *cType, if (index >= (s.size() - (constLen + 1))) // (VarType const) or (VarType const[*|&]) s = s.remove(index, constLen); } - } else { - AbstractMetaType *copyType = cType->copy(); + } else if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) { + AbstractMetaType* copyType = cType->copy(); if (options & Generator::ExcludeConst) copyType->setConstant(false); @@ -317,6 +314,8 @@ QString Generator::translateType(const AbstractMetaType *cType, s = copyType->cppSignature(); delete copyType; + } else { + s = cType->cppSignature(); } } |