diff options
Diffstat (limited to 'IvyCallback.h')
-rw-r--r-- | IvyCallback.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/IvyCallback.h b/IvyCallback.h index 1d47dc4..aa866b8 100644 --- a/IvyCallback.h +++ b/IvyCallback.h @@ -120,6 +120,65 @@ public: /* 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: @@ -130,3 +189,4 @@ public: }; #endif // __IVYXTLOOP_H__ + |