libzypp  13.10.6
Patch.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_PATCH_H
13 #define ZYPP_PATCH_H
14 
15 #include "zypp/base/Flags.h"
16 #include "zypp/sat/SolvAttr.h"
17 #include "zypp/ResObject.h"
18 
20 namespace zypp
21 {
22 
23 
24  DEFINE_PTR_TYPE(Patch);
25 
26 
36  class Patch : public ResObject
37  {
38  public:
39  typedef Patch Self;
43 
44  public:
46 
47  enum Category {
54  };
55 
61  NoFlags = 0x0000,
62  Reboot = 0x0001,
63  Message = 0x0002,
64  License = 0x0004
65  };
66  ZYPP_DECLARE_FLAGS(InteractiveFlags, InteractiveFlag);
67 
74  enum SeverityFlag {
75  SEV_NONE = 0,
76  SEV_OTHER = 1,
77  SEV_LOW = 1<<1,
78  SEV_MODERATE = 1<<2,
79  SEV_IMPORTANT = 1<<3,
80  SEV_CRITICAL = 1<<4
81  };
82  ZYPP_DECLARE_FLAGS(SeverityFlags, SeverityFlag);
83 
84  public:
89  Date timestamp() const
90  { return buildtime(); }
91 
95  std::string category() const;
96 
100  Category categoryEnum() const;
101 
106  std::string severity() const;
107 
112  SeverityFlag severityFlag() const;
113 
117  bool rebootSuggested() const;
118 
123  bool restartSuggested() const;
124 
129  bool reloginSuggested() const;
130 
134  std::string message( const Locale & lang_r = Locale() ) const;
135 
139  InteractiveFlags interactiveFlags() const;
140 
144  bool interactiveWhenIgnoring( InteractiveFlags flags_r = NoFlags ) const;
145 
156  bool interactive() const;
157 
158  public:
162  Contents contents() const;
163 
164  public:
165 
167  class ReferenceIterator;
172  ReferenceIterator referencesBegin() const;
177  ReferenceIterator referencesEnd() const;
178 
179  protected:
180  friend Ptr make<Self>( const sat::Solvable & solvable_r );
182  Patch( const sat::Solvable & solvable_r );
184  virtual ~Patch();
185  };
186  ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::InteractiveFlags);
187  ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::SeverityFlags);
188 
190  std::string asString( const Patch::SeverityFlag & obj );
191 
212  class Patch::ReferenceIterator : public boost::iterator_adaptor<
213  Patch::ReferenceIterator // Derived
214  , sat::LookupAttr::iterator // Base
215  , int // Value
216  , boost::forward_traversal_tag // CategoryOrTraversal
217  , int // Reference
218  >
219  {
220  public:
222  explicit ReferenceIterator( const sat::Solvable & val_r );
223 
228  std::string id() const;
232  std::string href() const;
236  std::string title() const;
241  std::string type() const;
242 
243  private:
245  int dereference() const { return 0; }
246  };
247 
249  { return ReferenceIterator(satSolvable()); }
250 
252  { return ReferenceIterator(); }
253 
255 
256 } // namespace zypp
258 #endif // ZYPP_PATCH_H
virtual ~Patch()
Dtor.
Definition: Patch.cc:41
A Solvable object within the sat Pool.
Definition: Solvable.h:55
SeverityFlag
Possible severity levels for (security) patches.
Definition: Patch.h:74
std::string type() const
Type of the reference.
Definition: Patch.cc:292
ResTraits< Self > TraitsType
Definition: Patch.h:40
std::string href() const
Url or pointer where to find more information.
Definition: Patch.cc:288
unknown value specified
Definition: Patch.h:76
Date timestamp() const
Issue date time.
Definition: Patch.h:89
Category categoryEnum() const
Patch category as enum of wellknown categories.
Definition: Patch.cc:50
std::string category() const
Patch category (recommended, security,...)
Definition: Patch.cc:167
Contents contents() const
The collection of packages associated with this patch.
Definition: Patch.cc:220
ResTraits.
Definition: ResTraits.h:77
Class representing a patch.
Definition: Patch.h:36
no value specified
Definition: Patch.h:75
bool interactiveWhenIgnoring(InteractiveFlags flags_r=NoFlags) const
Is the patch still interactive when ignoring this flags?
Definition: Patch.cc:203
SeverityFlag severityFlag() const
Severity string mapped to an enum.
Definition: Patch.cc:112
Store and operate on date (time_t).
Definition: Date.h:31
DEFINE_PTR_TYPE(KeyRing)
Query class for Patch issue references like bugzilla and security issues the patch is supposed to fix...
Definition: Patch.h:212
std::string title() const
Title describing the issue.
Definition: Patch.cc:290
sat::SolvableSet Contents
Definition: Patch.h:45
int dereference() const
Definition: Patch.h:245
ReferenceIterator referencesBegin() const
Get an iterator to the beginning of the patch references.
Definition: Patch.h:248
const sat::Solvable & satSolvable() const
Access the corresponding ::Solvable.
Definition: Resolvable.h:133
Patch(const sat::Solvable &solvable_r)
Ctor.
Definition: Patch.cc:32
Patch Self
Definition: Patch.h:39
TraitsType::constPtrType constPtr
Definition: Patch.h:42
Interface base for resolvable objects (common data).
Definition: ResObject.h:44
Date buildtime() const
build time of the resolvable
Definition: ResObject.cc:100
std::string asString(const Patch::SeverityFlag &obj)
Definition: Patch.cc:149
InteractiveFlag
Flags defining if and why this patch is interactive.
Definition: Patch.h:60
std::string message(const Locale &lang_r=Locale()) const
Information or warning to be displayed to the user.
Definition: Patch.cc:164
bool reloginSuggested() const
Does the patch needs the user to relogin to take effect? relogin is suggested then.
Definition: Patch.cc:176
friend class boost::iterator_core_access
Definition: Patch.h:244
bool interactive() const
Is the patch installation interactive? (does it need user input?)
Definition: Patch.cc:215
bool rebootSuggested() const
Does the system need to reboot to finish the update process?
Definition: Patch.cc:170
ZYPP_DECLARE_FLAGS(InteractiveFlags, InteractiveFlag)
std::string id() const
The id of the reference.
Definition: Patch.cc:286
intrusive_ptr< _Res > PtrType
Definition: ResTraits.h:80
ReferenceIterator referencesEnd() const
Get an iterator to the end of the patch references.
Definition: Patch.h:251
std::string severity() const
Severity string as specified in metadata.
Definition: Patch.cc:109
ZYPP_DECLARE_OPERATORS_FOR_FLAGS(FetcherJob::Flags)
bool restartSuggested() const
Does the patch affect the package manager itself? restart is suggested then.
Definition: Patch.cc:173
InteractiveFlags interactiveFlags() const
Get the InteractiveFlags of this Patch.
Definition: Patch.cc:179
TraitsType::PtrType Ptr
Definition: Patch.h:41
Solvable set wrapper to allow adding additioanal convenience iterators.
Definition: SolvableSet.h:35
intrusive_ptr< const _Res > constPtrType
Definition: ResTraits.h:81