Commit 2d25ea6c authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

wrap objectManager and qvariant with swig + add extend rule for

qvariant in factory macro
parent de0ceb4a
......@@ -49,6 +49,7 @@ set(dtk_INSTALL_DOCS @dtk_INSTALL_DOCS@)
set(dtk_CONFIG_DOCS @dtk_CONFIG_DOCS@)
set(dtk_WRAP_BASE "@CMAKE_BINARY_DIR@/dtk_base.i")
set(dtk_WRAP_CORE "@CMAKE_BINARY_DIR@/dtkCore.i")
set(dtk_WRAP_QVARIANT "@CMAKE_BINARY_DIR@/QVariant.i")
## ###################################################################
## Options
......
......@@ -22,10 +22,13 @@
#include <dtkCore/dtkCorePluginBase.h>
#include <dtkCore/dtkCorePluginManager.h>
#include <dtkCore/dtkCorePluginFactory.h>
#include <dtkCore/dtkObjectManager.h>
#include <dtkCore/dtkArray.h>
%}
%feature("director");
// /////////////////////////////////////////////////////////////////
......@@ -43,6 +46,7 @@
%include <dtkCore/dtkCorePluginManager.h>
%include <dtkCore/dtkCorePluginFactory.h>
%include <dtkCore/dtkArray.h>
%include <dtkCore/dtkObjectManager.h>
%template(dtkArrayInt) dtkArray<long long>;
%template(dtkArrayDouble) dtkArray<double>;
......
......@@ -13,6 +13,7 @@
### Code:
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qt_core.i ${CMAKE_BINARY_DIR}/qt_core.i COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/QVariant.i ${CMAKE_BINARY_DIR}/QVariant.i COPYONLY)
######################################################################
### CMakeLists.txt ends here
class QVariant {
public:
QVariant();
QVariant(int);
QVariant(const char *);
QVariant(bool);
int toInt() const;
QString toString() const;
QStringList toStringList() const;
bool toBool() const;
};
%extend QVariant {
void setValue(int value) {
$self->setValue(QVariant::fromValue(value));
}
}
......@@ -65,6 +65,14 @@
#undef DTK_DECLARE_PLUGIN_FACTORY(type, Export)
%define DTK_DECLARE_PLUGIN_FACTORY(type, Export)
%extend QVariant {
void setValue(type *value) {
$self->setValue(dtkMetaType::variantFromValue(value));
}
type* to##type() const {
return $self->value<type *>();
}
}
%template(type##PluginFactorySwigTemplate) dtkCorePluginFactory<type>;
class Export type##PluginFactory : public dtkCorePluginFactory<type> {};
%enddef
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment