1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
15 #include "zypp/sat/SolvAttr.h"
16 #include "zypp/ResObject.h"
18 ///////////////////////////////////////////////////////////////////
20 { /////////////////////////////////////////////////////////////////
23 DEFINE_PTR_TYPE(Patch);
27 * Class representing a patch.
29 * A patch represents a specific problem that
30 * can be fixed by pulling in the patch dependencies.
32 * Patches can be marked for installation but their
33 * installation is a no-op.
35 class Patch : public ResObject
39 typedef ResTraits<Self> TraitsType;
40 typedef TraitsType::PtrType Ptr;
41 typedef TraitsType::constPtrType constPtr;
44 typedef sat::SolvableSet Contents;
50 Date timestamp() const
51 { return buildtime(); }
54 * Patch category (recommended, security,...)
56 std::string category() const;
59 * Does the system need to reboot to finish the update process?
61 bool reboot_needed() const;
64 * Does the patch affect the package manager itself?
66 bool affects_pkg_manager() const;
69 * Is the patch installation interactive? (does it need user input?)
71 bool interactive() const;
75 * The collection of packages associated with this patch.
77 Contents contents() const;
82 * Query class for Patch issue references
83 * like bugzilla and security issues the
84 * patch is supposed to fix.
86 * The iterator does not provide a dereference
87 * operator so you can do * on it, but you can
88 * access the attributes of each patch issue reference
89 * directly from the iterator.
92 * for ( Patch::ReferenceIterator it = patch->referencesBegin();
93 * it != patch->referencesEnd();
96 * cout << it.href() << endl;
101 class ReferenceIterator : public boost::iterator_adaptor<
102 Patch::ReferenceIterator // Derived
103 , sat::LookupAttr::iterator // Base
105 , boost::forward_traversal_tag // CategoryOrTraversal
111 explicit ReferenceIterator( const sat::Solvable & val_r );
114 * The id of the reference. For bugzilla entries
115 * this is the bug number as a string.
117 std::string id() const;
119 * Url or ponter where to find more information
121 std::string href() const;
123 * Title describing the issue
125 std::string title() const;
127 * Type of the reference. For example
130 std::string type() const;
132 friend class boost::iterator_core_access;
134 int dereference() const;
137 sat::LookupAttr::iterator _hrefit;
138 sat::LookupAttr::iterator _titleit;
139 sat::LookupAttr::iterator _typeit;
143 * Get an iterator to the beginning of the patch
144 * references. \see Patch::ReferenceIterator
146 Patch::ReferenceIterator referencesBegin() const;
148 * Get an iterator to the end of the patch
149 * references. \see Patch::ReferenceIterator
151 Patch::ReferenceIterator referencesEnd() const;
156 * \deprecated Seems to be unsused autobuild interal data?
158 ZYPP_DEPRECATED std::string id() const
159 { return std::string(); }
161 /** The list of all atoms building the patch
162 * \deprecated Try contents().
164 typedef std::list<ResObject::Ptr> AtomList;
165 ZYPP_DEPRECATED AtomList atoms() const
166 { return AtomList(); }
169 friend Ptr make<Self>( const sat::Solvable & solvable_r );
171 Patch( const sat::Solvable & solvable_r );
176 /////////////////////////////////////////////////////////////////
179 ///////////////////////////////////////////////////////////////////
180 #endif // ZYPP_PATCH_H