first draft of the provided callbacks
[platform/upstream/libzypp.git] / zypp / ZYppCallbacks.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Source.h
10  *
11 */
12 #ifndef ZYPP_ZYPPCALLBACKS_H
13 #define ZYPP_ZYPPCALLBACKS_H
14
15 #include <iosfwd>
16 #include <string>
17
18 #include "zypp/Callback.h"
19
20 ///////////////////////////////////////////////////////////////////
21 namespace zypp
22 { /////////////////////////////////////////////////////////////////
23   namespace source
24   {
25     // progress for downloading a resolvable
26     struct DownloadResolvableReport : public callback::ReportBase
27     {
28       virtual void start() {}
29       virtual void progress(int value) {]
30       virtual void finish() {}
31     };
32     
33     // progress for downloading a specific file
34     struct DownloadFileReport : public callback::ReportBase
35     {
36       virtual void start() {}
37       virtual void progress(int value) {]
38       virtual void finish() {}
39     };
40
41     // progress for refreshing a source data
42     struct RefreshSourceReport : public callback::ReportBase
43     {
44       virtual void start() {}
45       virtual void progress(int value) {]
46       virtual void finish() {}
47     };
48
49     // progress for downloading a resolvable
50     struct CreateSourceReport : public callback::ReportBase
51     {
52       virtual void start() {}
53       virtual void progress(int value) {]
54       virtual void finish() {}
55     };
56     
57     // progress for downloading a resolvable
58     struct RefreshSourceReport : public callback::ReportBase
59     {
60       virtual void start() {}
61       virtual void progress(int value) {]
62       virtual void finish() {}
63     };
64     
65     /////////////////////////////////////////////////////////////////
66   } // namespace source
67   ///////////////////////////////////////////////////////////////////
68   
69   ///////////////////////////////////////////////////////////////////
70   namespace media 
71   { 
72
73     // media change request callback
74     struct MediaChangeReport : public callback::ReportBase
75     {
76       enum Action { 
77         ABORT,  // abort and return error
78         RETRY   // retry
79       }; 
80
81       virtual Action userAction() { return ABORT; }
82     };
83
84     /////////////////////////////////////////////////////////////////
85   } // namespace media
86   ///////////////////////////////////////////////////////////////////
87
88   ///////////////////////////////////////////////////////////////////
89   namespace target 
90   { ///////////////////////////////////////////////////////////////////
91     namespace rpm 
92     { 
93
94       // progress for installing a resolvable
95       struct InstallResolvableReport : public callback::ReportBase
96       {
97         enum Action { 
98           ABORT,  // abort and return error
99           RETRY,  // retry
100           IGNORE  // ignore
101         }; 
102
103         virtual void start() {}
104         virtual void progress(int value) {]
105         virtual Action error () { return ABORT; }
106         virtual void finish() {}
107       };
108     
109       // progress for removing a resolvable
110       struct RemoveResolvableReport : public callback::ReportBase
111       {
112         enum Action { 
113           ABORT,  // abort and return error
114           RETRY,  // retry
115           IGNORE  // ignore
116         }; 
117
118         virtual void start() {}
119         virtual void progress(int value) {]
120         virtual Action error () { return ABORT; }
121         virtual void finish() {}
122       };
123     
124       // progress for rebuilding the database
125       struct RebuildDBReport : public callback::ReportBase
126       {
127         virtual void start() {}
128         virtual void progress(int value) {]
129         virtual void finish() {}
130       };
131
132       // progress for converting the database
133       struct ConvertDBReport : public callback::ReportBase
134       {
135         virtual void start() {}
136         virtual void progress(int value) {]
137         virtual void finish() {}
138       };
139
140       /////////////////////////////////////////////////////////////////
141     } // namespace rpm
142     ///////////////////////////////////////////////////////////////////
143
144     /////////////////////////////////////////////////////////////////
145   } // namespace target
146   ///////////////////////////////////////////////////////////////////
147
148   /////////////////////////////////////////////////////////////////
149 } // namespace zypp
150 ///////////////////////////////////////////////////////////////////
151
152 #endif // ZYPP_ZYPPCALLBACKS_H