libzypp  11.13.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 
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