libzypp  17.36.1
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-core/Globals.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 ZYPP_API;
40 
41  static const HistoryActionID INSTALL ZYPP_API;
42  static const HistoryActionID REMOVE ZYPP_API;
43  static const HistoryActionID REPO_ADD ZYPP_API;
44  static const HistoryActionID REPO_REMOVE ZYPP_API;
45  static const HistoryActionID REPO_CHANGE_ALIAS ZYPP_API;
46  static const HistoryActionID REPO_CHANGE_URL ZYPP_API;
47  static const HistoryActionID STAMP_COMMAND ZYPP_API;
48  static const HistoryActionID PATCH_STATE_CHANGE ZYPP_API;
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  using Ptr = shared_ptr<HistoryLogData>;
109  using constPtr = shared_ptr<const HistoryLogData>;
110 
111  using FieldVector = std::vector<std::string>;
113  using const_iterator = FieldVector::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  {
174  DATE_INDEX = 0,
175  ACTION_INDEX = 1,
176  };
177 
178  public:
179  Date date() const;
180  HistoryActionID action() const;
181 
182  public:
183  class Impl;
184  private:
186  protected:
187  HistoryLogData & operator=( const HistoryLogData & );
188  };
189 
191  std::ostream & operator<<( std::ostream & str, const HistoryLogData & obj );
193 
200  {
201  public:
202  using Ptr = shared_ptr<HistoryLogDataInstall>;
203  using constPtr = shared_ptr<const HistoryLogDataInstall>;
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  using Ptr = shared_ptr<HistoryLogPatchStateChange>;
243  using constPtr = shared_ptr<const HistoryLogPatchStateChange>;
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;
270  Patch::SeverityFlag severity() 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  using Ptr = shared_ptr<HistoryLogDataRemove>;
287  using constPtr = shared_ptr<const HistoryLogDataRemove>;
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  using Ptr = shared_ptr<HistoryLogDataRepoAdd>;
322  using constPtr = shared_ptr<const HistoryLogDataRepoAdd>;
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  using Ptr = shared_ptr<HistoryLogDataRepoRemove>;
353  using constPtr = shared_ptr<const HistoryLogDataRepoRemove>;
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  using Ptr = shared_ptr<HistoryLogDataRepoAliasChange>;
382  using constPtr = shared_ptr<const HistoryLogDataRepoAliasChange>;
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  using Ptr = shared_ptr<HistoryLogDataRepoUrlChange>;
413  using constPtr = shared_ptr<const HistoryLogDataRepoUrlChange>;
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  using Ptr = shared_ptr<HistoryLogDataStampCommand>;
445  using constPtr = shared_ptr<const HistoryLogDataStampCommand>;
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_ */
bool operator!=(const HistoryActionID &lhs, const HistoryActionID &rhs)
repository providing the package
SeverityFlag
Possible severity levels for (security) patches.
Definition: Patch.h:76
static const HistoryActionID STAMP_COMMAND ZYPP_API
Architecture.
Definition: Arch.h:36
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
RWCOW_pointer< Impl > _pimpl
Implementation class.
Provides API related macros.
Index
< indices of known fields
A zypp history log line for a removed packge.
static const HistoryActionID REPO_CHANGE_URL ZYPP_API
static const HistoryActionID NONE ZYPP_API
FieldVector::size_type size_type
Store and operate on date (time_t).
Definition: Date.h:32
A zypp history log line for an installed packaged.
requested by (user, pid:appname, or empty (solver))
const std::string & operator[](size_type idx_r) const
A zypp history log line for a repo url change.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
static const HistoryActionID REPO_REMOVE ZYPP_API
shared_ptr< HistoryLogData > Ptr
static const HistoryActionID REPO_CHANGE_ALIAS ZYPP_API
static const HistoryActionID PATCH_STATE_CHANGE ZYPP_API
A zypp history log line for a removed repository.
const std::string & asString(bool pad=false) const
std::vector< std::string > FieldVector
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)
A zypp history log line for an installed packaged.
requested by (user, pid:appname, or empty (solver))
A zypp history log line for a repo alias change.
static const HistoryActionID REMOVE ZYPP_API
shared_ptr< const HistoryLogData > constPtr
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
Definition: PathInfo.cc:1056
static const HistoryActionID INSTALL ZYPP_API
A zypp history log line identifying the program that triggered the following commit.
the state of the patch after the change
FieldVector::const_iterator const_iterator
A zypp history log line for an added repository.
Enumeration of known history actions.
the state of the patch before the change
static const HistoryActionID REPO_ADD ZYPP_API
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
SolvableIdType size_type
Definition: PoolMember.h:126
bool operator==(const HistoryActionID &lhs, const HistoryActionID &rhs)
Url manipulation class.
Definition: Url.h:92