19ea0e284cc9e3020cda82ede7e5d57425d19de2
[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   ///////////////////////////////////////////////////////////////////
23   //
24   //    CLASS NAME : Patch
25   //
26   /** Class representing a patch.
27    * \todo Patch::atoms can't be const, if Impl does not
28    * provide a const method. Check it.
29   */
30   class Patch : public ResObject
31   {
32   public:
33     typedef Patch                           Self;
34     typedef detail::PatchImplIf             Impl;
35     typedef base::intrusive_ptr<Self>       Ptr;
36     typedef base::intrusive_ptr<const Self> constPtr;
37
38   public:
39     typedef Impl::AtomList AtomList;
40
41   public:
42     /** Patch ID */
43     std::string id() const;
44     /** Patch time stamp */
45     unsigned int timestamp() const;
46     /** Patch category (recommended, security,...) */
47     std::string category() const;
48     /** Does the system need to reboot to finish the update process? */
49     bool reboot_needed() const;
50     /** Does the patch affect the package manager itself? */
51     bool affects_pkg_manager() const;
52     /** The list of all atoms building the patch */
53     AtomList atoms();
54     /** Is the patch installation interactive? (does it need user input?) */
55     bool interactive();
56     // TODO add comments and reevaluate the need for functions below
57     void mark_atoms_to_freshen(bool freshen);
58     bool any_atom_selected();
59     void select(); // TODO parameter to specify select/unselect or another function
60
61   protected:
62     /** Ctor */
63     Patch( const std::string & name_r,
64            const Edition & edition_r,
65            const Arch & arch_r );
66     /** Dtor */
67     virtual ~Patch();
68
69   private:
70     /** Access implementation */
71     virtual Impl & pimpl() = 0;
72     /** Access implementation */
73     virtual const Impl & pimpl() const = 0;
74   };
75
76   /////////////////////////////////////////////////////////////////
77 } // namespace zypp
78 ///////////////////////////////////////////////////////////////////
79 #endif // ZYPP_PATCH_H