aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2010-02-04 11:46:22 -0400
committerHugo Lima <hugo.lima@openbossa.org>2010-02-04 18:47:27 -0200
commit8236fa3c1dda5674d4449726d018026b2682a569 (patch)
treec1a3c5c6e8047a4bb9069b14e32fe617c4ac5a6f
parenta761b0b0e439811fb2ce8b9a64b249f50cad02a5 (diff)
Implement ShibokenGenerator::isCopyable based on BoostPythonGenerator
Reviewed by Renato Araújo <renato.filho@openbossa.org>
-rw-r--r--headergenerator.cpp2
-rw-r--r--shibokengenerator.cpp13
-rw-r--r--shibokengenerator.h2
3 files changed, 16 insertions, 1 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index eb2e18083..de2965956 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -79,7 +79,7 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met
s << endl << '{' << endl << "public:" << endl;
- if (metaClass->hasCloneOperator())
+ if (isCopyable(metaClass))
writeCopyCtor(s, metaClass);
foreach (AbstractMetaFunction *func, filterFunctions(metaClass))
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 1ee65d94e..8a4a4eba0 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -1142,6 +1142,19 @@ QString ShibokenGenerator::getModuleHeaderFileName(QString modName) const
return QString("%1_python.h").arg(modName.toLower());
}
+bool ShibokenGenerator::isCopyable(const AbstractMetaClass *metaClass)
+
+{
+ if (metaClass->isNamespace())
+ return false;
+ else if (metaClass->typeEntry()->copyable() == ComplexTypeEntry::Unknown)
+ return metaClass->hasCloneOperator();
+ else
+ return (metaClass->typeEntry()->copyable() == ComplexTypeEntry::CopyableSet);
+
+ return false;
+}
+
/*
static void dumpFunction(AbstractMetaFunctionList lst)
{
diff --git a/shibokengenerator.h b/shibokengenerator.h
index b46d63d23..4822b8574 100644
--- a/shibokengenerator.h
+++ b/shibokengenerator.h
@@ -279,6 +279,8 @@ public:
bool usePySideExtensions() const;
protected:
bool doSetup(const QMap<QString, QString>& args);
+ // verify whether the class is copyable
+ bool isCopyable(const AbstractMetaClass* metaClass);
bool m_native_jump_table;
static QHash<QString, QString> m_pythonPrimitiveTypeName;