libzypp  17.31.31
TargetCallbackReceiver.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 
15 
17 
19 namespace zypp
20 {
21  namespace target
23  {
24 
26  : callback::ReceiveReport<rpm::RpmInstallReport> ()
27  , _resolvable (res)
28  , _level( target::rpm::InstallResolvableReport::RPM )
29  , _abort (false)
30  {
31  }
32 
34  {
35  }
36 
38  {
39  }
40 
42  {
43  }
44 
45  void RpmInstallPackageReceiver::report( const UserData & userData_r )
46  {
47  if ( ! userData_r.haskey( "solvable" ) )
48  userData_r.set( "solvable", _resolvable->satSolvable() );
49  _report->report( userData_r );
50  }
51 
54  {
55  _report->start( _resolvable );
56  _abort = false;
57  }
58 
63  bool RpmInstallPackageReceiver::progress( unsigned percent )
64  {
65  _abort = ! _report->progress( percent, _resolvable );
66  return _abort;
67  }
68 
71  {
73  _report->problem( _resolvable
75  , excpt_r.asUserHistory()
76  , _level
77  );
78 
79  switch (user) {
83  _abort = true;
87  }
88 
89  return rpm::RpmInstallReport::problem( excpt_r );
90  }
91 
92  void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
93  {
94  _finishInfo = info_r;
95  }
96 
99  {
101  }
102 
105  {
107  }
108 
110  {
111  _level = level_r;
112  }
113 
114 
118 
120  : callback::ReceiveReport<rpm::RpmRemoveReport> ()
121  , _resolvable (res)
122  , _abort(false)
123  {
124  }
125 
127  {
128  }
129 
131  {
132  }
133 
135  {
136  }
137 
139  void RpmRemovePackageReceiver::report( const UserData & userData_r )
140  {
141  if ( ! userData_r.haskey( "solvable" ) )
142  userData_r.set( "solvable", _resolvable->satSolvable() );
143  _report->report( userData_r );
144  }
145 
146  void RpmRemovePackageReceiver::start( const std::string & name )
147  {
148  _report->start( _resolvable );
149  _abort = false;
150  }
151 
156  bool RpmRemovePackageReceiver::progress( unsigned percent )
157  {
158  _abort = ! _report->progress( percent, _resolvable );
159  return _abort;
160  }
161 
164  {
166  _report->problem( _resolvable
168  , excpt_r.asUserHistory()
169  );
170 
171  switch (user) {
175  _abort = true;
179  }
180 
181  return rpm::RpmRemoveReport::problem( excpt_r );
182  }
183 
184  void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
185  {
186  _finishInfo = info_r;
187  }
188 
191  {
192  _report->progress( 100, _resolvable );
194  }
195 
198  {
199  _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() );
200  }
201 
203  } // namespace target
205 
207 } // namespace zypp
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
callback::SendReport< rpm::RemoveResolvableReport > _report
virtual void finish()
Finish operation in case of success.
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
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:91
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.
TraitsType::constPtrType constPtr
Definition: Resolvable.h:59
virtual void start(const std::string &name)
Base class for Exception.
Definition: Exception.h:145
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: CodePitfalls.doc:1
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