libzypp  14.48.5
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 
97  std::string category() const;
98 
102  Category categoryEnum() const;
103 
105  bool isCategory( const std::string & category_r ) const;
106 
110  static Category categoryEnum( const std::string & category_r );
112 
119  std::string severity() const;
120 
125  SeverityFlag severityFlag() const;
126 
128  bool isSeverity( const std::string & severity_r ) const;
129 
133  static SeverityFlag severityFlag( const std::string & category_r );
135 
139  bool rebootSuggested() const;
140 
145  bool restartSuggested() const;
146 
151  bool reloginSuggested() const;
152 
156  std::string message( const Locale & lang_r = Locale() ) const;
157 
161  InteractiveFlags interactiveFlags() const;
162 
166  bool interactiveWhenIgnoring( InteractiveFlags flags_r = NoFlags ) const;
167 
178  bool interactive() const;
179 
180  public:
184  Contents contents() const;
185 
186  public:
187 
189  class ReferenceIterator;
194  ReferenceIterator referencesBegin() const;
199  ReferenceIterator referencesEnd() const;
200 
201  protected:
202  friend Ptr make<Self>( const sat::Solvable & solvable_r );
204  Patch( const sat::Solvable & solvable_r );
206  virtual ~Patch();
207  };
208  ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::InteractiveFlags);
209  ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::SeverityFlags);
210 
212  std::string asString( const Patch::SeverityFlag & obj );
213 
234  class Patch::ReferenceIterator : public boost::iterator_adaptor<
235  Patch::ReferenceIterator // Derived
236  , sat::LookupAttr::iterator // Base
237  , int // Value
238  , boost::forward_traversal_tag // CategoryOrTraversal
239  , int // Reference
240  >
241  {
242  public:
244  explicit ReferenceIterator( const sat::Solvable & val_r );
245 
250  std::string id() const;
254  std::string href() const;
258  std::string title() const;
263  std::string type() const;
264 
265  private:
267  int dereference() const { return 0; }
268  };
269 
271  { return ReferenceIterator(satSolvable()); }
272 
274  { return ReferenceIterator(); }
275 
277 
278 } // namespace zypp
280 #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:308
ResTraits< Self > TraitsType
Definition: Patch.h:40
std::string href() const
Url or pointer where to find more information.
Definition: Patch.cc:304
unknown value specified
Definition: Patch.h:76
Date timestamp() const
Issue date time.
Definition: Patch.h:89
ZYPP_DECLARE_OPERATORS_FOR_FLAGS(DiskUsageCounter::MountPoint::HintFlags)
Category categoryEnum() const
This patch's category as enum of wellknown categories.
Definition: Patch.cc:49
std::string category() const
Patch category (recommended, security,...)
Definition: Patch.cc:46
Contents contents() const
The collection of packages associated with this patch.
Definition: Patch.cc:236
ResTraits.
Definition: ResTraits.h:79
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:219
bool isCategory(const std::string &category_r) const
Whether this patch's category matches category_r.
Definition: Patch.cc:52
SeverityFlag severityFlag() const
Severity string mapped to an enum.
Definition: Patch.cc:118
Store and operate on date (time_t).
Definition: Date.h:32
Query class for Patch issue references like bugzilla and security issues the patch is supposed to fix...
Definition: Patch.h:234
DEFINE_PTR_TYPE(Application)
bool isSeverity(const std::string &severity_r) const
Whether this patch's severity matches severity_r.
Definition: Patch.cc:121
std::string title() const
Title describing the issue.
Definition: Patch.cc:306
sat::SolvableSet Contents
Definition: Patch.h:45
int dereference() const
Definition: Patch.h:267
ReferenceIterator referencesBegin() const
Get an iterator to the beginning of the patch references.
Definition: Patch.h:270
const sat::Solvable & satSolvable() const
Access the corresponding ::Solvable.
Definition: Resolvable.h:136
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:106
std::string asString(const Patch::SeverityFlag &obj)
Definition: Patch.cc:166
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:183
bool reloginSuggested() const
Does the patch needs the user to relogin to take effect? relogin is suggested then.
Definition: Patch.cc:192
friend class boost::iterator_core_access
Definition: Patch.h:266
bool interactive() const
Is the patch installation interactive? (does it need user input?)
Definition: Patch.cc:231
bool rebootSuggested() const
Does the system need to reboot to finish the update process?
Definition: Patch.cc:186
ZYPP_DECLARE_FLAGS(InteractiveFlags, InteractiveFlag)
std::string id() const
The id of the reference.
Definition: Patch.cc:302
intrusive_ptr< _Res > PtrType
Definition: ResTraits.h:82
ReferenceIterator referencesEnd() const
Get an iterator to the end of the patch references.
Definition: Patch.h:273
std::string severity() const
Severity string as specified in metadata.
Definition: Patch.cc:115
bool restartSuggested() const
Does the patch affect the package manager itself? restart is suggested then.
Definition: Patch.cc:189
InteractiveFlags interactiveFlags() const
Get the InteractiveFlags of this Patch.
Definition: Patch.cc:195
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:83