diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-10-27 19:45:19 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:08:53 -0300 |
commit | 34cce54d695330ebfa047dbbb4c1c0ab60e22c74 (patch) | |
tree | f5cb8a4e53fa1aeb930fe9ce189c144fba506db3 | |
parent | 8a727dddc028c94807b85b9acd8c88dd276fd12a (diff) |
Write copy constructor for Object types when there is one.
-rw-r--r-- | generator/headergenerator.cpp | 11 | ||||
-rw-r--r-- | tests/libsample/reference.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/generator/headergenerator.cpp b/generator/headergenerator.cpp index 39db3c6ed..12d246a13 100644 --- a/generator/headergenerator.cpp +++ b/generator/headergenerator.cpp @@ -91,9 +91,6 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met s << endl << '{' << endl << "public:" << endl; - if (metaClass->typeEntry()->isValue()) - writeCopyCtor(s, metaClass); - bool hasVirtualFunction = false; foreach (AbstractMetaFunction *func, filterFunctions(metaClass)) { if (func->isVirtual()) @@ -142,11 +139,13 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met void HeaderGenerator::writeFunction(QTextStream& s, const AbstractMetaFunction* func) const { + // do not write copy ctors here. - if (func->isCopyConstructor()) + if (!func->isPrivate() && func->isCopyConstructor()) { + writeCopyCtor(s, func->ownerClass()); return; - - if (func->isConstructor() && func->isUserAdded()) + } + if (func->isUserAdded()) return; #ifdef AVOID_PROTECTED_HACK diff --git a/tests/libsample/reference.h b/tests/libsample/reference.h index cc9fcc91e..54360d880 100644 --- a/tests/libsample/reference.h +++ b/tests/libsample/reference.h @@ -60,6 +60,8 @@ private: class LIBSAMPLE_API ObjTypeReference { public: + ObjTypeReference() {} + ObjTypeReference(const ObjTypeReference&) {} virtual ~ObjTypeReference(); virtual ObjTypeReference& returnMyFirstArg(ObjTypeReference& ref) { return ref; } virtual ObjTypeReference& returnMySecondArg(int a, ObjTypeReference& ref) { return ref; } |