From 1b81c2fed0efcc0063a608c52ef4344c146da0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= Date: Thu, 11 Nov 2010 10:35:25 +0100 Subject: Complete the callback testing infrastructure --- swig/CommitCallbacks.h | 112 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file 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 remove_resolvable; - callback::SendReport patch_message; - callback::SendReport patch_script; - callback::SendReport install_resolvable; + callback::SendReport _install_resolvable; + callback::SendReport _remove_resolvable; + callback::SendReport _patch_message; + callback::SendReport _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(); + } + +}; -- cgit v1.2.3