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"
28 ///////////////////////////////////////////////////////////////////
29 /// \class HistoryActionID
30 /// \brief Enumeration of known history actions.
31 /// \ingroup g_EnumerationClass
32 /// \ingroup g_ZyppHistory
33 ///////////////////////////////////////////////////////////////////
34 struct HistoryActionID
36 static const HistoryActionID NONE;
38 static const HistoryActionID INSTALL;
39 static const HistoryActionID REMOVE;
40 static const HistoryActionID REPO_ADD;
41 static const HistoryActionID REPO_REMOVE;
42 static const HistoryActionID REPO_CHANGE_ALIAS;
43 static const HistoryActionID REPO_CHANGE_URL;
57 HistoryActionID() : _id(NONE_e) {}
59 HistoryActionID(ID id) : _id(id) {}
61 explicit HistoryActionID(const std::string & strval_r);
63 ID toEnum() const { return _id; }
65 static HistoryActionID::ID parse(const std::string & strval_r);
67 const std::string & asString(bool pad = false) const;
73 /** \relates HistoryActionID */
74 std::ostream & operator << (std::ostream & str, const HistoryActionID & id);
75 ///////////////////////////////////////////////////////////////////
78 /////////////////////////////////////////////////////////////////////
80 // CLASS NAME: HistoryItem
85 typedef shared_ptr<HistoryItem> Ptr;
86 typedef std::vector<std::string> FieldVector;
89 HistoryItem(FieldVector & fields);
90 virtual ~HistoryItem()
93 virtual void dumpTo(std::ostream & str) const;
97 HistoryActionID action;
99 /////////////////////////////////////////////////////////////////////
102 /////////////////////////////////////////////////////////////////////
104 // CLASS NAME: HistoryItemInstall
106 class HistoryItemInstall : public HistoryItem
109 typedef shared_ptr<HistoryItemInstall> Ptr;
111 HistoryItemInstall(FieldVector & fields);
112 virtual ~HistoryItemInstall()
115 virtual void dumpTo(std::ostream & str) const;
121 std::string reqby; // TODO make this a class ReqBy
122 std::string repoalias;
125 /////////////////////////////////////////////////////////////////////
128 /////////////////////////////////////////////////////////////////////
130 // CLASS NAME: HistoryItemRemove
132 class HistoryItemRemove : public HistoryItem
135 typedef shared_ptr<HistoryItemRemove> Ptr;
137 HistoryItemRemove(FieldVector & fields);
138 virtual ~HistoryItemRemove()
141 virtual void dumpTo(std::ostream & str) const;
149 /////////////////////////////////////////////////////////////////////
152 /////////////////////////////////////////////////////////////////////
154 // CLASS NAME: HistoryItemRepoAdd
156 class HistoryItemRepoAdd : public HistoryItem
159 typedef shared_ptr<HistoryItemRepoAdd> Ptr;
161 HistoryItemRepoAdd(FieldVector & fields);
162 virtual ~HistoryItemRepoAdd()
165 virtual void dumpTo(std::ostream & str) const;
171 /////////////////////////////////////////////////////////////////////
174 /////////////////////////////////////////////////////////////////////
176 // CLASS NAME: HistoryItemRepoRemove
178 class HistoryItemRepoRemove : public HistoryItem
181 typedef shared_ptr<HistoryItemRepoRemove> Ptr;
183 HistoryItemRepoRemove(FieldVector & fields);
184 virtual ~HistoryItemRepoRemove()
187 virtual void dumpTo(std::ostream & str) const;
192 /////////////////////////////////////////////////////////////////////
195 /////////////////////////////////////////////////////////////////////
197 // CLASS NAME: HistoryItemRepoAliasChange
199 class HistoryItemRepoAliasChange : public HistoryItem
202 typedef shared_ptr<HistoryItemRepoAliasChange> Ptr;
204 HistoryItemRepoAliasChange(FieldVector & fields);
205 virtual ~HistoryItemRepoAliasChange()
208 virtual void dumpTo(std::ostream & str) const;
211 std::string oldalias;
212 std::string newalias;
214 /////////////////////////////////////////////////////////////////////
217 /////////////////////////////////////////////////////////////////////
219 // CLASS NAME: HistoryItemRepoUrlChange
221 class HistoryItemRepoUrlChange : public HistoryItem
224 typedef shared_ptr<HistoryItemRepoUrlChange> Ptr;
226 HistoryItemRepoUrlChange(FieldVector & fields);
227 virtual ~HistoryItemRepoUrlChange()
230 virtual void dumpTo(std::ostream & str) const;
236 /////////////////////////////////////////////////////////////////////
238 std::ostream & operator<<(std::ostream & str, const HistoryItem & obj);
242 #endif /* ZYPP_HISTORYLOGDATA_H_ */