provide intrusive_ptr counters
[platform/upstream/libzypp.git] / zypp / Patch.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Patch.h
10  *
11 */
12 #ifndef ZYPP_PATCH_H
13 #define ZYPP_PATCH_H
14
15 #include "zypp/ResObject.h"
16 #include "zypp/detail/PatchImplIf.h"
17
18 ///////////////////////////////////////////////////////////////////
19 namespace zypp
20 { /////////////////////////////////////////////////////////////////
21
22   DEFINE_PTR_TYPE(Patch);
23   
24   ///////////////////////////////////////////////////////////////////
25   //
26   //    CLASS NAME : Patch
27   //
28   /** Class representing a patch.
29    * \todo Patch::atoms can't be const, if Impl does not
30    * provide a const method. Check it.
31   */
32   class Patch : public ResObject
33   {
34   public:
35     typedef detail::PatchImplIf      Impl;
36     typedef Patch                    Self;
37     typedef ResTraits<Self>          TraitsType;
38     typedef TraitsType::PtrType      Ptr;
39     typedef TraitsType::constPtrType constPtr;
40
41   public:
42     typedef Impl::AtomList AtomList;
43
44   public:
45     /** Patch ID */
46     std::string id() const;
47     /** Patch time stamp */
48     Date timestamp() const;
49     /** Patch category (recommended, security,...) */
50     std::string category() const;
51     /** Does the system need to reboot to finish the update process? */
52     bool reboot_needed() const;
53     /** Does the patch affect the package manager itself? */
54     bool affects_pkg_manager() const;
55     /** The list of all atoms building the patch */
56     AtomList atoms() const;
57     /** Is the patch installation interactive? (does it need user input?) */
58     bool interactive() const;
59     // TODO add comments and reevaluate the need for functions below
60     void mark_atoms_to_freshen(bool freshen);
61     bool any_atom_selected();
62     void select(); // TODO parameter to specify select/unselect or another function
63
64   protected:
65     /** Ctor */
66     Patch( const NVRAD & nvrad_r );
67     /** Dtor */
68     virtual ~Patch();
69
70   private:
71     /** Access implementation */
72     virtual Impl & pimpl() = 0;
73     /** Access implementation */
74     virtual const Impl & pimpl() const = 0;
75   };
76
77   /////////////////////////////////////////////////////////////////
78 } // namespace zypp
79 ///////////////////////////////////////////////////////////////////
80 #endif // ZYPP_PATCH_H