libzypp  17.11.4
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;
47 
48  enum ID
49  {
51 
59  };
60 
62 
63  HistoryActionID(ID id) : _id(id) {}
64 
65  explicit HistoryActionID(const std::string & strval_r);
66 
67  ID toEnum() const { return _id; }
68 
69  static HistoryActionID::ID parse(const std::string & strval_r);
70 
71  const std::string & asString(bool pad = false) const;
72 
73  private:
75  };
76 
78  inline bool operator==( const HistoryActionID & lhs, const HistoryActionID & rhs )
79  { return lhs.toEnum() == rhs.toEnum(); }
80 
82  inline bool operator!=( const HistoryActionID & lhs, const HistoryActionID & rhs )
83  { return lhs.toEnum() != rhs.toEnum(); }
84 
86  std::ostream & operator << (std::ostream & str, const HistoryActionID & id);
88 
103  {
104  public:
105  typedef shared_ptr<HistoryLogData> Ptr;
106  typedef shared_ptr<const HistoryLogData> constPtr;
107 
108  typedef std::vector<std::string> FieldVector;
110  typedef FieldVector::const_iterator const_iterator;
111 
112  public:
117  explicit HistoryLogData( FieldVector & fields_r, size_type expect_r = 2 );
118 
123  HistoryLogData( FieldVector & fields_r, HistoryActionID action_r, size_type expect_r = 2 );
124 
126  virtual ~HistoryLogData();
127 
138  static Ptr create( FieldVector & fields_r );
139 
140  public:
142  bool empty() const;
143 
145  size_type size() const;
146 
148  const_iterator begin() const;
149 
151  const_iterator end() const;
152 
157  const std::string & optionalAt( size_type idx_r ) const;
159  const std::string & operator[]( size_type idx_r ) const
160  { return optionalAt( idx_r ); }
161 
166  const std::string & at( size_type idx_r ) const;
167 
168  public:
169  enum Index
170  {
173  };
174 
175  public:
176  Date date() const;
177  HistoryActionID action() const;
178 
179  public:
180  class Impl;
181  private:
183  protected:
185  };
186 
188  std::ostream & operator<<( std::ostream & str, const HistoryLogData & obj );
190 
197  {
198  public:
199  typedef shared_ptr<HistoryLogDataInstall> Ptr;
200  typedef shared_ptr<const HistoryLogDataInstall> constPtr;
204  HistoryLogDataInstall( FieldVector & fields_r );
205 
206  public:
207  enum Index
208  {
218  };
219 
220  public:
221  std::string name() const;
222  Edition edition() const;
223  Arch arch() const;
224  std::string reqby() const;
225  std::string repoAlias() const;
226  CheckSum checksum() const;
227  std::string userdata() const;
228  };
229 
236  {
237  public:
238  typedef shared_ptr<HistoryLogDataRemove> Ptr;
239  typedef shared_ptr<const HistoryLogDataRemove> constPtr;
243  HistoryLogDataRemove( FieldVector & fields_r );
244 
245  public:
246  enum Index
247  {
255  };
256 
257  public:
258  std::string name() const;
259  Edition edition() const;
260  Arch arch() const;
261  std::string reqby() const;
262  std::string userdata() const;
263  };
264 
271  {
272  public:
273  typedef shared_ptr<HistoryLogDataRepoAdd> Ptr;
274  typedef shared_ptr<const HistoryLogDataRepoAdd> constPtr;
278  HistoryLogDataRepoAdd( FieldVector & fields_r );
279 
280  public:
281  enum Index
282  {
288  };
289 
290  public:
291  std::string alias() const;
292  Url url() const;
293  std::string userdata() const;
294  };
295 
302  {
303  public:
304  typedef shared_ptr<HistoryLogDataRepoRemove> Ptr;
305  typedef shared_ptr<const HistoryLogDataRepoRemove> constPtr;
310 
311  public:
312  enum Index
313  {
318  };
319 
320  public:
321  std::string alias() const;
322  std::string userdata() const;
323  };
324 
331  {
332  public:
333  typedef shared_ptr<HistoryLogDataRepoAliasChange> Ptr;
334  typedef shared_ptr<const HistoryLogDataRepoAliasChange> constPtr;
339 
340  public:
341  enum Index
342  {
348  };
349 
350  public:
351  std::string oldAlias() const;
352  std::string newAlias() const;
353  std::string userdata() const;
354  };
355 
362  {
363  public:
364  typedef shared_ptr<HistoryLogDataRepoUrlChange> Ptr;
365  typedef shared_ptr<const HistoryLogDataRepoUrlChange> constPtr;
370 
371  public:
372  enum Index
373  {
379  };
380 
381  public:
382  std::string alias() const;
383  Url newUrl() const;
384  std::string userdata() const;
385  };
386 
394  {
395  public:
396  typedef shared_ptr<HistoryLogDataStampCommand> Ptr;
397  typedef shared_ptr<const HistoryLogDataStampCommand> constPtr;
402 
403  public:
404  enum Index
405  {
411  };
412 
413  public:
414  std::string executedBy() const;
415  std::string command() const;
416  std::string userdata() const;
417  };
418 
419 } // namespace zypp
421 #endif /* ZYPP_HISTORYLOGDATA_H_ */
std::string userdata() const
userdata/transactionID
bool operator!=(const HistoryActionID &lhs, const HistoryActionID &rhs)
shared_ptr< HistoryLogDataStampCommand > Ptr
repository providing the package
std::string newAlias() const
repositories new alias
HistoryLogDataStampCommand(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
shared_ptr< const HistoryLogDataStampCommand > constPtr
std::vector< std::string > FieldVector
std::string userdata() const
userdata/transactionID
Architecture.
Definition: Arch.h:36
Edition edition() const
package edition
Url url() const
repository url
shared_ptr< const HistoryLogDataRepoAdd > constPtr
std::string reqby() const
requested by (user, pid:appname, or empty (solver))
FieldVector::size_type size_type
HistoryLogDataRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
HistoryLogData(FieldVector &fields_r, size_type expect_r=2)
Ctor moving FieldVector (via swap).
std::string repoAlias() const
repository providing the package
String related utilities and Regular expression matching.
static const HistoryActionID REMOVE
Date date() const
date
static const HistoryActionID NONE
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
RWCOW_pointer< Impl > _pimpl
Implementation class.
Index
< indices of known fields
A zypp history log line for a removed packge.
static const HistoryActionID REPO_CHANGE_ALIAS
size_type size() const
Number of fields in vector.
static const HistoryActionID INSTALL
std::string alias() const
repository alias
static const HistoryActionID STAMP_COMMAND
const_iterator end() const
Iterator pointing behind the last element in vector.
HistoryLogDataRepoAliasChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
virtual ~HistoryLogData()
Dtor.
std::string reqby() const
requested by (user, pid:appname, or empty (solver))
HistoryLogDataRepoAdd(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
Edition edition() const
package edition
FieldVector::const_iterator const_iterator
Store and operate on date (time_t).
Definition: Date.h:32
A zypp history log line for an installed packaged.
const_iterator begin() const
Iterator pointing to 1st element in vector (or end()).
requested by (user, pid:appname, or empty (solver))
shared_ptr< HistoryLogDataInstall > Ptr
std::string name() const
package name
Url newUrl() const
repositories new url
shared_ptr< const HistoryLogDataRepoAliasChange > constPtr
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
shared_ptr< HistoryLogDataRepoAdd > Ptr
HistoryActionID action() const
HistoryActionID (or NONE_e if unknown)
const std::string & operator[](size_type idx_r) const
A zypp history log line for a repo url change.
std::string alias() const
repository alias
std::string oldAlias() const
repositories old alias
Provides API related macros.
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
A zypp history log line for a removed repository.
static Ptr create(FieldVector &fields_r)
Factory method creating HistoryLogData classes.
const std::string & asString(bool pad=false) const
SolvableIdType size_type
Definition: PoolMember.h:126
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...
std::string userdata() const
userdata/transactionID
static HistoryActionID::ID parse(const std::string &strval_r)
requested by (user, pid:appname, or empty (solver))
A zypp history log line for a repo alias change.
HistoryLogDataRepoRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
const std::string & at(size_type idx_r) const
Access (required) field by number.
static const HistoryActionID REPO_ADD
std::string executedBy() const
executed by user
std::string name() const
package name
CheckSum checksum() const
package checksum
A zypp history log line identifying the program that triggered the following commit.
shared_ptr< const HistoryLogDataInstall > constPtr
std::string userdata() const
userdata/transactionID
A zypp history log line for an added repository.
Enumeration of known history actions.
Arch arch() const
package architecture
bool empty() const
Whether FieldVector is empty.
Arch arch() const
package architecture
const std::string & optionalAt(size_type idx_r) const
Access (optional) field by number.
shared_ptr< const HistoryLogDataRepoRemove > constPtr
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
bool operator==(const HistoryActionID &lhs, const HistoryActionID &rhs)
shared_ptr< HistoryLogData > Ptr
shared_ptr< const HistoryLogDataRemove > constPtr
std::string command() const
the commandline executed
shared_ptr< const HistoryLogData > constPtr
std::string userdata() const
userdata/transactionID
HistoryLogData & operator=(const HistoryLogData &)
no base class assign
Url manipulation class.
Definition: Url.h:87
std::string alias() const
repository alias
std::string userdata() const
userdata/transactionID
shared_ptr< HistoryLogDataRepoRemove > Ptr