50b350dad6b9a3ccb8545274d05e9c8789d9923f
[platform/upstream/libzypp.git] / zypp / Script.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Script.h
10  *
11 */
12 #ifndef ZYPP_SCRIPT_H
13 #define ZYPP_SCRIPT_H
14
15 #include "zypp/ResObject.h"
16 #include "zypp/detail/ScriptImplIf.h"
17
18 ///////////////////////////////////////////////////////////////////
19 namespace zypp
20 { /////////////////////////////////////////////////////////////////
21
22   ///////////////////////////////////////////////////////////////////
23   //
24   //    CLASS NAME : Script
25   //
26   /** Class representing an update script.
27   */
28   class Script : public ResObject
29   {
30   public:
31     typedef detail::ScriptImplIf     Impl;
32     typedef Script                   Self;
33     typedef ResTraits<Self>          TraitsType;
34     typedef TraitsType::PtrType      Ptr;
35     typedef TraitsType::constPtrType constPtr;
36
37   public:
38     /** Get the script to perform the change */
39     std::string do_script();
40     /** Get the script to undo the change */
41     std::string undo_script();
42     /** Check whether script to undo the change is available */
43     bool undo_available();
44
45   protected:
46     /** Ctor */
47     Script( const std::string & name_r,
48             const Edition & edition_r,
49             const Arch & arch_r );
50     /** Dtor */
51     virtual ~Script();
52
53   private:
54     /** Access implementation */
55     virtual Impl & pimpl() = 0;
56     /** Access implementation */
57     virtual const Impl & pimpl() const = 0;
58   };
59
60   /////////////////////////////////////////////////////////////////
61 } // namespace zypp
62 ///////////////////////////////////////////////////////////////////
63 #endif // ZYPP_SCRIPT_H