libzypp  17.20.0
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 #include "zypp/Patch.h"
25 
26 #define HISTORY_LOG_DATE_FORMAT "%Y-%m-%d %H:%M:%S"
27 
29 namespace zypp
30 {
38  {
39  static const HistoryActionID NONE;
40 
41  static const HistoryActionID INSTALL;
42  static const HistoryActionID REMOVE;
43  static const HistoryActionID REPO_ADD;
49 
50  enum ID
51  {
53 
62  };
63 
65 
66  HistoryActionID(ID id) : _id(id) {}
67 
68  explicit HistoryActionID(const std::string & strval_r);
69 
70  ID toEnum() const { return _id; }
71 
72  static HistoryActionID::ID parse(const std::string & strval_r);
73 
74  const std::string & asString(bool pad = false) const;
75 
76  private:
78  };
79 
81  inline bool operator==( const HistoryActionID & lhs, const HistoryActionID & rhs )
82  { return lhs.toEnum() == rhs.toEnum(); }
83 
85  inline bool operator!=( const HistoryActionID & lhs, const HistoryActionID & rhs )
86  { return lhs.toEnum() != rhs.toEnum(); }
87 
89  std::ostream & operator << (std::ostream & str, const HistoryActionID & id);
91 
106  {
107  public:
108  typedef shared_ptr<HistoryLogData> Ptr;
109  typedef shared_ptr<const HistoryLogData> constPtr;
110 
111  typedef std::vector<std::string> FieldVector;
113  typedef FieldVector::const_iterator const_iterator;
114 
115  public:
120  explicit HistoryLogData( FieldVector & fields_r, size_type expect_r = 2 );
121 
126  HistoryLogData( FieldVector & fields_r, HistoryActionID action_r, size_type expect_r = 2 );
127 
129  virtual ~HistoryLogData();
130 
141  static Ptr create( FieldVector & fields_r );
142 
143  public:
145  bool empty() const;
146 
148  size_type size() const;
149 
151  const_iterator begin() const;
152 
154  const_iterator end() const;
155 
160  const std::string & optionalAt( size_type idx_r ) const;
162  const std::string & operator[]( size_type idx_r ) const
163  { return optionalAt( idx_r ); }
164 
169  const std::string & at( size_type idx_r ) const;
170 
171  public:
172  enum Index
173  {
176  };
177 
178  public:
179  Date date() const;
180  HistoryActionID action() const;
181 
182  public:
183  class Impl;
184  private:
186  protected:
188  };
189 
191  std::ostream & operator<<( std::ostream & str, const HistoryLogData & obj );
193 
200  {
201  public:
202  typedef shared_ptr<HistoryLogDataInstall> Ptr;
203  typedef shared_ptr<const HistoryLogDataInstall> constPtr;
207  HistoryLogDataInstall( FieldVector & fields_r );
208 
209  public:
210  enum Index
211  {
221  };
222 
223  public:
224  std::string name() const;
225  Edition edition() const;
226  Arch arch() const;
227  std::string reqby() const;
228  std::string repoAlias() const;
229  CheckSum checksum() const;
230  std::string userdata() const;
231  };
232 
233  //PATCH SEVERITY CATEGORY OLDSTATE NEWSTATE
240  {
241  public:
242  typedef shared_ptr<HistoryLogPatchStateChange> Ptr;
243  typedef shared_ptr<const HistoryLogPatchStateChange> constPtr;
248 
249  public:
250  enum Index
251  {
263  };
264 
265  public:
266  std::string name() const;
267  Edition edition() const;
268  Arch arch() const;
269  std::string repoAlias() const;
271  Patch::Category category() const;
272  std::string oldstate() const;
273  std::string newstate() const;
274  std::string userdata() const;
275  };
276 
277 
284  {
285  public:
286  typedef shared_ptr<HistoryLogDataRemove> Ptr;
287  typedef shared_ptr<const HistoryLogDataRemove> constPtr;
291  HistoryLogDataRemove( FieldVector & fields_r );
292 
293  public:
294  enum Index
295  {
303  };
304 
305  public:
306  std::string name() const;
307  Edition edition() const;
308  Arch arch() const;
309  std::string reqby() const;
310  std::string userdata() const;
311  };
312 
319  {
320  public:
321  typedef shared_ptr<HistoryLogDataRepoAdd> Ptr;
322  typedef shared_ptr<const HistoryLogDataRepoAdd> constPtr;
326  HistoryLogDataRepoAdd( FieldVector & fields_r );
327 
328  public:
329  enum Index
330  {
336  };
337 
338  public:
339  std::string alias() const;
340  Url url() const;
341  std::string userdata() const;
342  };
343 
350  {
351  public:
352  typedef shared_ptr<HistoryLogDataRepoRemove> Ptr;
353  typedef shared_ptr<const HistoryLogDataRepoRemove> constPtr;
358 
359  public:
360  enum Index
361  {
366  };
367 
368  public:
369  std::string alias() const;
370  std::string userdata() const;
371  };
372 
379  {
380  public:
381  typedef shared_ptr<HistoryLogDataRepoAliasChange> Ptr;
382  typedef shared_ptr<const HistoryLogDataRepoAliasChange> constPtr;
387 
388  public:
389  enum Index
390  {
396  };
397 
398  public:
399  std::string oldAlias() const;
400  std::string newAlias() const;
401  std::string userdata() const;
402  };
403 
410  {
411  public:
412  typedef shared_ptr<HistoryLogDataRepoUrlChange> Ptr;
413  typedef shared_ptr<const HistoryLogDataRepoUrlChange> constPtr;
418 
419  public:
420  enum Index
421  {
427  };
428 
429  public:
430  std::string alias() const;
431  Url newUrl() const;
432  std::string userdata() const;
433  };
434 
442  {
443  public:
444  typedef shared_ptr<HistoryLogDataStampCommand> Ptr;
445  typedef shared_ptr<const HistoryLogDataStampCommand> constPtr;
450 
451  public:
452  enum Index
453  {
459  };
460 
461  public:
462  std::string executedBy() const;
463  std::string command() const;
464  std::string userdata() const;
465  };
466 
467 } // namespace zypp
469 #endif /* ZYPP_HISTORYLOGDATA_H_ */
std::string userdata() const
userdata/transactionID
bool operator!=(const HistoryActionID &lhs, const HistoryActionID &rhs)
shared_ptr< const HistoryLogPatchStateChange > constPtr
shared_ptr< HistoryLogDataStampCommand > Ptr
repository providing the package
std::string newAlias() const
repositories new alias
HistoryLogDataStampCommand(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
Patch::SeverityFlag severity() const
shared_ptr< const HistoryLogDataStampCommand > constPtr
SeverityFlag
Possible severity levels for (security) patches.
Definition: Patch.h:76
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@hostname, 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
std::string name() const
package name
static const HistoryActionID NONE
Arch arch() const
package architecture
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@hostname, 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@hostname, 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
static const HistoryActionID REPO_REMOVE
HistoryLogDataInstall(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
static const HistoryActionID PATCH_STATE_CHANGE
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.
std::string userdata() const
userdata/transactionID
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)
A zypp history log line for an installed packaged.
requested by (user@hostname, pid:appname, or empty (solver))
shared_ptr< HistoryLogPatchStateChange > Ptr
HistoryLogPatchStateChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
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@hostname
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
the state of the patch after the change
std::string userdata() const
userdata/transactionID
std::string repoAlias() const
repository providing the package
A zypp history log line for an added repository.
Enumeration of known history actions.
the state of the patch before the change
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
Edition edition() const
package edition
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
Patch::Category category() const
std::string alias() const
repository alias
std::string userdata() const
userdata/transactionID
shared_ptr< HistoryLogDataRepoRemove > Ptr