- Create the cache directly from the schema (installed) file.
[platform/upstream/libzypp.git] / zypp / ZYppCommitPolicy.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZYppCommitPolicy.h
10  *
11 */
12 #ifndef ZYPP_ZYPPCOMMITPOLICY_H
13 #define ZYPP_ZYPPCOMMITPOLICY_H
14
15 #include <iosfwd>
16
17 ///////////////////////////////////////////////////////////////////
18 namespace zypp
19 { /////////////////////////////////////////////////////////////////
20
21   ///////////////////////////////////////////////////////////////////
22   //
23   //    CLASS NAME : ZYppCommitPolicy
24   //
25   /** */
26   class ZYppCommitPolicy
27   {
28   public:
29     ZYppCommitPolicy()
30     : _restrictToMedia    ( 0 )
31     , _dryRun             ( false )
32     , _rpmNoSignature     ( false )
33     , _syncPoolAfterCommit( true )
34     {}
35
36   public:
37     unsigned restrictToMedia() const
38     { return _restrictToMedia; }
39
40     bool dryRun() const
41     { return _dryRun; }
42
43     bool rpmNoSignature() const
44     { return _rpmNoSignature; }
45
46     bool syncPoolAfterCommit() const
47     { return _syncPoolAfterCommit; }
48
49   public:
50     /** Restrict commit to a certain media number
51      * \deprecated
52      */
53     ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r )
54     { _restrictToMedia = mediaNr_r; return *this; }
55
56     /** Process all media (default) */
57     ZYppCommitPolicy & allMedia()
58     { return restrictToMedia( 0 ); }
59
60     /** Set dry run (default: false) */
61     ZYppCommitPolicy & dryRun( bool yesNo_r = true )
62     { _dryRun = yesNo_r; return *this; }
63
64     /** Use rpm option --nosignature (default: false) */
65     ZYppCommitPolicy & rpmNoSignature( bool yesNo_r = true )
66     { _rpmNoSignature = yesNo_r; return *this; }
67
68     /** Kepp pool in sync with the Target databases after commit (default: true) */
69     ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r = true )
70     { _syncPoolAfterCommit = yesNo_r; return *this; }
71
72   private:
73     unsigned _restrictToMedia;
74     bool     _dryRun;
75     bool     _rpmNoSignature;
76     bool     _syncPoolAfterCommit;
77   };
78   ///////////////////////////////////////////////////////////////////
79
80   /** \relates ZYppCommitPolicy Stream output. */
81   std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
82
83   /////////////////////////////////////////////////////////////////
84 } // namespace zypp
85 ///////////////////////////////////////////////////////////////////
86 #endif // ZYPP_ZYPPCOMMITPOLICY_H