libzypp 17.25.10
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_ */
Architecture.
Definition: Arch.h:37
Store and operate on date (time_t).
Definition: Date.h:33
Edition represents [epoch:]version[-release]
Definition: Edition.h:61
A zypp history log line for an installed packaged.
shared_ptr< const HistoryLogDataInstall > constPtr
HistoryLogDataInstall(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string userdata() const
userdata/transactionID
@ EDITION_INDEX
package edition
@ REQBY_INDEX
requested by (user@hostname, pid:appname, or empty (solver))
@ ARCH_INDEX
package architecture
@ USERDATA_INDEX
userdata/transactionID
@ REPOALIAS_INDEX
repository providing the package
@ CHEKSUM_INDEX
package checksum
CheckSum checksum() const
package checksum
std::string name() const
package name
Arch arch() const
package architecture
std::string reqby() const
requested by (user@hostname, pid:appname, or empty (solver))
std::string repoAlias() const
repository providing the package
Edition edition() const
package edition
shared_ptr< HistoryLogDataInstall > Ptr
A zypp history log line for a removed packge.
Arch arch() const
package architecture
@ REQBY_INDEX
requested by (user@hostname, pid:appname, or empty (solver))
@ ARCH_INDEX
package architecture
@ USERDATA_INDEX
userdata/transactionID
@ EDITION_INDEX
package edition
HistoryLogDataRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
Edition edition() const
package edition
std::string name() const
package name
std::string userdata() const
userdata/transactionID
std::string reqby() const
requested by (user@hostname, pid:appname, or empty (solver))
shared_ptr< HistoryLogDataRemove > Ptr
shared_ptr< const HistoryLogDataRemove > constPtr
A zypp history log line for an added repository.
shared_ptr< HistoryLogDataRepoAdd > Ptr
shared_ptr< const HistoryLogDataRepoAdd > constPtr
@ ALIAS_INDEX
repository alias
@ USERDATA_INDEX
userdata/transactionID
std::string alias() const
repository alias
Url url() const
repository url
HistoryLogDataRepoAdd(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string userdata() const
userdata/transactionID
A zypp history log line for a repo alias change.
shared_ptr< const HistoryLogDataRepoAliasChange > constPtr
std::string userdata() const
userdata/transactionID
std::string oldAlias() const
repositories old alias
@ NEWALIAS_INDEX
repositories new alias
@ USERDATA_INDEX
userdata/transactionID
@ OLDALIAS_INDEX
repositories old alias
std::string newAlias() const
repositories new alias
shared_ptr< HistoryLogDataRepoAliasChange > Ptr
HistoryLogDataRepoAliasChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
A zypp history log line for a removed repository.
@ USERDATA_INDEX
userdata/transactionID
HistoryLogDataRepoRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string alias() const
repository alias
std::string userdata() const
userdata/transactionID
shared_ptr< const HistoryLogDataRepoRemove > constPtr
shared_ptr< HistoryLogDataRepoRemove > Ptr
A zypp history log line for a repo url change.
Url newUrl() const
repositories new url
shared_ptr< HistoryLogDataRepoUrlChange > Ptr
std::string alias() const
repository alias
@ NEWURL_INDEX
repositories new url
@ USERDATA_INDEX
userdata/transactionID
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoUrlChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
shared_ptr< const HistoryLogDataRepoUrlChange > constPtr
A zypp history log line identifying the program that triggered the following commit.
std::string command() const
the commandline executed
shared_ptr< const HistoryLogDataStampCommand > constPtr
std::string executedBy() const
executed by user@hostname
HistoryLogDataStampCommand(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
shared_ptr< HistoryLogDataStampCommand > Ptr
@ COMMAND_INDEX
the commandline executed
@ USER_INDEX
executed by user@hostname
@ USERDATA_INDEX
userdata/transactionID
std::string userdata() const
userdata/transactionID
A zypp history log line split into fields.
HistoryActionID action() const
HistoryActionID (or NONE_e if unknown)
FieldVector::const_iterator const_iterator
FieldVector::size_type size_type
shared_ptr< HistoryLogData > Ptr
static Ptr create(FieldVector &fields_r)
Factory method creating HistoryLogData classes.
const_iterator end() const
Iterator pointing behind the last element in vector.
virtual ~HistoryLogData()
Dtor.
shared_ptr< const HistoryLogData > constPtr
HistoryLogData & operator=(const HistoryLogData &)
no base class assign
const std::string & at(size_type idx_r) const
Access (required) field by number.
const std::string & optionalAt(size_type idx_r) const
Access (optional) field by number.
const_iterator begin() const
Iterator pointing to 1st element in vector (or end()).
Index
< indices of known fields
@ ACTION_INDEX
HistoryActionID.
bool empty() const
Whether FieldVector is empty.
Date date() const
date
const std::string & operator[](size_type idx_r) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RWCOW_pointer< Impl > _pimpl
Implementation class.
HistoryLogData(FieldVector &fields_r, size_type expect_r=2)
Ctor moving FieldVector (via swap).
std::vector< std::string > FieldVector
size_type size() const
Number of fields in vector.
A zypp history log line for an installed packaged.
std::string repoAlias() const
repository providing the package
std::string name() const
package name
std::string userdata() const
userdata/transactionID
shared_ptr< const HistoryLogPatchStateChange > constPtr
Patch::Category category() const
Arch arch() const
package architecture
@ OLDSTATE_INDEX
the state of the patch before the change
@ NEWSTATE_INDEX
the state of the patch after the change
@ REPOALIAS_INDEX
repository providing the patch
@ USERDATA_INDEX
userdata/transactionID
Edition edition() const
package edition
Patch::SeverityFlag severity() const
HistoryLogPatchStateChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
shared_ptr< HistoryLogPatchStateChange > Ptr
SeverityFlag
Possible severity levels for (security) patches.
Definition: Patch.h:76
Url manipulation class.
Definition: Url.h:92
String related utilities and Regular expression matching.
SolvableIdType size_type
Definition: PoolMember.h:126
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
Enumeration of known history actions.
static const HistoryActionID REPO_REMOVE
bool operator==(const HistoryActionID &lhs, const HistoryActionID &rhs)
static const HistoryActionID PATCH_STATE_CHANGE
const std::string & asString(bool pad=false) const
static const HistoryActionID REMOVE
static const HistoryActionID NONE
static const HistoryActionID STAMP_COMMAND
static const HistoryActionID REPO_ADD
static const HistoryActionID REPO_CHANGE_ALIAS
static const HistoryActionID REPO_CHANGE_URL
static HistoryActionID::ID parse(const std::string &strval_r)
static const HistoryActionID INSTALL
bool operator!=(const HistoryActionID &lhs, const HistoryActionID &rhs)
RW_pointer supporting 'copy on write' functionality.
Definition: PtrTypes.h:459