aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.h
diff options
context:
space:
mode:
authorJordi Vilalta Prat2008-02-08 00:02:23 +0000
committerJordi Vilalta Prat2008-02-08 00:02:23 +0000
commitc103290e2b123510e9d9eb4716ae0336a9e61ede (patch)
tree5e13c4cd5a990094696b819b852ebbfb7afd89c9 /base/plugins.h
parent49d0b1f91e32eda3956c0c1d8c0156ebd5854c66 (diff)
downloadscummvm-rg350-c103290e2b123510e9d9eb4716ae0336a9e61ede.tar.gz
scummvm-rg350-c103290e2b123510e9d9eb4716ae0336a9e61ede.tar.bz2
scummvm-rg350-c103290e2b123510e9d9eb4716ae0336a9e61ede.zip
Initial support for plugin types
svn-id: r30825
Diffstat (limited to 'base/plugins.h')
-rw-r--r--base/plugins.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/base/plugins.h b/base/plugins.h
index e91ed80aa4..f3022e7010 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -48,6 +48,12 @@ public:
#include "engines/metaengine.h"
+enum PluginType {
+ PLUGIN_TYPE_ENGINE = 0,
+
+ PLUGIN_TYPE_MAX
+};
+
class Engine;
class FSList;
class OSystem;
@@ -60,6 +66,7 @@ class OSystem;
class Plugin {
protected:
PluginObject *_pluginObject;
+ PluginType _type;
public:
Plugin() : _pluginObject(0) {}
@@ -72,6 +79,7 @@ public:
virtual bool loadPlugin() = 0; // TODO: Rename to load() ?
virtual void unloadPlugin() = 0; // TODO: Rename to unload() ?
+ PluginType getType() const;
const char *getName() const;
const char *getCopyright() const;
@@ -95,14 +103,16 @@ public:
*/
#ifndef DYNAMIC_MODULES
-#define REGISTER_PLUGIN(ID,PLUGINCLASS) \
+#define REGISTER_PLUGIN(ID,TYPE,PLUGINCLASS) \
+ PluginType g_##ID##_type = TYPE; \
PluginObject *g_##ID##_getObject() { \
return new PLUGINCLASS(); \
} \
void dummyFuncToAllowTrailingSemicolon()
#else
-#define REGISTER_PLUGIN(ID,PLUGINCLASS) \
+#define REGISTER_PLUGIN(ID,TYPE,PLUGINCLASS) \
extern "C" { \
+ PLUGIN_EXPORT int32 PLUGIN_getType() { return TYPE; } \
PLUGIN_EXPORT PluginObject *PLUGIN_getObject() { \
return new PLUGINCLASS(); \
} \