Deprecate MediaAccess::downloads (accidentally deleted)
[platform/upstream/libzypp.git] / zypp / HistoryLogData.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9
10 /** \file zypp/HistoryLogData.h
11  *
12  */
13 #ifndef ZYPP_HISTORYLOGDATA_H_
14 #define ZYPP_HISTORYLOGDATA_H_
15
16 #include <iosfwd>
17
18 #include "zypp/Date.h"
19 #include "zypp/Edition.h"
20 #include "zypp/Arch.h"
21 #include "zypp/CheckSum.h"
22 #include "zypp/Url.h"
23
24 #define HISTORY_LOG_DATE_FORMAT "%Y-%m-%d %H:%M:%S"
25
26 namespace zypp
27 {
28
29
30   ///////////////////////////////////////////////////////////////////
31   //
32   //  CLASS NAME : HistoryActionID
33   //
34   /**
35    * Enumeration of known history actions.
36    *
37    * \ingroup g_EnumerationClass
38    */
39   struct HistoryActionID
40   {
41     static const HistoryActionID NONE;
42
43     static const HistoryActionID INSTALL;
44     static const HistoryActionID REMOVE;
45     static const HistoryActionID REPO_ADD;
46     static const HistoryActionID REPO_REMOVE;
47     static const HistoryActionID REPO_CHANGE_ALIAS;
48     static const HistoryActionID REPO_CHANGE_URL;
49
50     enum ID
51     {
52       NONE_e,
53
54       INSTALL_e,
55       REMOVE_e,
56       REPO_ADD_e,
57       REPO_REMOVE_e,
58       REPO_CHANGE_ALIAS_e,
59       REPO_CHANGE_URL_e
60     };
61
62     HistoryActionID() : _id(NONE_e) {}
63
64     HistoryActionID(ID id) : _id(id) {}
65
66     explicit HistoryActionID(const std::string & strval_r);
67
68     ID toEnum() const { return _id; }
69
70     static HistoryActionID::ID parse(const std::string & strval_r);
71
72     const std::string & asString(bool pad = false) const;
73
74     private:
75     ID _id;
76   };
77
78   /** \relates HistoryActionID */
79   std::ostream & operator << (std::ostream & str, const HistoryActionID & id);
80   ///////////////////////////////////////////////////////////////////
81
82
83   /////////////////////////////////////////////////////////////////////
84   //
85   // CLASS NAME: HistoryItem
86   //
87   class HistoryItem
88   {
89   public:
90     typedef shared_ptr<HistoryItem> Ptr;
91     typedef std::vector<std::string> FieldVector;
92
93   public:
94     HistoryItem(FieldVector & fields);
95     virtual ~HistoryItem()
96     {}
97
98     virtual void dumpTo(std::ostream & str) const;
99
100   public:
101     Date date;
102     HistoryActionID action;
103   };
104   /////////////////////////////////////////////////////////////////////
105
106
107   /////////////////////////////////////////////////////////////////////
108   //
109   // CLASS NAME: HistoryItemInstall
110   //
111   class HistoryItemInstall : public HistoryItem
112   {
113   public:
114     typedef shared_ptr<HistoryItemInstall> Ptr;
115
116     HistoryItemInstall(FieldVector & fields);
117     virtual ~HistoryItemInstall()
118     {}
119
120     virtual void dumpTo(std::ostream & str) const;
121
122   public:
123     std::string   name;
124     Edition       edition;
125     Arch          arch;
126     std::string   reqby; // TODO make this a class ReqBy
127     std::string   repoalias;
128     CheckSum      checksum;
129   };
130   /////////////////////////////////////////////////////////////////////
131
132
133   /////////////////////////////////////////////////////////////////////
134   //
135   // CLASS NAME: HistoryItemRemove
136   //
137   class HistoryItemRemove : public HistoryItem
138   {
139   public:
140     typedef shared_ptr<HistoryItemRemove> Ptr;
141
142     HistoryItemRemove(FieldVector & fields);
143     virtual ~HistoryItemRemove()
144     {}
145
146     virtual void dumpTo(std::ostream & str)  const;
147
148   public:
149     std::string name;
150     Edition     edition;
151     Arch        arch;
152     std::string reqby;
153   };
154   /////////////////////////////////////////////////////////////////////
155
156
157   /////////////////////////////////////////////////////////////////////
158   //
159   // CLASS NAME: HistoryItemRepoAdd
160   //
161   class HistoryItemRepoAdd : public HistoryItem
162   {
163   public:
164     typedef shared_ptr<HistoryItemRepoAdd> Ptr;
165
166     HistoryItemRepoAdd(FieldVector & fields);
167     virtual ~HistoryItemRepoAdd()
168     {}
169
170     virtual void dumpTo(std::ostream & str) const;
171
172   public:
173     std::string alias;
174     Url         url;
175   };
176   /////////////////////////////////////////////////////////////////////
177
178
179   /////////////////////////////////////////////////////////////////////
180   //
181   // CLASS NAME: HistoryItemRepoRemove
182   //
183   class HistoryItemRepoRemove : public HistoryItem
184   {
185   public:
186     typedef shared_ptr<HistoryItemRepoRemove> Ptr;
187
188     HistoryItemRepoRemove(FieldVector & fields);
189     virtual ~HistoryItemRepoRemove()
190     {}
191
192     virtual void dumpTo(std::ostream & str) const;
193
194   public:
195     std::string alias;
196   };
197   /////////////////////////////////////////////////////////////////////
198
199
200   /////////////////////////////////////////////////////////////////////
201   //
202   // CLASS NAME: HistoryItemRepoAliasChange
203   //
204   class HistoryItemRepoAliasChange : public HistoryItem
205   {
206   public:
207     typedef shared_ptr<HistoryItemRepoAliasChange> Ptr;
208
209     HistoryItemRepoAliasChange(FieldVector & fields);
210     virtual ~HistoryItemRepoAliasChange()
211     {}
212
213     virtual void dumpTo(std::ostream & str) const;
214
215   public:
216     std::string oldalias;
217     std::string newalias;
218   };
219   /////////////////////////////////////////////////////////////////////
220
221
222   /////////////////////////////////////////////////////////////////////
223   //
224   // CLASS NAME: HistoryItemRepoUrlChange
225   //
226   class HistoryItemRepoUrlChange : public HistoryItem
227   {
228   public:
229     typedef shared_ptr<HistoryItemRepoUrlChange> Ptr;
230
231     HistoryItemRepoUrlChange(FieldVector & fields);
232     virtual ~HistoryItemRepoUrlChange()
233     {}
234
235     virtual void dumpTo(std::ostream & str) const;
236
237   public:
238     std::string alias;
239     Url newurl;
240   };
241   /////////////////////////////////////////////////////////////////////
242
243   std::ostream & operator<<(std::ostream & str, const HistoryItem & obj);
244
245 }
246
247 #endif /* ZYPP_HISTORYLOGDATA_H_ */