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 ResObject::constPtr Selectable::candidateObj() const 00065 { return _pimpl->candidateObj(); } 00066 00067 ResObject::constPtr Selectable::setCandidate( ResObject::constPtr byUser_r ) 00068 { return _pimpl->setCandidate( byUser_r ); } 00069 00070 ResObject::constPtr Selectable::theObj() const 00071 { return _pimpl->theObj(); } 00072 00073 Selectable::size_type Selectable::availableObjs() const 00074 { return _pimpl->availableObjs(); } 00075 00076 Selectable::available_iterator Selectable::availableBegin() const 00077 { return make_transform_iterator( _pimpl->availableBegin(), 00078 SelectableTraits::TransformToResObjectPtr() ); } 00079 00080 Selectable::available_iterator Selectable::availableEnd() const 00081 { return make_transform_iterator( _pimpl->availableEnd(), 00082 SelectableTraits::TransformToResObjectPtr() ); } 00083 00084 ResStatus::TransactByValue Selectable::modifiedBy() const 00085 { return _pimpl->modifiedBy(); } 00086 00087 bool Selectable::hasLicenceConfirmed() const 00088 { return _pimpl->hasLicenceConfirmed(); } 00089 00090 void Selectable::setLicenceConfirmed( bool val_r ) 00091 { _pimpl->setLicenceConfirmed( val_r ); } 00092 00093 00094 Selectable::Fate Selectable::fate() const 00095 { 00096 switch ( status() ) { 00097 case S_Update: 00098 case S_Install: 00099 case S_AutoUpdate: 00100 case S_AutoInstall: 00101 return TO_INSTALL; 00102 break; 00103 00104 case S_Del: 00105 case S_AutoDel: 00106 return TO_DELETE; 00107 break; 00108 00109 case S_Protected: 00110 case S_Taboo: 00111 case S_KeepInstalled: 00112 case S_NoInst: 00113 break; 00114 } 00115 return UNMODIFIED; 00116 }; 00117 00118 00119 /****************************************************************** 00120 ** 00121 ** FUNCTION NAME : operator<< 00122 ** FUNCTION TYPE : std::ostream & 00123 */ 00124 std::ostream & operator<<( std::ostream & str, const Selectable & obj ) 00125 { 00126 return str << *obj._pimpl; 00127 } 00128 00130 } // namespace ui 00133 } // namespace zypp