00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_ZYPPCALLBACKS_H
00013 #define ZYPP_ZYPPCALLBACKS_H
00014
00015 #include "zypp/Callback.h"
00016 #include "zypp/Resolvable.h"
00017 #include "zypp/Source.h"
00018 #include "zypp/Pathname.h"
00019 #include "zypp/Message.h"
00020 #include "zypp/Url.h"
00021
00023 namespace zypp
00024 {
00025 namespace source
00026 {
00027
00028 struct DownloadResolvableReport : public callback::ReportBase
00029 {
00030 enum Action {
00031 ABORT,
00032 RETRY,
00033 IGNORE,
00034 };
00035
00036 enum Error {
00037 NO_ERROR,
00038 NOT_FOUND,
00039 IO,
00040 INVALID
00041 };
00042
00043 virtual void start(
00044 Resolvable::constPtr resolvable_ptr
00045 , Url url
00046 ) {}
00047
00048
00049 virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
00050 { return true; }
00051
00052 virtual Action problem(
00053 Resolvable::constPtr resolvable_ptr
00054 , Error error
00055 , std::string description
00056 ) { return ABORT; }
00057
00058 virtual void finish(Resolvable::constPtr resolvable_ptr
00059 , Error error
00060 , std::string reason
00061 ) {}
00062 };
00063
00064
00065
00066 struct DownloadFileReport : public callback::ReportBase
00067 {
00068 enum Action {
00069 ABORT,
00070 RETRY
00071 };
00072
00073 enum Error {
00074 NO_ERROR,
00075 NOT_FOUND,
00076 IO,
00077 INVALID
00078 };
00079 virtual void start(
00080 Source_Ref source
00081 , Url url
00082 ) {}
00083
00084 virtual bool progress(int value, Url url)
00085 { return true; }
00086
00087 virtual Action problem(
00088 Url url
00089 , Error error
00090 , std::string description
00091 ) { return ABORT; }
00092
00093 virtual void finish(
00094 Url url
00095 , Error error
00096 , std::string reason
00097 ) {}
00098 };
00099
00100
00101 struct RefreshSourceReport : public callback::ReportBase
00102 {
00103 enum Action {
00104 ABORT,
00105 RETRY,
00106 IGNORE
00107 };
00108
00109 enum Error {
00110 NO_ERROR,
00111 NOT_FOUND,
00112 IO,
00113 INVALID
00114 };
00115 virtual void start(
00116 Source_Ref source
00117 , Url url
00118 ) {}
00119
00120 virtual bool progress(int value, Source_Ref source)
00121 { return true; }
00122
00123 virtual Action problem(
00124 Source_Ref source
00125 , Error error
00126 , std::string description
00127 ) { return ABORT; }
00128
00129 virtual void finish(
00130 Source_Ref source
00131 , Error error
00132 , std::string reason
00133 ) {}
00134 };
00135
00136
00137 struct CreateSourceReport : public callback::ReportBase
00138 {
00139 enum Action {
00140 ABORT,
00141 RETRY
00142 };
00143
00144 enum Error {
00145 NO_ERROR,
00146 NOT_FOUND,
00147 IO,
00148 INVALID
00149 };
00150
00151 virtual void startData(
00152 Url source_url
00153 ) {}
00154
00155 virtual void startProbe(Url url) {}
00156
00157 virtual void endProbe(Url url) {}
00158
00159 virtual bool progressData(int value, Url url)
00160 { return true; }
00161
00162 virtual Action problem(
00163 Url url
00164 , Error error
00165 , std::string description
00166 ) { return ABORT; }
00167
00168 virtual void finishData(
00169 Url url
00170 , Error error
00171 , std::string reason
00172 ) {}
00173 };
00174
00176 }
00178
00180 namespace media
00181 {
00182
00183 struct MediaChangeReport : public callback::ReportBase
00184 {
00185 enum Action {
00186 ABORT,
00187 RETRY,
00188 IGNORE,
00189 IGNORE_ID,
00190 CHANGE_URL,
00191 EJECT
00192 };
00193
00194 enum Error {
00195 NO_ERROR,
00196 NOT_FOUND,
00197 IO,
00198 INVALID,
00199 WRONG
00200 };
00201
00202 virtual Action requestMedia(
00203 const Source_Ref source
00204 , unsigned mediumNr
00205 , Error error
00206 , std::string description
00207 ) { return ABORT; }
00208 };
00209
00210
00211 struct DownloadProgressReport : public callback::ReportBase
00212 {
00213 enum Action {
00214 ABORT,
00215 RETRY,
00216 IGNORE
00217 };
00218
00219 enum Error {
00220 NO_ERROR,
00221 NOT_FOUND,
00222 IO
00223 };
00224
00225 virtual void start( Url file, Pathname localfile ) {}
00226
00227 virtual bool progress(int value, Url file)
00228 { return true; }
00229
00230 virtual Action problem(
00231 Url file
00232 , Error error
00233 , std::string description
00234 ) { return ABORT; }
00235
00236 virtual void finish(
00237 Url file
00238 , Error error
00239 , std::string reason
00240 ) {}
00241 };
00242
00244 }
00246
00248 namespace target
00249 {
00250
00251
00252 struct MessageResolvableReport : public callback::ReportBase
00253 {
00254 virtual void show(
00255 Message::constPtr message
00256 ) {}
00257 };
00258
00260 namespace rpm
00261 {
00262
00263
00264 struct InstallResolvableReport : public callback::ReportBase
00265 {
00266 enum Action {
00267 ABORT,
00268 RETRY,
00269 IGNORE
00270 };
00271
00272 enum Error {
00273 NO_ERROR,
00274 NOT_FOUND,
00275 IO,
00276 INVALID
00277 };
00278
00279
00280 enum RpmLevel {
00281 RPM,
00282 RPM_NODEPS,
00283 RPM_NODEPS_FORCE
00284 };
00285
00286 virtual void start(
00287 Resolvable::constPtr resolvable
00288 ) {}
00289
00290 virtual bool progress(int value, Resolvable::constPtr resolvable)
00291 { return true; }
00292
00293 virtual Action problem(
00294 Resolvable::constPtr resolvable
00295 , Error error
00296 , std::string description
00297 , RpmLevel level
00298 ) { return ABORT; }
00299
00300 virtual void finish(
00301 Resolvable::constPtr resolvable
00302 , Error error
00303 , std::string reason
00304 , RpmLevel level
00305 ) {}
00306 };
00307
00308
00309 struct RemoveResolvableReport : public callback::ReportBase
00310 {
00311 enum Action {
00312 ABORT,
00313 RETRY,
00314 IGNORE
00315 };
00316
00317 enum Error {
00318 NO_ERROR,
00319 NOT_FOUND,
00320 IO,
00321 INVALID
00322 };
00323
00324 virtual void start(
00325 Resolvable::constPtr resolvable
00326 ) {}
00327
00328 virtual bool progress(int value, Resolvable::constPtr resolvable)
00329 { return true; }
00330
00331 virtual Action problem(
00332 Resolvable::constPtr resolvable
00333 , Error error
00334 , std::string description
00335 ) { return ABORT; }
00336
00337 virtual void finish(
00338 Resolvable::constPtr resolvable
00339 , Error error
00340 , std::string reason
00341 ) {}
00342 };
00343
00344
00345 struct RebuildDBReport : public callback::ReportBase
00346 {
00347 enum Action {
00348 ABORT,
00349 RETRY,
00350 IGNORE
00351 };
00352
00353 enum Error {
00354 NO_ERROR,
00355 FAILED
00356 };
00357
00358 virtual void start(Pathname path) {}
00359
00360 virtual bool progress(int value, Pathname path)
00361 { return true; }
00362
00363 virtual Action problem(
00364 Pathname path
00365 , Error error
00366 , std::string description
00367 ) { return ABORT; }
00368
00369 virtual void finish(
00370 Pathname path
00371 , Error error
00372 , std::string reason
00373 ) {}
00374 };
00375
00376
00377 struct ConvertDBReport : public callback::ReportBase
00378 {
00379 enum Action {
00380 ABORT,
00381 RETRY,
00382 IGNORE
00383 };
00384
00385 enum Error {
00386 NO_ERROR,
00387 FAILED
00388 };
00389
00390 virtual void start(
00391 Pathname path
00392 ) {}
00393
00394 virtual bool progress(int value, Pathname path)
00395 { return true; }
00396
00397 virtual Action problem(
00398 Pathname path
00399 , Error error
00400 , std::string description
00401 ) { return ABORT; }
00402
00403 virtual void finish(
00404 Pathname path
00405 , Error error
00406 , std::string reason
00407 ) {}
00408 };
00409
00410
00411 struct ScanDBReport : public callback::ReportBase
00412 {
00413 enum Action {
00414 ABORT,
00415 RETRY,
00416 IGNORE
00417 };
00418
00419 enum Error {
00420 NO_ERROR,
00421 FAILED
00422 };
00423
00424 virtual void start(
00425 ) {}
00426
00427 virtual bool progress(int value)
00428 { return true; }
00429
00430 virtual Action problem(
00431 Error error
00432 , std::string description
00433 ) { return ABORT; }
00434
00435 virtual void finish(
00436 Error error
00437 , std::string reason
00438 ) {}
00439 };
00440
00442 }
00444
00446 }
00448
00450 }
00452
00453 #endif // ZYPP_ZYPPCALLBACKS_H