diff options
author | Klaus Kämpf <kkaempf@suse.de> | 2010-11-11 10:35:25 +0100 |
---|---|---|
committer | Klaus Kämpf <kkaempf@suse.de> | 2010-11-11 10:35:25 +0100 |
commit | 1b81c2fed0efcc0063a608c52ef4344c146da0ba (patch) | |
tree | 8c707c70e8a8fae17fba9365eb384de7d971ac53 | |
parent | 3c8c2932ffa944fbeec933d2f6b7cd077deec920 (diff) | |
download | libzypp-bindings-1b81c2fed0efcc0063a608c52ef4344c146da0ba.tar.gz libzypp-bindings-1b81c2fed0efcc0063a608c52ef4344c146da0ba.tar.bz2 libzypp-bindings-1b81c2fed0efcc0063a608c52ef4344c146da0ba.zip |
Complete the callback testing infrastructure
-rw-r--r-- | swig/CommitCallbacks.h | 112 |
1 files changed, 106 insertions, 6 deletions
diff --git a/swig/CommitCallbacks.h b/swig/CommitCallbacks.h index 881cd59..68310b8 100644 --- a/swig/CommitCallbacks.h +++ b/swig/CommitCallbacks.h @@ -75,14 +75,114 @@ class CommitCallbacks { class CommitCallbacksEmitter { private: - callback::SendReport<target::rpm::RemoveResolvableReport> remove_resolvable; - callback::SendReport<target::PatchMessageReport> patch_message; - callback::SendReport<target::PatchScriptReport> patch_script; - callback::SendReport<target::rpm::InstallResolvableReport> install_resolvable; + callback::SendReport<target::rpm::InstallResolvableReport> _install_resolvable; + callback::SendReport<target::rpm::RemoveResolvableReport> _remove_resolvable; + callback::SendReport<target::PatchMessageReport> _patch_message; + callback::SendReport<target::PatchScriptReport> _patch_script; public: + /* + * InstallResolvableReport + * + */ + void install_start(zypp::ResObject::constPtr resobj) + { + _install_resolvable->start( resobj ); + } + + bool install_progress(zypp::ResObject::constPtr resobj, int value) + { + return _install_resolvable->progress( value, resobj ); /* arguments reversed :-/ */ + } + + target::rpm::InstallResolvableReport::Action install_problem( + zypp::ResObject::constPtr resobj, + target::rpm::InstallResolvableReport::Error error, + const std::string & description, + target::rpm::InstallResolvableReport::RpmLevel level) + { + return _install_resolvable->problem( resobj, error, description, level ); + } + + void install_finish( + zypp::ResObject::constPtr resobj, + target::rpm::InstallResolvableReport::Error error, + const std::string & reason, + target::rpm::InstallResolvableReport::RpmLevel level) + { + return _install_resolvable->finish( resobj, error, reason, level ); + } + + /* + * RemoveResolvableReport + * + */ void remove_start(zypp::ResObject::constPtr resobj) { - remove_resolvable->start( resobj ); + _remove_resolvable->start( resobj ); } -}; + + bool remove_progress(zypp::ResObject::constPtr resobj, int value) + { + return _remove_resolvable->progress( value, resobj ); /* arguments reversed :-/ */ + } + + target::rpm::RemoveResolvableReport::Action remove_problem( + zypp::ResObject::constPtr resobj, + target::rpm::RemoveResolvableReport::Error error, + const std::string & description) + { + return _remove_resolvable->problem( resobj, error, description ); + } + + void remove_finish( + zypp::ResObject::constPtr resobj, + target::rpm::RemoveResolvableReport::Error error, + const std::string & reason) + { + return _remove_resolvable->finish( resobj, error, reason ); + } + + /* + * PatchMessageReport + * + */ + + bool patch_message(zypp::Patch::constPtr & patch) + { + return _patch_message->show(patch); + } + + /* + * PatchScriptReport + * + */ + void script_start( const zypp::Package::constPtr & package, + const zypp::Pathname & path_r ) // script path + { + _patch_script->start(package, path_r); + } + + /** + * * Progress provides the script output. If the script is quiet, + * * from time to time still-alive pings are sent to the ui. (Notify=PING) + * * Returning \c FALSE aborts script execution. + * */ + bool script_progress( target::PatchScriptReport::Notify kind, const std::string &output ) + { + return _patch_script->progress(kind, output); + } + + /** Report error. */ + target::PatchScriptReport::Action script_problem( const std::string & description ) + { + return _patch_script->problem(description); + } + + /** Report success. */ + void finish() + { + _patch_script->finish(); + } + +}; |