summaryrefslogtreecommitdiff
path: root/swig/CommitCallbacks.h
diff options
context:
space:
mode:
authorKlaus Kämpf <kkaempf@suse.de>2010-11-06 22:11:06 +0100
committerKlaus Kämpf <kkaempf@suse.de>2010-11-06 22:11:06 +0100
commite5a53c804d294b76cc529f28efca16ad52d07fd9 (patch)
tree04ecb93b5f74b01fde8d2a73e08f86ee6177a312 /swig/CommitCallbacks.h
parent78111f8aa14af7693e771897c65f286f858330bf (diff)
downloadlibzypp-bindings-e5a53c804d294b76cc529f28efca16ad52d07fd9.tar.gz
libzypp-bindings-e5a53c804d294b76cc529f28efca16ad52d07fd9.tar.bz2
libzypp-bindings-e5a53c804d294b76cc529f28efca16ad52d07fd9.zip
Initial step towards callbacks support
This commit introduces generic (all target languages) support for callbacks. Callbacks are sent to a 'callback object instance' which must be instantiated. Currently implemented are commit callbacks, requiring an instance of 'CommitCallbacks' ** this is work in progress ** Next: Provide example code and tests for Python and Ruby
Diffstat (limited to 'swig/CommitCallbacks.h')
-rw-r--r--swig/CommitCallbacks.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/swig/CommitCallbacks.h b/swig/CommitCallbacks.h
new file mode 100644
index 0000000..e02cb73
--- /dev/null
+++ b/swig/CommitCallbacks.h
@@ -0,0 +1,33 @@
+class CommitCallbacks {
+
+ private:
+ PatchMessageReportReceiver _messageReceiver;
+ PatchScriptReportReceiver _scriptReceiver;
+ RemoveResolvableReportReceiver _installReceiver;
+ InstallResolvableReportReceiver _removeReceiver;
+
+ Target_Type _instance;
+ public:
+ CommitCallbacks(Target_Type instance)
+ : _messageReceiver(instance)
+ , _scriptReceiver(instance)
+ , _installReceiver(instance)
+ , _removeReceiver(instance)
+ {
+ _instance = instance;
+ Target_INCREF(_instance);
+ _messageReceiver.connect();
+ _scriptReceiver.connect();
+ _installReceiver.connect();
+ _removeReceiver.connect();
+ }
+
+ ~CommitCallbacks()
+ {
+ _removeReceiver.disconnect();
+ _installReceiver.disconnect();
+ _scriptReceiver.disconnect();
+ _messageReceiver.disconnect();
+ Target_DECREF(_instance);
+ }
+};