libzypp  13.10.6
HistoryLogData.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 
13 #ifndef ZYPP_HISTORYLOGDATA_H_
14 #define ZYPP_HISTORYLOGDATA_H_
15 
16 #include <iosfwd>
17 
18 #include "zypp/APIConfig.h"
19 #include "zypp/Date.h"
20 #include "zypp/Edition.h"
21 #include "zypp/Arch.h"
22 #include "zypp/CheckSum.h"
23 #include "zypp/Url.h"
24 
25 #define HISTORY_LOG_DATE_FORMAT "%Y-%m-%d %H:%M:%S"
26 
28 namespace zypp
29 {
37  {
38  static const HistoryActionID NONE;
39 
40  static const HistoryActionID INSTALL;
41  static const HistoryActionID REMOVE;
42  static const HistoryActionID REPO_ADD;
46 
47  enum ID
48  {
50 
57  };
58 
60 
61  HistoryActionID(ID id) : _id(id) {}
62 
63  explicit HistoryActionID(const std::string & strval_r);
64 
65  ID toEnum() const { return _id; }
66 
67  static HistoryActionID::ID parse(const std::string & strval_r);
68 
69  const std::string & asString(bool pad = false) const;
70 
71  private:
73  };
74 
76  inline bool operator==( const HistoryActionID & lhs, const HistoryActionID & rhs )
77  { return lhs.toEnum() == rhs.toEnum(); }
78 
80  inline bool operator!=( const HistoryActionID & lhs, const HistoryActionID & rhs )
81  { return lhs.toEnum() != rhs.toEnum(); }
82 
84  std::ostream & operator << (std::ostream & str, const HistoryActionID & id);
86 
101  {
102  public:
103  typedef shared_ptr<HistoryLogData> Ptr;
104  typedef shared_ptr<const HistoryLogData> constPtr;
105 
106  typedef std::vector<std::string> FieldVector;
108  typedef FieldVector::const_iterator const_iterator;
109 
110  public:
115  explicit HistoryLogData( FieldVector & fields_r, size_type expect_r = 2 );
116 
121  HistoryLogData( FieldVector & fields_r, HistoryActionID action_r, size_type expect_r = 2 );
122 
124  virtual ~HistoryLogData();
125 
136  static Ptr create( FieldVector & fields_r );
137 
138  public:
140  bool empty() const;
141 
143  size_type size() const;
144 
146  const_iterator begin() const;
147 
149  const_iterator end() const;
150 
155  const std::string & optionalAt( size_type idx_r ) const;
157  const std::string & operator[]( size_type idx_r ) const
158  { return optionalAt( idx_r ); }
159 
164  const std::string & at( size_type idx_r ) const;
165 
166  public:
167  enum Index
168  {
171  };
172 
173  public:
174  Date date() const;
175  HistoryActionID action() const;
176 
177  public:
178  class Impl;
179  private:
181  protected:
183  };
184 
186  std::ostream & operator<<( std::ostream & str, const HistoryLogData & obj );
188 
195  {
196  public:
197  typedef shared_ptr<HistoryLogDataInstall> Ptr;
198  typedef shared_ptr<const HistoryLogDataInstall> constPtr;
202  HistoryLogDataInstall( FieldVector & fields_r );
203 
204  public:
205  enum Index
206  {
216  };
217 
218  public:
219  std::string name() const;
220  Edition edition() const;
221  Arch arch() const;
222  std::string reqby() const;
223  std::string repoAlias() const;
224  CheckSum checksum() const;
225  std::string userdata() const;
226  };
227 
234  {
235  public:
236  typedef shared_ptr<HistoryLogDataRemove> Ptr;
237  typedef shared_ptr<const HistoryLogDataRemove> constPtr;
241  HistoryLogDataRemove( FieldVector & fields_r );
242 
243  public:
244  enum Index
245  {
253  };
254 
255  public:
256  std::string name() const;
257  Edition edition() const;
258  Arch arch() const;
259  std::string reqby() const;
260  std::string userdata() const;
261  };
262 
269  {
270  public:
271  typedef shared_ptr<HistoryLogDataRepoAdd> Ptr;
272  typedef shared_ptr<const HistoryLogDataRepoAdd> constPtr;
276  HistoryLogDataRepoAdd( FieldVector & fields_r );
277 
278  public:
279  enum Index
280  {
286  };
287 
288  public:
289  std::string alias() const;
290  Url url() const;
291  std::string userdata() const;
292  };
293 
300  {
301  public:
302  typedef shared_ptr<HistoryLogDataRepoRemove> Ptr;
303  typedef shared_ptr<const HistoryLogDataRepoRemove> constPtr;
308 
309  public:
310  enum Index
311  {
316  };
317 
318  public:
319  std::string alias() const;
320  std::string userdata() const;
321  };
322 
329  {
330  public:
331  typedef shared_ptr<HistoryLogDataRepoAliasChange> Ptr;
332  typedef shared_ptr<const HistoryLogDataRepoAliasChange> constPtr;
337 
338  public:
339  enum Index
340  {
346  };
347 
348  public:
349  std::string oldAlias() const;
350  std::string newAlias() const;
351  std::string userdata() const;
352  };
353 
360  {
361  public:
362  typedef shared_ptr<HistoryLogDataRepoUrlChange> Ptr;
363  typedef shared_ptr<const HistoryLogDataRepoUrlChange> constPtr;
368 
369  public:
370  enum Index
371  {
377  };
378 
379  public:
380  std::string alias() const;
381  Url newUrl() const;
382  std::string userdata() const;
383  };
384 
385 } // namespace zypp
387 #endif /* ZYPP_HISTORYLOGDATA_H_ */
bool operator!=(const HistoryActionID &lhs, const HistoryActionID &rhs)
repository providing the package
std::string alias() const
repository alias
std::vector< std::string > FieldVector
std::string reqby() const
requested by (user, pid:appname, or empty (solver))
std::string userdata() const
userdata/transactionID
Architecture.
Definition: Arch.h:36
std::string reqby() const
requested by (user, pid:appname, or empty (solver))
shared_ptr< const HistoryLogDataRepoAdd > constPtr
const_iterator begin() const
Iterator pointing to 1st element in vector (or end()).
FieldVector::size_type size_type
Date date() const
date
HistoryLogDataRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
bool empty() const
Whether FieldVector is empty.
std::string repoAlias() const
repository providing the package
HistoryLogData(FieldVector &fields_r, size_type expect_r=2)
Ctor moving FieldVector (via swap).
CheckSum checksum() const
package checksum
static const HistoryActionID REMOVE
std::string alias() const
repository alias
static const HistoryActionID NONE
Url newUrl() const
repositories new url
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
RWCOW_pointer< Impl > _pimpl
Implementation class.
Index
&lt; indices of known fields
A zypp history log line for a removed packge.
Arch arch() const
package architecture
std::string oldAlias() const
repositories old alias
static const HistoryActionID REPO_CHANGE_ALIAS
Url url() const
repository url
Arch arch() const
package architecture
static const HistoryActionID INSTALL
size_type size() const
Number of fields in vector.
HistoryLogDataRepoAliasChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
const_iterator end() const
Iterator pointing behind the last element in vector.
virtual ~HistoryLogData()
Dtor.
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoAdd(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
FieldVector::const_iterator const_iterator
Store and operate on date (time_t).
Definition: Date.h:31
A zypp history log line for an installed packaged.
requested by (user, pid:appname, or empty (solver))
shared_ptr< HistoryLogDataInstall > Ptr
shared_ptr< const HistoryLogDataRepoAliasChange > constPtr
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
shared_ptr< HistoryLogDataRepoAdd > Ptr
const std::string & operator[](size_type idx_r) const
A zypp history log line for a repo url change.
const std::string & asString(bool pad=false) const
std::string name() const
package name
Provides API related macros.
HistoryActionID action() const
HistoryActionID (or NONE_e if unknown)
static const HistoryActionID REPO_REMOVE
HistoryLogDataInstall(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
static const HistoryActionID REPO_CHANGE_URL
std::string userdata() const
userdata/transactionID
shared_ptr< HistoryLogDataRemove > Ptr
Edition edition() const
package edition
A zypp history log line for a removed repository.
static Ptr create(FieldVector &fields_r)
Factory method creating HistoryLogData classes.
SolvableIdType size_type
Definition: PoolMember.h:99
const std::string & optionalAt(size_type idx_r) const
Access (optional) field by number.
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoUrlChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
shared_ptr< const HistoryLogDataRepoUrlChange > constPtr
shared_ptr< HistoryLogDataRepoAliasChange > Ptr
shared_ptr< HistoryLogDataRepoUrlChange > Ptr
A zypp history log line split into fieldsEach valid history log line starts with a date and HistoryAc...
static HistoryActionID::ID parse(const std::string &strval_r)
std::string alias() const
repository alias
requested by (user, pid:appname, or empty (solver))
A zypp history log line for a repo alias change.
std::string newAlias() const
repositories new alias
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
static const HistoryActionID REPO_ADD
std::string name() const
package name
std::string userdata() const
userdata/transactionID
shared_ptr< const HistoryLogDataInstall > constPtr
const std::string & at(size_type idx_r) const
Access (required) field by number.
Edition edition() const
package edition
A zypp history log line for an added repository.
Enumeration of known history actions.
shared_ptr< const HistoryLogDataRepoRemove > constPtr
bool operator==(const HistoryActionID &lhs, const HistoryActionID &rhs)
shared_ptr< HistoryLogData > Ptr
shared_ptr< const HistoryLogDataRemove > constPtr
shared_ptr< const HistoryLogData > constPtr
HistoryLogData & operator=(const HistoryLogData &)
no base class assign
Url manipulation class.
Definition: Url.h:87
RW_pointer supporting &#39;copy on write&#39; functionality.
Definition: PtrTypes.h:438
shared_ptr< HistoryLogDataRepoRemove > Ptr