|
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
21 #ifndef ELM_SYS_PLUGIN_H
22 #define ELM_SYS_PLUGIN_H
24 #include <elm/macros.h>
25 #include <elm/types.h>
26 #include <elm/string.h>
27 #include <elm/data/List.h>
28 #include <elm/data/Vector.h>
29 #include <elm/util/Version.h>
30 #include <elm/sys/Path.h>
31 #include "../data/Array.h"
33 namespace elm {
namespace sys {
35 #define ELM_PLUGIN_ID_PREFIX "@@ELM-PLUGIN-ID@@:"
36 #define ELM_PLUGIN_CONCAT(x, y) ELM_CONCAT_AUX(x, y)
37 #define ELM_PLUGIN_ID(hook, info) const char *ELM_PLUGIN_CONCAT(__plugin_id_, __LINE__)() { return ELM_PLUGIN_ID_PREFIX hook ":" info; }
38 #define ELM_PLUGIN(plugin, hook) extern "C" { \
39 ELM_PLUGIN_ID(#hook, #plugin); \
40 elm::sys::Plugin *ELM_PLUGIN_CONCAT(hook, _fun)(void) { return static_cast<elm::sys::Plugin *>(&plugin); } }
53 : _name(
name), _plugger_version(plugger_version) { }
57 inline make&
version(
int major,
int minor,
int release = 0) { _plugin_version =
Version(major, minor, release);
return *
this; }
62 cstring _description, _license, _hook;
63 Version _plugin_version, _plugger_version;
70 inline string name(
void)
const {
return _name; }
79 inline const Path&
path(
void)
const {
return _path; }
93 void plug(
void *handle);
94 static void step(
void);
100 static bool static_done;
139 #endif // ELM_SYS_PLUGIN_H
string name(void) const
Definition: Plugin.h:70
List< Plugin * >::Iter DepIter
Definition: Plugin.h:81
CString hook(void) const
Definition: Plugin.h:129
make(string name, const Version &plugger_version)
Definition: Plugin.h:52
CString licence(void) const
Definition: Plugin.h:117
const Version & pluginVersion(void) const
Definition: Plugin.h:121
DepIter dependencies(void) const
Definition: Plugin.h:82
void unplug(void)
Definition: system_Plugin.cpp:353
const aliases_t & aliases(void) const
Definition: Plugin.h:133
const Path & path(void) const
Definition: Plugin.h:79
void add(const T &v)
Definition: Vector.h:101
Array< string > aliases_t
Definition: Plugin.h:47
make & license(cstring l)
Definition: Plugin.h:55
make & description(cstring d)
Definition: Plugin.h:54
static const t::uint32 MAGIC
Definition: Plugin.h:46
Version _plugin_version
Definition: Plugin.h:90
virtual void startup(void)
Definition: system_Plugin.cpp:380
make & alias(string a)
Definition: Plugin.h:58
make & version(int major, int minor, int release=0)
Definition: Plugin.h:57
unsigned int uint32
Definition: arch.h:31
ret< T > get(const var< T > &v)
Definition: type_info.h:288
make & hook(cstring h)
Definition: Plugin.h:59
CString _licence
Definition: Plugin.h:89
bool matches(const string &name) const
Definition: system_Plugin.cpp:472
Plugin(string name, const Version &plugger_version, CString hook="", const aliases_t &aliases=aliases_t::null)
Definition: system_Plugin.cpp:262
make & version(const Version &v)
Definition: Plugin.h:56
virtual ~Plugin(void)
Definition: system_Plugin.cpp:307
const Version & pluggerVersion(void) const
Definition: Plugin.h:125
CString description(void) const
Definition: Plugin.h:113
static const Array< T > null
Definition: Array.h:65
virtual void cleanup(void)
Definition: system_Plugin.cpp:388
CString _description
Definition: Plugin.h:88