summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-08-11 14:08:55 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-08-11 14:34:09 -0300
commit16e7b284c2c93a18bc181296f7486baf13ab9f1f (patch)
tree6f1b776c15743afc94598f64f3d258eb854f6f63
parent12358699d6ad2e190645936782bf442193de7f72 (diff)
downloadgeneratorrunner-16e7b284c2c93a18bc181296f7486baf13ab9f1f.tar.gz
generatorrunner-16e7b284c2c93a18bc181296f7486baf13ab9f1f.tar.xz
generatorrunner-16e7b284c2c93a18bc181296f7486baf13ab9f1f.zip
Take care to remove only the first const and ref when translate types.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--generator.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/generator.cpp b/generator.cpp
index 3c0b2ec..0f56b45 100644
--- a/generator.cpp
+++ b/generator.cpp
@@ -294,10 +294,16 @@ QString Generator::translateType(const AbstractMetaType *cType,
s = cType->cppSignature();
} else {
s = cType->cppSignature();
- if (cType->isConstant() && (options & Generator::ExcludeConst))
- s.replace("const", "");
- if (cType->isReference() && (options & Generator::ExcludeReference))
- s.replace("&", "");
+ if (cType->isConstant() && (options & Generator::ExcludeConst)) {
+ // Remove just the first ‘const’, avoiding removal of template attr.
+ int pos = s.indexOf("const");
+ s.remove(pos, 5); //remove strlen(const)
+ }
+ if (cType->isReference() && (options & Generator::ExcludeReference)) {
+ // Remove just the first ‘&’, avoiding removal of template references.
+ int pos = s.indexOf("&");
+ s.remove(pos, 1); //remove strlen(const)
+ }
}
return s;