diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-09-01 11:34:30 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-09-01 11:34:30 -0300 |
commit | cdff56993e173ca59bb7a10f9cf58a192fedfb28 (patch) | |
tree | cba0415ecadb9e2ad1cb9a13aa1492605df950a1 /cppgenerator.h | |
parent | 1eef8c3c7c905675ddeb09e7ada3e98e8b6fa4b5 (diff) |
added the method CppGenerator::writeMinimalConstructorCallArguments
to solve the problem of declaring uninitialized variables for
classes that do not have a zero argument constructor.
Example: the class with only this constructor
NonDefaultCtor(int)
couldn't be instantiated this way
NonDefaultCtor cpp_result;
The added method searches for the minimal signature that uses only
primitive types and helps to write this line instead
NonDefaultCtor cpp_result(0);
Right now the method doesn't deal with the case of a class with
no constructor receiving only parameters, but a recursion could
solve the issue.
Diffstat (limited to 'cppgenerator.h')
-rw-r--r-- | cppgenerator.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cppgenerator.h b/cppgenerator.h index 721c6f4bc..c866cf874 100644 --- a/cppgenerator.h +++ b/cppgenerator.h @@ -50,6 +50,7 @@ private: void writeConstructorWrapper(QTextStream &s, const AbstractMetaFunctionList overloads); void writeDestructorWrapper(QTextStream& s, const AbstractMetaClass* metaClass); + void writeMinimalConstructorCallArguments(QTextStream& s, const AbstractMetaClass* metaClass); void writeMethodWrapper(QTextStream &s, const AbstractMetaFunctionList overloads); void writeArgumentsInitializer(QTextStream& s, PolymorphicData& polymorphicData); |