summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ivy/IvyCallback.h61
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: