libzypp  17.35.11
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 
20 namespace zypp
21 {
22  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 
35  {
36  }
37 
39  {
40  }
41 
43  {
44  }
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 
72  {
74  _report->problem( _resolvable
76  , excpt_r.asUserHistory()
77  , _level
78  );
79 
80  switch (user) {
84  _abort = true;
88  }
89 
90  return rpm::RpmInstallReport::problem( excpt_r );
91  }
92 
93  void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
94  {
95  _finishInfo = info_r;
96  }
97 
100  {
102  }
103 
106  {
108  }
109 
111  {
112  _level = level_r;
113  }
114 
115 
119 
121  : callback::ReceiveReport<rpm::RpmRemoveReport> ()
122  , _resolvable (std::move(res))
123  , _abort(false)
124  {
125  }
126 
128  {
129  }
130 
132  {
133  }
134 
136  {
137  }
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 
165  {
167  _report->problem( _resolvable
169  , excpt_r.asUserHistory()
170  );
171 
172  switch (user) {
176  _abort = true;
180  }
181 
182  return rpm::RpmRemoveReport::problem( excpt_r );
183  }
184 
185  void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
186  {
187  _finishInfo = info_r;
188  }
189 
192  {
193  _report->progress( 100, _resolvable );
195  }
196 
199  {
200  _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() );
201  }
202 
204  } // namespace target
206 
208 } // namespace zypp
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
TraitsType::constPtrType constPtr
Definition: Resolvable.h:59
callback::SendReport< rpm::RemoveResolvableReport > _report
virtual void finish()
Finish operation in case of success.
Definition: Arch.h:363
virtual void finishInfo(const std::string &info_r)
Additional rpm output to be reported in finish in case of success.
target::rpm::InstallResolvableReport::RpmLevel _level
virtual rpm::RpmRemoveReport::Action problem(Exception &excpt_r)
inform user about a problem
zypp::callback::UserData UserData
Definition: userrequest.h:18
virtual Action problem(Exception &excpt_r)
Definition: RpmCallbacks.h:52
virtual rpm::RpmInstallReport::Action problem(Exception &excpt_r)
inform user about a problem
RpmRemovePackageReceiver(Resolvable::constPtr res)
RpmRemovePackageReceiver.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Definition: Exception.cc:127
virtual void finishInfo(const std::string &info_r)
Additional rpm output to be reported in finish in case of success.
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
virtual void start(const Pathname &name)
Start the operation.
virtual void finish()
Finish operation in case of success.
virtual void start(const std::string &name)
Base class for Exception.
Definition: Exception.h:146
void report(const UserData &userData_r) override
Forwards generic reports.
virtual Action problem(Exception &excpt_r)
Definition: RpmCallbacks.h:97
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
RpmInstallPackageReceiver(Resolvable::constPtr res)
void tryLevel(target::rpm::InstallResolvableReport::RpmLevel level_r)
void report(const UserData &userData_r) override
Start the operation.
callback::SendReport< rpm::InstallResolvableReport > _report