libzypp  13.10.6
TargetCallbackReceiver.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
14 
16 
18 namespace zypp
19 {
20  namespace target
22  {
23 
25  : callback::ReceiveReport<rpm::RpmInstallReport> ()
26  , _resolvable (res)
27  , _level( target::rpm::InstallResolvableReport::RPM )
28  , _abort (false)
29  {
30  }
31 
33  {
34  }
35 
37  {
38  }
39 
41  {
42  }
43 
45  void RpmInstallPackageReceiver::start( const Pathname & name )
46  {
47  _report->start( _resolvable );
48  _abort = false;
49  }
50 
55  bool RpmInstallPackageReceiver::progress( unsigned percent )
56  {
57  _abort = ! _report->progress( percent, _resolvable );
58  return _abort;
59  }
60 
63  {
65  _report->problem( _resolvable
67  , excpt_r.asUserHistory()
68  , _level
69  );
70 
71  switch (user) {
75  _abort = true;
79  }
80 
81  return rpm::RpmInstallReport::problem( excpt_r );
82  }
83 
84  void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
85  {
86  _finishInfo = info_r;
87  }
88 
91  {
93  }
94 
97  {
99  }
100 
102  {
103  _level = level_r;
104  }
105 
106 
110 
112  : callback::ReceiveReport<rpm::RpmRemoveReport> ()
113  , _resolvable (res)
114  , _abort(false)
115  {
116  }
117 
119  {
120  }
121 
123  {
124  }
125 
127  {
128  }
129 
131  void RpmRemovePackageReceiver::start( const std::string & name )
132  {
133  _report->start( _resolvable );
134  _abort = false;
135  }
136 
141  bool RpmRemovePackageReceiver::progress( unsigned percent )
142  {
143  _abort = ! _report->progress( percent, _resolvable );
144  return _abort;
145  }
146 
149  {
151  _report->problem( _resolvable
153  , excpt_r.asUserHistory()
154  );
155 
156  switch (user) {
160  _abort = true;
164  }
165 
166  return rpm::RpmRemoveReport::problem( excpt_r );
167  }
168 
169  void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
170  {
171  _finishInfo = info_r;
172  }
173 
176  {
177  _report->progress( 100, _resolvable );
179  }
180 
183  {
184  _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() );
185  }
186 
188  } // namespace target
190 
192 } // 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.
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:49
virtual void start(const std::string &name)
Start the operation.
Base class for Exception.
Definition: Exception.h:143
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Definition: Exception.cc:75
virtual Action problem(Exception &excpt_r)
Definition: RpmCallbacks.h:97
RpmInstallPackageReceiver(Resolvable::constPtr res)
void tryLevel(target::rpm::InstallResolvableReport::RpmLevel level_r)
callback::SendReport< rpm::InstallResolvableReport > _report