00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #include <iostream> 00013 //#include "zypp/base/Logger.h" 00014 00015 #include "zypp/ui/Selectable.h" 00016 #include "zypp/ui/SelectableImpl.h" 00017 00019 namespace zypp 00020 { 00021 00022 namespace ui 00023 { 00024 00026 // 00027 // METHOD NAME : Selectable::Selectable 00028 // METHOD TYPE : Ctor 00029 // 00030 Selectable::Selectable( Impl_Ptr pimpl_r ) 00031 : _pimpl( pimpl_r ) 00032 {} 00033 00035 // 00036 // METHOD NAME : Selectable::~Selectable 00037 // METHOD TYPE : Dtor 00038 // 00039 Selectable::~Selectable() 00040 {} 00041 00043 // 00044 // Forward to implementation. 00045 // Restrict PoolItems to ResObject::constPtr! 00046 // 00048 00049 ResObject::Kind Selectable::kind() const 00050 { return _pimpl->kind(); } 00051 00052 const std::string & Selectable::name() const 00053 { return _pimpl->name(); } 00054 00055 Status Selectable::status() const 00056 { return _pimpl->status(); } 00057 00058 bool Selectable::set_status( const Status state_r ) 00059 { return _pimpl->set_status( state_r ); } 00060 00061 ResObject::constPtr Selectable::installedObj() const 00062 { return _pimpl->installedObj(); } 00063 00064 PoolItem Selectable::installedPoolItem() const 00065 { return _pimpl->installedObj(); } 00066 00067 ResObject::constPtr Selectable::candidateObj() const 00068 { return _pimpl->candidateObj(); } 00069 00070 PoolItem Selectable::candidatePoolItem() const 00071 { return _pimpl->candidateObj(); } 00072 00073 ResObject::constPtr Selectable::setCandidate( ResObject::constPtr byUser_r ) 00074 { return _pimpl->setCandidate( byUser_r ); } 00075 00076 ResObject::constPtr Selectable::theObj() const 00077 { return _pimpl->theObj(); } 00078 00079 Selectable::size_type Selectable::availableObjs() const 00080 { return _pimpl->availableObjs(); } 00081 00082 Selectable::available_iterator Selectable::availableBegin() const 00083 { return make_transform_iterator( _pimpl->availableBegin(), 00084 SelectableTraits::TransformToResObjectPtr() ); } 00085 00086 Selectable::available_iterator Selectable::availableEnd() const 00087 { return make_transform_iterator( _pimpl->availableEnd(), 00088 SelectableTraits::TransformToResObjectPtr() ); } 00089 00090 Selectable::availablePoolItem_iterator Selectable::availablePoolItemBegin() const 00091 { return _pimpl->availableBegin(); } 00092 00093 Selectable::availablePoolItem_iterator Selectable::availablePoolItemEnd() const 00094 { return _pimpl->availableEnd(); } 00095 00096 ResStatus::TransactByValue Selectable::modifiedBy() const 00097 { return _pimpl->modifiedBy(); } 00098 00099 bool Selectable::hasLicenceConfirmed() const 00100 { return _pimpl->hasLicenceConfirmed(); } 00101 00102 void Selectable::setLicenceConfirmed( bool val_r ) 00103 { _pimpl->setLicenceConfirmed( val_r ); } 00104 00105 00106 Selectable::Fate Selectable::fate() const 00107 { 00108 switch ( status() ) { 00109 case S_Update: 00110 case S_Install: 00111 case S_AutoUpdate: 00112 case S_AutoInstall: 00113 return TO_INSTALL; 00114 break; 00115 00116 case S_Del: 00117 case S_AutoDel: 00118 return TO_DELETE; 00119 break; 00120 00121 case S_Protected: 00122 case S_Taboo: 00123 case S_KeepInstalled: 00124 case S_NoInst: 00125 break; 00126 } 00127 return UNMODIFIED; 00128 }; 00129 00130 00131 /****************************************************************** 00132 ** 00133 ** FUNCTION NAME : operator<< 00134 ** FUNCTION TYPE : std::ostream & 00135 */ 00136 std::ostream & operator<<( std::ostream & str, const Selectable & obj ) 00137 { 00138 return str << *obj._pimpl; 00139 } 00140 00142 } // namespace ui 00145 } // namespace zypp
1.5.3