libzypp 17.37.17
TargetCallbackReceiver.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13#include <utility>
14
16
18
20namespace zypp
21{
23 namespace target
24 {
25
27 : callback::ReceiveReport<rpm::RpmInstallReport> ()
28 , _resolvable (std::move(res))
29 , _level( target::rpm::InstallResolvableReport::RPM )
30 , _abort (false)
31 {
32 }
33
37
41
45
46 void RpmInstallPackageReceiver::report( const UserData & userData_r )
47 {
48 if ( ! userData_r.haskey( "solvable" ) )
49 userData_r.set( "solvable", _resolvable->satSolvable() );
50 _report->report( userData_r );
51 }
52
55 {
56 _report->start( _resolvable );
57 _abort = false;
58 }
59
64 bool RpmInstallPackageReceiver::progress( unsigned percent )
65 {
66 _abort = ! _report->progress( percent, _resolvable );
67 return _abort;
68 }
69
92
93 void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
94 {
95 _finishInfo = info_r;
96 }
97
103
109
114
115
119
121 : callback::ReceiveReport<rpm::RpmRemoveReport> ()
122 , _resolvable (std::move(res))
123 , _abort(false)
124 {
125 }
126
130
134
138
140 void RpmRemovePackageReceiver::report( const UserData & userData_r )
141 {
142 if ( ! userData_r.haskey( "solvable" ) )
143 userData_r.set( "solvable", _resolvable->satSolvable() );
144 _report->report( userData_r );
145 }
146
147 void RpmRemovePackageReceiver::start( const std::string & name )
148 {
149 _report->start( _resolvable );
150 _abort = false;
151 }
152
157 bool RpmRemovePackageReceiver::progress( unsigned percent )
158 {
159 _abort = ! _report->progress( percent, _resolvable );
160 return _abort;
161 }
162
184
185 void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
186 {
187 _finishInfo = info_r;
188 }
189
196
199 {
201 }
202
204 } // namespace target
206
208} // namespace zypp
Base class for Exception.
Definition Exception.h:153
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Definition Exception.cc:140
TraitsType::constPtrType constPtr
Definition Resolvable.h:59
virtual void finish()
Finish operation in case of success.
void tryLevel(target::rpm::InstallResolvableReport::RpmLevel level_r)
virtual void finishInfo(const std::string &info_r)
Additional rpm output to be reported in finish in case of success.
virtual void start(const Pathname &name)
Start the operation.
void report(const UserData &userData_r) override
Forwards generic reports.
virtual rpm::RpmInstallReport::Action problem(Exception &excpt_r)
inform user about a problem
target::rpm::InstallResolvableReport::RpmLevel _level
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
callback::SendReport< rpm::InstallResolvableReport > _report
RpmRemovePackageReceiver(Resolvable::constPtr res)
RpmRemovePackageReceiver.
virtual void start(const std::string &name)
virtual void finish()
Finish operation in case of success.
void report(const UserData &userData_r) override
Start the operation.
callback::SendReport< rpm::RemoveResolvableReport > _report
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
virtual void finishInfo(const std::string &info_r)
Additional rpm output to be reported in finish in case of success.
virtual rpm::RpmRemoveReport::Action problem(Exception &excpt_r)
inform user about a problem
Definition Arch.h:364
Callbacks light.
Definition Callback.h:146
Easy-to use interface to the ZYPP dependency resolver.
virtual Action problem(Exception &excpt_r)
virtual Action problem(Exception &excpt_r)