1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
10 /** \file zypp/HistoryLogData.h
13 #ifndef ZYPP_HISTORYLOGDATA_H_
14 #define ZYPP_HISTORYLOGDATA_H_
18 #include "zypp/Date.h"
19 #include "zypp/Edition.h"
20 #include "zypp/Arch.h"
21 #include "zypp/CheckSum.h"
24 #define HISTORY_LOG_DATE_FORMAT "%Y-%m-%d %H:%M:%S"
30 ///////////////////////////////////////////////////////////////////
32 // CLASS NAME : HistoryActionID
35 * Enumeration of known history actions.
37 * \ingroup g_EnumerationClass
39 struct HistoryActionID
41 static const HistoryActionID NONE;
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;
62 HistoryActionID() : _id(NONE_e) {}
64 HistoryActionID(ID id) : _id(id) {}
66 explicit HistoryActionID(const std::string & strval_r);
68 ID toEnum() const { return _id; }
70 static HistoryActionID::ID parse(const std::string & strval_r);
72 const std::string & asString(bool pad = false) const;
78 /** \relates HistoryActionID */
79 std::ostream & operator << (std::ostream & str, const HistoryActionID & id);
80 ///////////////////////////////////////////////////////////////////
83 /////////////////////////////////////////////////////////////////////
85 // CLASS NAME: HistoryItem
90 typedef shared_ptr<HistoryItem> Ptr;
91 typedef std::vector<std::string> FieldVector;
94 HistoryItem(FieldVector & fields);
95 virtual ~HistoryItem()
98 virtual void dumpTo(std::ostream & str) const;
102 HistoryActionID action;
104 /////////////////////////////////////////////////////////////////////
107 /////////////////////////////////////////////////////////////////////
109 // CLASS NAME: HistoryItemInstall
111 class HistoryItemInstall : public HistoryItem
114 typedef shared_ptr<HistoryItemInstall> Ptr;
116 HistoryItemInstall(FieldVector & fields);
117 virtual ~HistoryItemInstall()
120 virtual void dumpTo(std::ostream & str) const;
126 std::string reqby; // TODO make this a class ReqBy
127 std::string repoalias;
130 /////////////////////////////////////////////////////////////////////
133 /////////////////////////////////////////////////////////////////////
135 // CLASS NAME: HistoryItemRemove
137 class HistoryItemRemove : public HistoryItem
140 typedef shared_ptr<HistoryItemRemove> Ptr;
142 HistoryItemRemove(FieldVector & fields);
143 virtual ~HistoryItemRemove()
146 virtual void dumpTo(std::ostream & str) const;
154 /////////////////////////////////////////////////////////////////////
157 /////////////////////////////////////////////////////////////////////
159 // CLASS NAME: HistoryItemRepoAdd
161 class HistoryItemRepoAdd : public HistoryItem
164 typedef shared_ptr<HistoryItemRepoAdd> Ptr;
166 HistoryItemRepoAdd(FieldVector & fields);
167 virtual ~HistoryItemRepoAdd()
170 virtual void dumpTo(std::ostream & str) const;
176 /////////////////////////////////////////////////////////////////////
179 /////////////////////////////////////////////////////////////////////
181 // CLASS NAME: HistoryItemRepoRemove
183 class HistoryItemRepoRemove : public HistoryItem
186 typedef shared_ptr<HistoryItemRepoRemove> Ptr;
188 HistoryItemRepoRemove(FieldVector & fields);
189 virtual ~HistoryItemRepoRemove()
192 virtual void dumpTo(std::ostream & str) const;
197 /////////////////////////////////////////////////////////////////////
200 /////////////////////////////////////////////////////////////////////
202 // CLASS NAME: HistoryItemRepoAliasChange
204 class HistoryItemRepoAliasChange : public HistoryItem
207 typedef shared_ptr<HistoryItemRepoAliasChange> Ptr;
209 HistoryItemRepoAliasChange(FieldVector & fields);
210 virtual ~HistoryItemRepoAliasChange()
213 virtual void dumpTo(std::ostream & str) const;
216 std::string oldalias;
217 std::string newalias;
219 /////////////////////////////////////////////////////////////////////
222 /////////////////////////////////////////////////////////////////////
224 // CLASS NAME: HistoryItemRepoUrlChange
226 class HistoryItemRepoUrlChange : public HistoryItem
229 typedef shared_ptr<HistoryItemRepoUrlChange> Ptr;
231 HistoryItemRepoUrlChange(FieldVector & fields);
232 virtual ~HistoryItemRepoUrlChange()
235 virtual void dumpTo(std::ostream & str) const;
241 /////////////////////////////////////////////////////////////////////
243 std::ostream & operator<<(std::ostream & str, const HistoryItem & obj);
247 #endif /* ZYPP_HISTORYLOGDATA_H_ */