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