libzypp  17.35.11
SolutionAction.h
Go to the documentation of this file.
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_SOLVER_DETAIL_SOLUTIONACTION_H
10 #define ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
11 #ifndef ZYPP_USE_RESOLVER_INTERNALS
12 #error Do not directly include this file!
13 #else
14 
15 #include <list>
16 #include <string>
17 
19 #include <zypp/base/PtrTypes.h>
20 
21 #include <zypp/PoolItem.h>
22 
24 namespace zypp
25 {
26  namespace solver
28  {
29  namespace detail
31  {
32 
33  class Resolver;
34 
36 
37  DEFINE_PTR_TYPE(SolutionAction);
38  typedef std::list<SolutionAction_Ptr> SolutionActionList;
39 
43  class SolutionAction : public base::ReferenceCounted
44  {
45  protected:
46  typedef Resolver ResolverInternal;
47  SolutionAction();
48 
49  public:
50  virtual ~SolutionAction();
51 
52  virtual std::ostream & dumpOn( std::ostream & str ) const;
53 
58  virtual bool execute( ResolverInternal & resolver ) const = 0;
59 
60  public:
62  virtual PoolItem item() const;
63 
65  virtual bool skipsPatchesOnly() const;
66  };
67 
68  inline std::ostream & operator<<( std::ostream & str, const SolutionAction & action )
69  { return action.dumpOn( str ); }
70 
71  std::ostream & operator<<( std::ostream & str, const SolutionActionList & actionlist );
72 
73 
79  typedef enum
80  {
81  KEEP,
82  INSTALL,
83  REMOVE,
84  UNLOCK,
85  LOCK,
86  REMOVE_EXTRA_REQUIRE,
87  REMOVE_EXTRA_CONFLICT,
88  ADD_SOLVE_QUEUE_ITEM,
89  REMOVE_SOLVE_QUEUE_ITEM,
90  } TransactionKind;
91 
92  class TransactionSolutionAction: public SolutionAction
93  {
94  public:
95  TransactionSolutionAction( PoolItem item, TransactionKind action )
96  : SolutionAction()
97  , _action( action )
98  , _item( item )
99  {}
100 
101  TransactionSolutionAction( Capability capability, TransactionKind action )
102  : SolutionAction()
103  , _action( action )
104  , _capability( capability )
105  {}
106 
107  TransactionSolutionAction( SolverQueueItem_Ptr item, TransactionKind action )
108  : SolutionAction()
109  , _action( action )
110  , _solverQueueItem( item )
111  {}
112 
113  TransactionSolutionAction( TransactionKind action )
114  : SolutionAction()
115  , _action( action )
116  {}
117 
118  std::ostream & dumpOn( std::ostream & str ) const override;
119 
120  bool execute( ResolverInternal & resolver ) const override;
121 
122  public:
123  PoolItem item() const override
124  { return _item; }
125 
126  bool skipsPatchesOnly() const override;
127 
128  protected:
129  const TransactionKind _action;
130 
131  PoolItem _item;
132  Capability _capability;
133  SolverQueueItem_Ptr _solverQueueItem;
134  };
135 
136 
140  typedef enum
141  {
142  WEAK
143  } InjectSolutionKind;
144 
152  class InjectSolutionAction: public SolutionAction
153  {
154  public:
155  InjectSolutionAction( PoolItem item, const InjectSolutionKind & kind )
156  : SolutionAction()
157  , _kind( kind )
158  , _item( item )
159  {}
160 
161  std::ostream & dumpOn( std::ostream & str ) const override;
162 
163  bool execute( ResolverInternal & resolver ) const override;
164 
165  public:
166  PoolItem item() const override
167  { return _item; }
168 
169  protected:
170  const InjectSolutionKind _kind;
171 
172  PoolItem _item;
173  };
174 
175 
177  };// namespace detail
180  };// namespace solver
183 };// namespace zypp
185 #endif // ZYPP_USE_RESOLVER_INTERNALS
186 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
187 
String related utilities and Regular expression matching.
Resolver ResolverInternal
Preferred name in API.
Definition: Types.h:39
DEFINE_PTR_TYPE(HelixResolvable)
std::ostream & operator<<(std::ostream &str, const SolutionActionList &actionlist)
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:580
std::list< SolutionAction_Ptr > SolutionActionList
Definition: Types.h:48
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19