ignore
[platform/upstream/libzypp.git] / zypp / ResolverProblem.h
1 /**
2  *
3  * Easy-to use interface to the ZYPP dependency resolver
4  *
5  * Author: Stefan Hundhammer <sh@suse.de>
6  *
7  **/
8
9 #ifndef ZYPP_RESOLVERPROBLEM_H
10 #define ZYPP_RESOLVERPROBLEM_H
11
12 #include <list>
13 #include <string>
14
15 #include "zypp/base/ReferenceCounted.h"
16 #include "zypp/base/PtrTypes.h"
17 #include "zypp/Resolver.h"
18 #include "zypp/ProblemSolution.h"
19
20 /////////////////////////////////////////////////////////////////////////
21 namespace zypp
22 { ///////////////////////////////////////////////////////////////////////
23
24     
25     class ResolverProblem : public base::ReferenceCounted
26     {
27     private:
28
29         /**
30          * Clear all data.
31          * In particular, delete all members of _solutions.
32          **/
33         void clear();
34
35
36         //
37         // Data members
38         //
39
40         Resolver_constPtr       _resolver;
41         std::string             _description;
42         std::string             _details;
43         ProblemSolutionList     _solutions;
44
45     public:
46
47         /**
48          * Constructor.
49          **/
50         ResolverProblem( const std::string & description, const std::string & details );
51
52         /**
53          * Destructor.
54          **/
55         ~ResolverProblem();
56
57         // ---------------------------------- I/O
58
59         friend std::ostream& operator<<(std::ostream&, const ResolverProblem & problem);
60
61         // ---------------------------------- accessors
62
63         /**
64          * Return a one-line description of the problem.
65          **/
66         std::string description() const { return _description; }
67
68         /**
69          * Return a (possibly muti-line) detailed description of the problem
70          * or an empty string if there are no useful details.
71          **/
72         std::string details() const { return _details; }
73
74         /**
75          * Return the possible solutions to this problem.
76          * All problems should have at least 2-3 (mutually exclusive) solutions:
77          *
78          *        -  Undo: Do not perform the offending transaction
79          *       (do not install the package that had unsatisfied requirements,
80          *        do not remove  the package that would break other packages' requirements)
81          *
82          *        - Remove referrers: Remove all packages that would break because
83          *      they depend on the package that is requested to be removed
84          *
85          *        - Ignore: Inject artificial "provides" for a missing requirement
86          *      (pretend that requirement is satisfied)
87          **/
88         ProblemSolutionList solutions() const;
89
90         /**
91          * Return the parent dependency resolver.
92          **/
93         Resolver_constPtr resolver() const { return _resolver; }
94
95         // ---------------------------------- methods
96
97         /**
98          * Add a solution to this problem. This class takes over ownership of
99          * the problem and will delete it when neccessary.
100          **/
101         void addSolution( ProblemSolution_Ptr solution );
102
103     };
104     ///////////////////////////////////////////////////////////////////////
105 };// namespace zypp
106 /////////////////////////////////////////////////////////////////////////
107
108 #endif // ZYPP_RESOLVERPROBLEM_H
109