libzypp  17.22.0
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 
47  {
48  _report->start( _resolvable );
49  _abort = false;
50  }
51 
56  bool RpmInstallPackageReceiver::progress( unsigned percent )
57  {
58  _abort = ! _report->progress( percent, _resolvable );
59  return _abort;
60  }
61 
64  {
66  _report->problem( _resolvable
68  , excpt_r.asUserHistory()
69  , _level
70  );
71 
72  switch (user) {
76  _abort = true;
80  }
81 
82  return rpm::RpmInstallReport::problem( excpt_r );
83  }
84 
85  void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
86  {
87  _finishInfo = info_r;
88  }
89 
92  {
94  }
95 
98  {
100  }
101 
103  {
104  _level = level_r;
105  }
106 
107 
111 
113  : callback::ReceiveReport<rpm::RpmRemoveReport> ()
114  , _resolvable (res)
115  , _abort(false)
116  {
117  }
118 
120  {
121  }
122 
124  {
125  }
126 
128  {
129  }
130 
132  void RpmRemovePackageReceiver::start( const std::string & name )
133  {
134  _report->start( _resolvable );
135  _abort = false;
136  }
137 
142  bool RpmRemovePackageReceiver::progress( unsigned percent )
143  {
144  _abort = ! _report->progress( percent, _resolvable );
145  return _abort;
146  }
147 
150  {
152  _report->problem( _resolvable
154  , excpt_r.asUserHistory()
155  );
156 
157  switch (user) {
161  _abort = true;
165  }
166 
167  return rpm::RpmRemoveReport::problem( excpt_r );
168  }
169 
170  void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
171  {
172  _finishInfo = info_r;
173  }
174 
177  {
178  _report->progress( 100, _resolvable );
180  }
181 
184  {
185  _report->finish( _resolvable, rpm::RemoveResolvableReport::INVALID, std::string() );
186  }
187 
189  } // namespace target
191 
193 } // namespace zypp
zypp::target::RpmRemovePackageReceiver::reportbegin
virtual void reportbegin()
Definition: TargetCallbackReceiver.cc:123
zypp::target::RpmInstallPackageReceiver::_abort
bool _abort
Definition: TargetCallbackReceiver.h:31
zypp::target::RpmInstallPackageReceiver::finishInfo
virtual void finishInfo(const std::string &info_r)
Additional rpm output to be reported in finish in case of success.
Definition: TargetCallbackReceiver.cc:85
zypp::Exception
Base class for Exception.
Definition: Exception.h:145
zypp::target::RpmRemovePackageReceiver::finishInfo
virtual void finishInfo(const std::string &info_r)
Additional rpm output to be reported in finish in case of success.
Definition: TargetCallbackReceiver.cc:170
zypp::target::RpmRemovePackageReceiver::_resolvable
Resolvable::constPtr _resolvable
Definition: TargetCallbackReceiver.h:73
zypp::target::rpm::RemoveResolvableReport::IGNORE
Definition: ZYppCallbacks.h:567
zypp::target::rpm::RpmRemoveReport::IGNORE
Definition: RpmCallbacks.h:39
zypp::Resolvable::constPtr
TraitsType::constPtrType constPtr
Definition: Resolvable.h:59
zypp::target::RpmInstallPackageReceiver::progress
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
Definition: TargetCallbackReceiver.cc:56
zypp::target::RpmInstallPackageReceiver::start
virtual void start(const Pathname &name)
Start the operation.
Definition: TargetCallbackReceiver.cc:46
zypp::target::rpm::InstallResolvableReport::NO_ERROR
Definition: ZYppCallbacks.h:525
zypp::target::RpmRemovePackageReceiver::RpmRemovePackageReceiver
RpmRemovePackageReceiver(Resolvable::constPtr res)
RpmRemovePackageReceiver.
Definition: TargetCallbackReceiver.cc:112
zypp::target::RpmInstallPackageReceiver::tryLevel
void tryLevel(target::rpm::InstallResolvableReport::RpmLevel level_r)
Definition: TargetCallbackReceiver.cc:102
zypp::target::RpmRemovePackageReceiver::_report
callback::SendReport< rpm::RemoveResolvableReport > _report
Definition: TargetCallbackReceiver.h:72
zypp::target::rpm::InstallResolvableReport::INVALID
Definition: ZYppCallbacks.h:528
zypp::target::rpm::RemoveResolvableReport::NO_ERROR
Definition: ZYppCallbacks.h:571
zypp::target::RpmRemovePackageReceiver::finish
virtual void finish()
Finish operation in case of success.
Definition: TargetCallbackReceiver.cc:176
zypp::target::RpmRemovePackageReceiver::_abort
bool _abort
Definition: TargetCallbackReceiver.h:74
zypp::target::rpm::InstallResolvableReport::RETRY
Definition: ZYppCallbacks.h:520
zypp::target::RpmInstallPackageReceiver::reportbegin
virtual void reportbegin()
Definition: TargetCallbackReceiver.cc:37
zypp::target::rpm::RpmRemoveReport::RETRY
Definition: RpmCallbacks.h:38
zypp::target::rpm::RpmRemoveReport::problem
virtual Action problem(Exception &excpt_r)
Definition: RpmCallbacks.h:52
zypp::target::RpmRemovePackageReceiver::reportend
virtual void reportend()
Definition: TargetCallbackReceiver.cc:127
zypp::target::rpm::RpmInstallReport::IGNORE
Definition: RpmCallbacks.h:76
zypp::target::RpmInstallPackageReceiver::_finishInfo
std::string _finishInfo
Definition: TargetCallbackReceiver.h:32
zypp::target::rpm::InstallResolvableReport::IGNORE
Definition: ZYppCallbacks.h:521
zypp::target::rpm::RpmInstallReport::RETRY
Definition: RpmCallbacks.h:75
RpmCallbacks.h
zypp::Exception::asUserHistory
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Definition: Exception.cc:91
zypp::target::RpmRemovePackageReceiver::~RpmRemovePackageReceiver
virtual ~RpmRemovePackageReceiver()
Definition: TargetCallbackReceiver.cc:119
zypp::target::RpmInstallPackageReceiver::finish
virtual void finish()
Finish operation in case of success.
Definition: TargetCallbackReceiver.cc:91
zypp::target::rpm::RemoveResolvableReport::INVALID
Definition: ZYppCallbacks.h:574
zypp::target::rpm::InstallResolvableReport::ABORT
Definition: ZYppCallbacks.h:519
zypp::target::rpm::RpmInstallReport::ABORT
Definition: RpmCallbacks.h:74
zypp::target::RpmInstallPackageReceiver::_report
callback::SendReport< rpm::InstallResolvableReport > _report
Definition: TargetCallbackReceiver.h:28
zypp::target::rpm::RemoveResolvableReport::ABORT
Definition: ZYppCallbacks.h:565
zypp::target::rpm::InstallResolvableReport::RpmLevel
RpmLevel
Definition: ZYppCallbacks.h:533
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::target::rpm::RemoveResolvableReport::RETRY
Definition: ZYppCallbacks.h:566
zypp::target::rpm::RpmInstallReport::Action
Action
Definition: RpmCallbacks.h:73
TargetCallbackReceiver.h
zypp::target::RpmInstallPackageReceiver::problem
virtual rpm::RpmInstallReport::Action problem(Exception &excpt_r)
inform user about a problem
Definition: TargetCallbackReceiver.cc:63
zypp::target::rpm::RemoveResolvableReport::Action
Action
Definition: ZYppCallbacks.h:564
zypp::target::rpm::RpmRemoveReport::Action
Action
Definition: RpmCallbacks.h:36
zypp::target::RpmInstallPackageReceiver::reportend
virtual void reportend()
Definition: TargetCallbackReceiver.cc:41
zypp::target::RpmInstallPackageReceiver::RpmInstallPackageReceiver
RpmInstallPackageReceiver(Resolvable::constPtr res)
Definition: TargetCallbackReceiver.cc:25
zypp::target::RpmRemovePackageReceiver::progress
virtual bool progress(unsigned percent)
Inform about progress Return true on abort.
Definition: TargetCallbackReceiver.cc:142
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::target::RpmRemovePackageReceiver::problem
virtual rpm::RpmRemoveReport::Action problem(Exception &excpt_r)
inform user about a problem
Definition: TargetCallbackReceiver.cc:149
zypp::target::RpmRemovePackageReceiver::start
virtual void start(const std::string &name)
Start the operation.
Definition: TargetCallbackReceiver.cc:132
zypp::target::rpm::RpmInstallReport::problem
virtual Action problem(Exception &excpt_r)
Definition: RpmCallbacks.h:97
zypp::target::rpm::InstallResolvableReport::Action
Action
Definition: ZYppCallbacks.h:518
zypp::target::RpmRemovePackageReceiver::_finishInfo
std::string _finishInfo
Definition: TargetCallbackReceiver.h:75
zypp::target::RpmInstallPackageReceiver::_level
target::rpm::InstallResolvableReport::RpmLevel _level
Definition: TargetCallbackReceiver.h:30
zypp::target::RpmInstallPackageReceiver::_resolvable
Resolvable::constPtr _resolvable
Definition: TargetCallbackReceiver.h:29
zypp::target::RpmInstallPackageReceiver::~RpmInstallPackageReceiver
virtual ~RpmInstallPackageReceiver()
Definition: TargetCallbackReceiver.cc:33
zypp::target::rpm::RpmRemoveReport::ABORT
Definition: RpmCallbacks.h:37