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/sat/SolvAttr.h"
00016 #include "zypp/ResObject.h"
00017 
00019 namespace zypp
00020 { 
00021 
00022 
00023   DEFINE_PTR_TYPE(Patch);
00024 
00025 
00035   class Patch : public ResObject
00036   {
00037     public:
00038       typedef Patch                    Self;
00039       typedef ResTraits<Self>          TraitsType;
00040       typedef TraitsType::PtrType      Ptr;
00041       typedef TraitsType::constPtrType constPtr;
00042 
00043     public:
00044       typedef sat::SolvableSet Contents;
00045 
00046       enum Category {
00047         CAT_OTHER,
00048         CAT_YAST,
00049         CAT_SECURITY,
00050         CAT_RECOMMENDED,
00051         CAT_OPTIONAL,
00052         CAT_DOCUMENT
00053       };
00054 
00055     public:
00060       Date timestamp() const
00061       { return buildtime(); }
00062 
00066       std::string category() const;
00067 
00071       Category categoryEnum() const;
00072 
00076       bool rebootSuggested() const;
00077 
00082       bool restartSuggested() const;
00083 
00088       bool reloginSuggested() const;
00089 
00093       std::string message( const Locale & lang_r = Locale() ) const;
00094 
00098       bool interactive() const;
00099 
00100     public:
00104       Contents contents() const;
00105 
00106     public:
00107 
00109       class ReferenceIterator;
00114       ReferenceIterator referencesBegin() const;
00119       ReferenceIterator referencesEnd() const;
00120 
00121     protected:
00122       friend Ptr make<Self>( const sat::Solvable & solvable_r );
00124       Patch( const sat::Solvable & solvable_r );
00126       virtual ~Patch();
00127   };
00128 
00129 
00150   class Patch::ReferenceIterator : public boost::iterator_adaptor<
00151       Patch::ReferenceIterator           // Derived
00152       , sat::LookupAttr::iterator        // Base
00153       , int                              // Value
00154       , boost::forward_traversal_tag     // CategoryOrTraversal
00155       , int                              // Reference
00156   >
00157   {
00158     public:
00159       ReferenceIterator() {}
00160       explicit ReferenceIterator( const sat::Solvable & val_r );
00161 
00166       std::string id() const;
00170       std::string href() const;
00174       std::string title() const;
00179       std::string type() const;
00180 
00181     private:
00182       friend class boost::iterator_core_access;
00183       int dereference() const { return 0; }
00184   };
00185 
00186   inline Patch::ReferenceIterator Patch::referencesBegin() const
00187   { return ReferenceIterator(satSolvable()); }
00188 
00189   inline Patch::ReferenceIterator Patch::referencesEnd() const
00190   { return ReferenceIterator(); }
00191 
00193 
00194 } // namespace zypp
00196 #endif // ZYPP_PATCH_H

doxygen