libzypp  10.5.0
Patch.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_PATCH_H
00013 #define ZYPP_PATCH_H
00014 
00015 #include "zypp/base/Flags.h"
00016 #include "zypp/sat/SolvAttr.h"
00017 #include "zypp/ResObject.h"
00018 
00020 namespace zypp
00021 { 
00022 
00023 
00024   DEFINE_PTR_TYPE(Patch);
00025 
00026 
00036   class Patch : public ResObject
00037   {
00038     public:
00039       typedef Patch                    Self;
00040       typedef ResTraits<Self>          TraitsType;
00041       typedef TraitsType::PtrType      Ptr;
00042       typedef TraitsType::constPtrType constPtr;
00043 
00044     public:
00045       typedef sat::SolvableSet Contents;
00046 
00047       enum Category {
00048         CAT_OTHER,
00049         CAT_YAST,
00050         CAT_SECURITY,
00051         CAT_RECOMMENDED,
00052         CAT_OPTIONAL,
00053         CAT_DOCUMENT
00054       };
00055 
00060       enum InteractiveFlag {
00061         NoFlags = 0x0000,
00062         Reboot = 0x0001,
00063         Message = 0x0002,
00064         License = 0x0004
00065       };
00066       ZYPP_DECLARE_FLAGS(InteractiveFlags, InteractiveFlag);
00067 
00068     public:
00073       Date timestamp() const
00074       { return buildtime(); }
00075 
00079       std::string category() const;
00080 
00084       Category categoryEnum() const;
00085 
00089       bool rebootSuggested() const;
00090 
00095       bool restartSuggested() const;
00096 
00101       bool reloginSuggested() const;
00102 
00106       std::string message( const Locale & lang_r = Locale() ) const;
00107 
00111       InteractiveFlags interactiveFlags() const;
00112 
00116       bool interactiveWhenIgnoring( InteractiveFlags flags_r = NoFlags ) const;
00117 
00128       bool interactive() const;
00129 
00130     public:
00134       Contents contents() const;
00135 
00136     public:
00137 
00139       class ReferenceIterator;
00144       ReferenceIterator referencesBegin() const;
00149       ReferenceIterator referencesEnd() const;
00150 
00151     protected:
00152       friend Ptr make<Self>( const sat::Solvable & solvable_r );
00154       Patch( const sat::Solvable & solvable_r );
00156       virtual ~Patch();
00157   };
00158   ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Patch::InteractiveFlags);
00159 
00160 
00181   class Patch::ReferenceIterator : public boost::iterator_adaptor<
00182       Patch::ReferenceIterator           // Derived
00183       , sat::LookupAttr::iterator        // Base
00184       , int                              // Value
00185       , boost::forward_traversal_tag     // CategoryOrTraversal
00186       , int                              // Reference
00187   >
00188   {
00189     public:
00190       ReferenceIterator() {}
00191       explicit ReferenceIterator( const sat::Solvable & val_r );
00192 
00197       std::string id() const;
00201       std::string href() const;
00205       std::string title() const;
00210       std::string type() const;
00211 
00212     private:
00213       friend class boost::iterator_core_access;
00214       int dereference() const { return 0; }
00215   };
00216 
00217   inline Patch::ReferenceIterator Patch::referencesBegin() const
00218   { return ReferenceIterator(satSolvable()); }
00219 
00220   inline Patch::ReferenceIterator Patch::referencesEnd() const
00221   { return ReferenceIterator(); }
00222 
00224 
00225 } // namespace zypp
00227 #endif // ZYPP_PATCH_H