summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-16 11:29:45 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-16 11:29:45 +0200
commitdfbe00cb1d9ce4cb52448cf4c1d577fe7b1eaad7 (patch)
tree8c1557a654744d763ded5d373ab830fb1afada99 /opentrack
parent577fc3945f7515aef936f0d05d4756423a0b5bc2 (diff)
api: introduce macros for symbol exposure
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/plugin-qt-api.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/opentrack/plugin-qt-api.hpp b/opentrack/plugin-qt-api.hpp
index 89b71f81..2ccdad19 100644
--- a/opentrack/plugin-qt-api.hpp
+++ b/opentrack/plugin-qt-api.hpp
@@ -4,6 +4,20 @@
#include <QFrame>
#include <QIcon>
+#define OPENTRACK_DECLARE_PLUGIN_INTERNAL(ctor_class, ctor_ret_class, metadata_class, dialog_class, dialog_ret_class) \
+ extern "C" OPENTRACK_EXPORT ctor_ret_class* GetConstructor() \
+ { \
+ return new ctor_class; \
+ } \
+ extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() \
+ { \
+ return new metadata_class; \
+ } \
+ extern "C" OPENTRACK_EXPORT dialog_ret_class* GetDialog() \
+ { \
+ return new dialog_class; \
+ }
+
// implement this in all plugins
struct Metadata
{
@@ -91,3 +105,7 @@ struct ITrackerDialog : public QWidget
// received tracker pointer is about to get deleted
virtual void unregister_tracker() = 0;
};
+
+// call once with your chosen class names in the plugin
+#define OPENTRACK_DECLARE_TRACKER(tracker_class, dialog_class, metadata_class) \
+ OPENTRACK_DECLARE_PLUGIN_INTERNAL(tracker_class, ITracker, metadata_class, dialog_class, ITrackerDialog)