X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=zypp%2Fui%2FSelectableImpl.h;h=4bafbf05263b6e48dc26295ab4115e8988596fb6;hb=f2f36ebec8b34e01f91f190cbd0b9f4d3c2c4510;hp=9bdf40561aad50d9a3e6ea59df50d528341ef2e2;hpb=d492bc6ff98c3a2917afcaad406ef9586a9ba8f5;p=platform%2Fupstream%2Flibzypp.git diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h index 9bdf405..4bafbf0 100644 --- a/zypp/ui/SelectableImpl.h +++ b/zypp/ui/SelectableImpl.h @@ -56,11 +56,11 @@ namespace zypp typedef SelectableTraits::PickList PickList; public: - template - Impl( const ResKind & kind_r, + template + Impl( const ResObject::Kind & kind_r, const std::string & name_r, - TIterator begin_r, - TIterator end_r ) + _Iterator begin_r, + _Iterator end_r ) : _ident( sat::Solvable::SplitIdent( kind_r, name_r ).ident() ) , _kind( kind_r ) , _name( name_r ) @@ -80,7 +80,7 @@ namespace zypp { return _ident; } /** */ - ResKind kind() const + ResObject::Kind kind() const { return _kind; } /** */ @@ -127,10 +127,10 @@ namespace zypp */ PoolItem candidateObjFrom( Repository repo_r ) const { - for ( const PoolItem & pi : available() ) + for_( it, availableBegin(), availableEnd() ) { - if ( pi.repository() == repo_r ) - return pi; + if ( (*it)->repository() == repo_r ) + return *it; } return PoolItem(); } @@ -175,10 +175,10 @@ namespace zypp PoolItem highestAvailableVersionObj() const { PoolItem ret; - for ( const PoolItem & pi : available() ) + for_( it, availableBegin(), availableEnd() ) { - if ( !ret || pi.edition() > ret.edition() ) - ret = pi; + if ( !ret || (*it).satSolvable().edition() > ret.satSolvable().edition() ) + ret = *it; } return ret; } @@ -236,15 +236,12 @@ namespace zypp available_size_type availableSize() const { return _availableItems.size(); } - available_iterator availableBegin() const + available_const_iterator availableBegin() const { return _availableItems.begin(); } - available_iterator availableEnd() const + available_const_iterator availableEnd() const { return _availableItems.end(); } - inline Iterable available() const - { return makeIterable( availableBegin(), availableEnd() ); } - //////////////////////////////////////////////////////////////////////// bool installedEmpty() const @@ -259,9 +256,6 @@ namespace zypp installed_iterator installedEnd() const { return _installedItems.end(); } - inline Iterable installed() const - { return makeIterable( installedBegin(), installedEnd() ); } - //////////////////////////////////////////////////////////////////////// const PickList & picklist() const @@ -270,10 +264,10 @@ namespace zypp { _picklistPtr.reset( new PickList ); // installed without identical avaialble first: - for ( const PoolItem & pi : installed() ) + for_( it, _installedItems.begin(), _installedItems.end() ) { - if ( ! identicalAvailable( pi ) ) - _picklistPtr->push_back( pi ); + if ( ! identicalAvailable( *it ) ) + _picklistPtr->push_back( *it ); } _picklistPtr->insert( _picklistPtr->end(), availableBegin(), availableEnd() ); } @@ -298,14 +292,7 @@ namespace zypp { return availableEmpty(); } bool multiversionInstall() const - { - for ( const PoolItem & pi : picklist() ) - { - if ( pi.multiversionInstall() ) - return true; - } - return false; - } + { return sat::Pool::instance().isMultiversion( ident() ); } bool pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r ); @@ -352,20 +339,20 @@ namespace zypp private: PoolItem transactingInstalled() const { - for ( const PoolItem & pi : installed() ) + for_( it, installedBegin(), installedEnd() ) { - if ( pi.status().transacts() ) - return pi; + if ( (*it).status().transacts() ) + return (*it); } return PoolItem(); } PoolItem transactingCandidate() const { - for ( const PoolItem & pi : available() ) + for_( it, availableBegin(), availableEnd() ) { - if ( pi.status().transacts() ) - return pi; + if ( (*it).status().transacts() ) + return (*it); } return PoolItem(); } @@ -376,23 +363,25 @@ namespace zypp { // prefer the installed objects arch and vendor bool solver_allowVendorChange( ResPool::instance().resolver().allowVendorChange() ); - for ( const PoolItem & ipi : installed() ) + for ( installed_const_iterator iit = installedBegin(); + iit != installedEnd(); ++iit ) { PoolItem sameArch; // in case there's no same vendor at least stay with same arch. - for ( const PoolItem & api : available() ) + for ( available_const_iterator it = availableBegin(); + it != availableEnd(); ++it ) { // 'same arch' includes allowed changes to/from noarch. - if ( ipi.arch() == api.arch() || ipi.arch() == Arch_noarch || api.arch() == Arch_noarch ) + if ( (*iit)->arch() == (*it)->arch() || (*iit)->arch() == Arch_noarch || (*it)->arch() == Arch_noarch ) { if ( ! solver_allowVendorChange ) { - if ( VendorAttr::instance().equivalent( ipi, api ) ) - return api; + if ( VendorAttr::instance().equivalent( (*iit), (*it) ) ) + return *it; else if ( ! sameArch ) // remember best same arch in case no same vendor found - sameArch = api; + sameArch = *it; } else // same arch is sufficient - return api; + return *it; } } if ( sameArch ) @@ -407,9 +396,10 @@ namespace zypp bool allCandidatesLocked() const { - for ( const PoolItem & pi : available() ) + for ( available_const_iterator it = availableBegin(); + it != availableEnd(); ++it ) { - if ( ! pi.status().isLocked() ) + if ( ! (*it).status().isLocked() ) return false; } return( ! _availableItems.empty() ); @@ -417,9 +407,10 @@ namespace zypp bool allInstalledLocked() const { - for ( const PoolItem & pi : installed() ) + for ( installed_const_iterator it = installedBegin(); + it != installedEnd(); ++it ) { - if ( ! pi.status().isLocked() ) + if ( ! (*it).status().isLocked() ) return false; } return( ! _installedItems.empty() ); @@ -428,7 +419,7 @@ namespace zypp private: const IdString _ident; - const ResKind _kind; + const ResObject::Kind _kind; const std::string _name; InstalledItemSet _installedItems; AvailableItemSet _availableItems; @@ -460,14 +451,14 @@ namespace zypp { PoolItem icand( obj.installedObj() ); str << " (I " << obj.installedSize() << ") {" << endl; - for ( const PoolItem & pi : obj.installed() ) + for_( it, obj.installedBegin(), obj.installedEnd() ) { char t = ' '; - if ( pi == icand ) + if ( *it == icand ) { t = 'i'; } - str << " " << t << " " << pi << endl; + str << " " << t << " " << *it << endl; } str << "} "; } @@ -481,18 +472,18 @@ namespace zypp PoolItem cand( obj.candidateObj() ); PoolItem up( obj.updateCandidateObj() ); str << "(A " << obj.availableSize() << ") {" << endl; - for ( const PoolItem & pi : obj.available() ) + for_( it, obj.availableBegin(), obj.availableEnd() ) { char t = ' '; - if ( pi == cand ) + if ( *it == cand ) { - t = pi == up ? 'C' : 'c'; + t = *it == up ? 'C' : 'c'; } - else if ( pi == up ) + else if ( *it == up ) { t = 'u'; } - str << " " << t << " " << pi << endl; + str << " " << t << " " << *it << endl; } str << "} "; } @@ -506,18 +497,18 @@ namespace zypp PoolItem cand( obj.candidateObj() ); PoolItem up( obj.updateCandidateObj() ); str << "(P " << obj.picklistSize() << ") {" << endl; - for ( const PoolItem & pi : obj.picklist() ) + for_( it, obj.picklistBegin(), obj.picklistEnd() ) { char t = ' '; - if ( pi == cand ) + if ( *it == cand ) { - t = pi == up ? 'C' : 'c'; + t = *it == up ? 'C' : 'c'; } - else if ( pi == up ) + else if ( *it == up ) { t = 'u'; } - str << " " << t << " " << pi << "\t" << obj.pickStatus( pi ) << endl; + str << " " << t << " " << *it << "\t" << obj.pickStatus( *it ) << endl; } str << "} "; }