diff options
author | fcolin | 2007-02-01 13:01:29 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 13:01:29 +0000 |
commit | 528bf5ef59ac20c903cdef0b646f41f62564f6c7 (patch) | |
tree | 83b83b0e609f4994ef923e390def686e022d5fb2 /Ivy/IvyCallback.h | |
parent | cca8702ee446dd87d4bca25dfa1e5b199649f490 (diff) | |
download | ivy-cplusplus-528bf5ef59ac20c903cdef0b646f41f62564f6c7.zip ivy-cplusplus-528bf5ef59ac20c903cdef0b646f41f62564f6c7.tar.gz ivy-cplusplus-528bf5ef59ac20c903cdef0b646f41f62564f6c7.tar.bz2 ivy-cplusplus-528bf5ef59ac20c903cdef0b646f41f62564f6c7.tar.xz |
Utilisateur : Fcolin Date : 1/06/06 Heure : 10:14 Archivé dans $/Bus/Ivy Commentaire: ajout Binding Callback et SetFilter (vss 10)
Diffstat (limited to 'Ivy/IvyCallback.h')
-rw-r--r-- | Ivy/IvyCallback.h | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/Ivy/IvyCallback.h b/Ivy/IvyCallback.h index 78aff80..ede0ef4 100644 --- a/Ivy/IvyCallback.h +++ b/Ivy/IvyCallback.h @@ -103,16 +103,73 @@ public: }
virtual void OnApplicationConnected (IvyApplication *app)
{
- (*ApplicationConnectedCb) (app);
+ if ( ApplicationConnectedCb ) (*ApplicationConnectedCb) (app);
};
virtual void OnApplicationDisconnected (IvyApplication *app)
{
- (*ApplicationDisconnectedCb) (app);
+ if ( ApplicationDisconnectedCb ) (*ApplicationDisconnectedCb) (app);
};
/* raccourci d'ecriture */
#define BUS_APPLICATION_CALLBACK( conn, disconn ) new IvyApplicationCallbackFunction( conn, disconn )
};
+
+/* Binding Callback */
+
+class IvyBindingCallback {
+public:
+ virtual void OnAddBind (IvyApplication *app, int id, const char * regexp) = 0;
+ virtual void OnRemoveBind (IvyApplication *app, int id, const char * regexp) = 0;
+ virtual void OnFilterBind (IvyApplication *app, int id, const char * regexp) = 0;
+ virtual ~IvyBindingCallback()
+ {
+ }
+};
+class IvyBindingNullCallback : public IvyBindingCallback {
+public:
+ virtual void OnAddBind (IvyApplication *app, int id, const char * regexp)
+ {};
+ virtual void OnRemoveBind (IvyApplication *app, int id, const char * regexp)
+ {};
+ virtual void OnFilterBind (IvyApplication *app, int id, const char * regexp)
+ {};
+ virtual ~IvyBindingNullCallback()
+ {
+ }
+};
+// Static function CB
+class IvyBindingCallbackFunction: public IvyBindingCallback {
+public:
+ typedef void ( *IvyBindingCallback_fun )( IvyApplication *app, int id, const char * regexp );
+ IvyBindingCallback_fun BindingAddCb;
+ IvyBindingCallback_fun BindingRemoveCb;
+ IvyBindingCallback_fun BindingFilterCb;
+
+public:
+ IvyBindingCallbackFunction ( IvyBindingCallback_fun add_cb, IvyBindingCallback_fun remove_cb, IvyBindingCallback_fun filter_cb )
+ : BindingAddCb( add_cb ), BindingRemoveCb( remove_cb ), BindingFilterCb( filter_cb )
+ {
+ }
+ ~IvyBindingCallbackFunction ()
+ {
+ }
+ virtual void OnAddBind (IvyApplication *app, int id, const char * regexp)
+ {
+ if(BindingAddCb) (*BindingAddCb) (app, id, regexp);
+ };
+ virtual void OnRemoveBind (IvyApplication *app, int id, const char * regexp)
+ {
+ if (BindingRemoveCb) (*BindingRemoveCb) (app, id, regexp);
+ };
+ virtual void OnFilterBind (IvyApplication *app, int id, const char * regexp)
+ {
+ if(BindingFilterCb ) (*BindingFilterCb) (app, id, regexp);
+ };
+
+/* raccourci d'ecriture */
+#define BUS_BINDING_CALLBACK( add, remove, filter ) new IvyBindingCallbackFunction( add, remove, filter )
+};
+
/* Callback for the die Message */
class IvyDieCallback {
public:
|