Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / solver / detail / SystemCheck.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/target/SystemCheck.h
10  *
11 */
12 #ifndef ZYPP_TARGET_SYSTEMCHECK_H
13 #define ZYPP_TARGET_SYSTEMCHECK_H
14 #ifndef ZYPP_USE_RESOLVER_INTERNALS
15 #error Do not directly include this file!
16 #else
17
18 #include <iosfwd>
19
20 #include "zypp/base/NonCopyable.h"
21 #include "zypp/Capability.h"
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26     ///////////////////////////////////////////////////////////////////
27     //
28     //  CLASS NAME : SystemCheck
29     //
30     /** Save and restore locale set from file.
31      */
32     class SystemCheck : private base::NonCopyable
33     {
34       friend std::ostream & operator<<( std::ostream & str, const SystemCheck & obj );
35
36       public:
37
38         /** Singleton */
39         static const SystemCheck & instance();
40
41         /** Return the file path. */
42         const Pathname & file();
43
44         /** Return the directory path. */
45         const Pathname & dir();
46
47         /** Set configuration file of system requirements
48          *  Should be used for testcase only   
49          */
50         bool setFile(const Pathname & file) const;
51
52         /** Set configuration directory for files of system
53          *  requirements.
54          *  Should be used for testcase only
55          */
56         bool setDir(const Pathname & dir) const;
57
58         /** Returns a list of required system capabilities.
59         */
60         const CapabilitySet & requiredSystemCap() const;
61
62         /** Returns a list of conflicting system capabilities.
63         */
64         const CapabilitySet & conflictSystemCap() const;
65
66       private:
67         /** Ctor taking the file to read. */
68         SystemCheck();
69         bool loadFile(Pathname &file, bool reset_caps = true) const;
70         bool loadFiles() const;
71     };
72     ///////////////////////////////////////////////////////////////////
73
74     /** \relates SystemCheck Stream output */
75     std::ostream & operator<<( std::ostream & str, const SystemCheck & obj );
76
77   /////////////////////////////////////////////////////////////////
78 } // namespace zypp
79 ///////////////////////////////////////////////////////////////////
80 #endif // ZYPP_USE_RESOLVER_INTERNALS
81 #endif // ZYPP_TARGET_SYSTEMCHECK_H