Make FeaturePython Python binding a template class to avoid code duplication

This commit is contained in:
wmayer
2013-03-22 00:34:18 +01:00
parent e6de57649b
commit 605e85b952
30 changed files with 508 additions and 506 deletions

View File

@@ -31,13 +31,11 @@
#include <App/DynamicProperty.h>
#include <App/PropertyPythonObject.h>
#include <App/PropertyGeo.h>
#include <App/FeaturePythonPy.h>
namespace App
{
class Property;
class FeaturePythonPy;
// Helper class to hide implementation details
class AppExport FeaturePythonImp
@@ -48,6 +46,7 @@ public:
DocumentObjectExecReturn *execute();
void onChanged(const Property* prop);
PyObject *getPyObject(void);
private:
App::DocumentObject* object;
@@ -188,7 +187,7 @@ public:
PyObject *getPyObject(void) {
if (FeatureT::PythonObject.is(Py::_None())) {
// ref counter is set to 1
FeatureT::PythonObject = Py::Object(new FeaturePythonPy(this),true);
FeatureT::PythonObject = Py::Object(imp->getPyObject(),true);
}
return Py::new_reference_to(FeatureT::PythonObject);
}
@@ -199,8 +198,6 @@ public:
FeatureT::PythonObject = Py::None();
}
friend class FeaturePythonPy;
protected:
virtual void onChanged(const Property* prop) {
imp->onChanged(prop);