- ui::Selectable: added Selectable::setCandidate to explicitly choose a
[platform/upstream/libzypp.git] / zypp / ui / Selectable.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ui/Selectable.cc
10  *
11 */
12 #include <iostream>
13 //#include "zypp/base/Logger.h"
14
15 #include "zypp/ui/Selectable.h"
16 #include "zypp/ui/SelectableImpl.h"
17
18 ///////////////////////////////////////////////////////////////////
19 namespace zypp
20 { /////////////////////////////////////////////////////////////////
21   ///////////////////////////////////////////////////////////////////
22   namespace ui
23   { /////////////////////////////////////////////////////////////////
24
25     ///////////////////////////////////////////////////////////////////
26     //
27     //  METHOD NAME : Selectable::Selectable
28     //  METHOD TYPE : Ctor
29     //
30     Selectable::Selectable( Impl_Ptr pimpl_r )
31     : _pimpl( pimpl_r )
32     {}
33
34     ///////////////////////////////////////////////////////////////////
35     //
36     //  METHOD NAME : Selectable::~Selectable
37     //  METHOD TYPE : Dtor
38     //
39     Selectable::~Selectable()
40     {}
41
42     ///////////////////////////////////////////////////////////////////
43     //
44     // Forward to implementation.
45     // Restrict PoolItems to ResObject::constPtr!
46     //
47     ///////////////////////////////////////////////////////////////////
48
49     ResObject::Kind Selectable::kind() const
50     { return _pimpl->kind(); }
51
52     const std::string & Selectable::name() const
53     { return _pimpl->name(); }
54
55     Status Selectable::status() const
56     { return _pimpl->status(); }
57
58     bool Selectable::set_status( const Status state_r )
59     { return _pimpl->set_status( state_r ); }
60
61     ResObject::constPtr Selectable::installedObj() const
62     { return _pimpl->installedObj(); }
63
64     ResObject::constPtr Selectable::candidateObj() const
65     { return _pimpl->candidateObj(); }
66
67     ResObject::constPtr Selectable::setCandidate( ResObject::constPtr byUser_r )
68     { return _pimpl->setCandidate( byUser_r ); }
69
70     ResObject::constPtr Selectable::theObj() const
71     { return _pimpl->theObj(); }
72
73     Selectable::size_type Selectable::availableObjs() const
74     { return _pimpl->availableObjs(); }
75
76     Selectable::available_iterator Selectable::availableBegin() const
77     { return make_transform_iterator( _pimpl->availableBegin(),
78                                       SelectableTraits::TransformToResObjectPtr() ); }
79
80     Selectable::available_iterator Selectable::availableEnd() const
81     { return make_transform_iterator( _pimpl->availableEnd(),
82                                       SelectableTraits::TransformToResObjectPtr() ); }
83
84     /******************************************************************
85     **
86     **  FUNCTION NAME : operator<<
87     **  FUNCTION TYPE : std::ostream &
88     */
89     std::ostream & operator<<( std::ostream & str, const Selectable & obj )
90     {
91       return str << *obj._pimpl;
92     }
93
94     /////////////////////////////////////////////////////////////////
95   } // namespace ui
96   ///////////////////////////////////////////////////////////////////
97   /////////////////////////////////////////////////////////////////
98 } // namespace zypp
99 ///////////////////////////////////////////////////////////////////