Imported Upstream version 16.3.1
[platform/upstream/libzypp.git] / zypp / solver / detail / ItemCapKind.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/solver/detail/ItemCapKind.h
10  *
11 */
12
13 #ifndef ZYPP_SOLVER_DETAIL_ITEMCAPKIND_H
14 #define ZYPP_SOLVER_DETAIL_ITEMCAPKIND_H
15 #ifndef ZYPP_USE_RESOLVER_INTERNALS
16 #error Do not directly include this file!
17 #else
18
19 ///////////////////////////////////////////////////////////////////
20 namespace zypp
21 {
22   ///////////////////////////////////////////////////////////////////
23   namespace solver
24   {
25     ///////////////////////////////////////////////////////////////////
26     namespace detail
27     {
28       ///////////////////////////////////////////////////////////////////
29       /// \class ItemCapKind
30       ///////////////////////////////////////////////////////////////////
31       struct ItemCapKind
32       {
33       public:
34         ItemCapKind() : _pimpl( new Impl ) {}
35
36         ItemCapKind( PoolItem i, Capability c, Dep k, bool initial ) : _pimpl( new Impl( i, c, k, initial ) ) {}
37
38         /** Capability which has triggerd this selection */
39         Capability cap() const
40         { return _pimpl->_cap; }
41
42         /** Kind of that capability */
43         Dep capKind() const
44         { return _pimpl->_capKind; }
45
46         /** Item which has triggered this selection */
47         PoolItem item() const
48         { return _pimpl->_item; }
49
50         /** This item has triggered the installation (Not already fullfilled requierement only). */
51         bool initialInstallation() const
52         { return _pimpl->_initialInstallation; }
53
54       private:
55         struct Impl
56         {
57           Impl()
58           : _capKind( Dep::PROVIDES )
59           , _initialInstallation( false )
60           {}
61
62           Impl( PoolItem i, Capability c, Dep k, bool initial )
63           : _cap( c )
64           , _capKind( k )
65           , _item( i )
66           , _initialInstallation( initial )
67           {}
68
69           Capability    _cap;
70           Dep           _capKind;
71           PoolItem      _item;
72           bool          _initialInstallation;
73
74         private:
75           friend Impl * rwcowClone<Impl>( const Impl * rhs );
76           /** clone for RWCOW_pointer */
77           Impl * clone() const
78           { return new Impl( *this ); }
79         };
80         RWCOW_pointer<Impl> _pimpl;
81       };
82
83       typedef std::multimap<PoolItem,ItemCapKind> ItemCapKindMap;
84       typedef std::list<ItemCapKind> ItemCapKindList;
85
86     } // namespace detail
87     ///////////////////////////////////////////////////////////////////
88   } // namespace solver
89   ///////////////////////////////////////////////////////////////////
90 } // namespace zypp
91 ///////////////////////////////////////////////////////////////////
92 #endif // ZYPP_USE_RESOLVER_INTERNALS
93 #endif // ZYPP_SOLVER_DETAIL_ITEMCAPKIND_H