Move DownloadMode into its own header file and add deserialization.
[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 #include "zypp/base/PtrTypes.h"
18
19 #include "zypp/DownloadMode.h"
20 #include "zypp/target/rpm/RpmFlags.h"
21
22 ///////////////////////////////////////////////////////////////////
23 namespace zypp
24 { /////////////////////////////////////////////////////////////////
25
26   ///////////////////////////////////////////////////////////////////
27   //
28   //    CLASS NAME : ZYppCommitPolicy
29   //
30   /** */
31   class ZYppCommitPolicy
32   {
33     public:
34
35       ZYppCommitPolicy();
36
37     public:
38       /** Restrict commit to media 1.
39        * Fake outstanding YCP fix: Honour restriction to media 1
40        * at installation, but install all remaining packages if
41        * post-boot (called with <tt>mediaNr_r &gt; 1</tt>).
42        */
43       ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r );
44
45       /** Process all media (default) */
46       ZYppCommitPolicy & allMedia()
47       { return restrictToMedia( 0 ); }
48
49       unsigned restrictToMedia() const;
50
51
52       /** Set dry run (default: false).
53        * Dry-run should not change anything on the system, unless
54        * the \ref downloadMode is set to \ref DownloadOnly. In that
55        * case packages are downloaded to the local cache.
56       */
57       ZYppCommitPolicy & dryRun( bool yesNo_r );
58
59       bool dryRun() const;
60
61
62       /** Commit download policy to use. (default: \ref DownloadDefault)
63        *  \note \ref DownloadOnly also implies a \ref dryRun.
64        */
65       ZYppCommitPolicy & downloadMode( DownloadMode val_r );
66
67       DownloadMode downloadMode() const;
68
69
70       /** The default \ref target::rpm::RpmInstFlags. (default: none)*/
71       ZYppCommitPolicy &  rpmInstFlags( target::rpm::RpmInstFlags newFlags_r );
72
73       /** Use rpm option --nosignature (default: false) */
74       ZYppCommitPolicy & rpmNoSignature( bool yesNo_r );
75
76       /** Use rpm option --excludedocs (default: false) */
77       ZYppCommitPolicy & rpmExcludeDocs( bool yesNo_r );
78
79       target::rpm::RpmInstFlags rpmInstFlags() const;
80
81       bool rpmNoSignature() const;
82
83       bool rpmExcludeDocs() const;
84
85
86       /** Kepp pool in sync with the Target databases after commit (default: true) */
87       ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r );
88
89       bool syncPoolAfterCommit() const;
90
91     public:
92       /** Implementation  */
93       class Impl;
94     private:
95       /** Pointer to data. */
96       RWCOW_pointer<Impl> _pimpl;
97   };
98   ///////////////////////////////////////////////////////////////////
99
100   /** \relates ZYppCommitPolicy Stream output. */
101   std::ostream & operator<<( std::ostream & str, const ZYppCommitPolicy & obj );
102
103   /////////////////////////////////////////////////////////////////
104 } // namespace zypp
105 ///////////////////////////////////////////////////////////////////
106 #endif // ZYPP_ZYPPCOMMITPOLICY_H