summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-27 19:45:19 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-10-28 15:12:05 -0200
commit45f10c2264bef5c25e493bb6f70ef6355a7f94d1 (patch)
tree799a43630c1ce008d1bc28ec9084f55cb3eed5a8
parentb146f4117c676a6a65b1e29a09d5f6c86541cd0d (diff)
downloadshiboken-45f10c2264bef5c25e493bb6f70ef6355a7f94d1.tar.gz
shiboken-45f10c2264bef5c25e493bb6f70ef6355a7f94d1.tar.xz
shiboken-45f10c2264bef5c25e493bb6f70ef6355a7f94d1.zip
Write copy constructor for Object types when there is one.
-rw-r--r--generator/headergenerator.cpp11
-rw-r--r--tests/libsample/reference.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/generator/headergenerator.cpp b/generator/headergenerator.cpp
index 39db3c6e..12d246a1 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 cc9fcc91..54360d88 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; }