added: sessions data for plugins (plugindata.h plugindata.cpp)

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@598 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-05-04 21:58:22 +00:00
parent aff4cc516e
commit 2ad666d221
20 changed files with 604 additions and 243 deletions

View File

@@ -18,10 +18,7 @@
#include "data.h"
#include "pluginmsg.h"
#include "log.h"
class Plugin;
#include "plugindata.h"
// plugin arguments
@@ -31,6 +28,11 @@ struct Arg
void * app2; // used for some purposes
void * app3; // used for some purposes
int plugin_id; // unique plugin identifier
PluginDataBase * plugin_data_base; // pointer to the plugin session
int ret_true; // how many plugins returned true
int ret_false; // how many plugins returned false
@@ -42,6 +44,7 @@ struct Arg
app3 = 0;
ret_true = 0;
ret_false = 0;
plugin_data_base = 0;
}
};
@@ -51,8 +54,23 @@ class Plugin
{
public:
// index of a plugin which is called by Call() method
// normally: -1
int current_plugin;
// !! zmienic sygnature funkcji (niech nie zwraca zadnej wartosci, bo to tylko wkurwia)
// albo dodac jeszcze inna sygnature (niech nie pobiera zadnego argumentu)
typedef bool (*Fun)(Arg *);
//typedef void (*Fun2)();
struct Slot
{
Fun fun;
// Fun2 fun2; // dla drugiej sygnatury
int index; // plugin index
};
Plugin();
@@ -65,6 +83,7 @@ public:
Arg * Call(int message, void * a=0, void * a2=0, void * a3=0);
size_t Size();
void Assign(int message, Fun);
@@ -74,10 +93,9 @@ private:
typedef std::vector<void*> Plugins;
Plugins plugins;
typedef std::multimap<int, Fun> Slots;
typedef std::multimap<int, Slot> Slots;
Slots slots;
Arg arg;
};