Selectable::installed_iterator Selectable::installedEnd() const
{ return _pimpl->installedEnd(); }
+ ////////////////////////////////////////////////////////////////////////
+
+ bool Selectable::picklistEmpty() const
+ { return _pimpl->picklistEmpty(); }
+
+ Selectable::picklist_size_type Selectable::picklistSize() const
+ { return _pimpl->picklistSize(); }
+
+ Selectable::picklist_iterator Selectable::picklistBegin() const
+ { return _pimpl->picklistBegin(); }
+
+ Selectable::picklist_iterator Selectable::picklistEnd() const
+ { return _pimpl->picklistEnd(); }
////////////////////////////////////////////////////////////////////////
bool Selectable::pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r )
{ return _pimpl->pickDelete( pi_r, causer_r, yesno_r ); }
+ Status Selectable::pickStatus( const PoolItem & pi_r ) const
+ { return _pimpl->pickStatus( pi_r ); }
+
////////////////////////////////////////////////////////////////////////
bool Selectable::isUndetermined() const
typedef SelectableTraits::installed_iterator installed_iterator;
typedef SelectableTraits::installed_size_type installed_size_type;
+ typedef SelectableTraits::picklist_iterator picklist_iterator;
+ typedef SelectableTraits::picklist_size_type picklist_size_type;
+
public:
/** \name Static ctor substitues picking the item from the pool.
* \code
////////////////////////////////////////////////////////////////////////
- /** \name Insatlled objects iterators.
+ /** \name Installed objects iterators.
* Ordered by install time. Latest first.
*/
//@{
////////////////////////////////////////////////////////////////////////
+ /** \name picklist iterators.
+ * This is basically the available items list prepended by those
+ * installed items, that are nolonger \ref identicalAvailable.
+ */
+ //@{
+ bool picklistEmpty() const;
+ picklist_size_type picklistSize() const;
+ picklist_iterator picklistBegin() const;
+ picklist_iterator picklistEnd() const;
+ //}
+
+ ////////////////////////////////////////////////////////////////////////
+
public:
/** \name Query for objects within this Selectable.
*/
*/
bool pickNoDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER )
{ return pickDelete( pi_r, causer_r, false ); }
+
+ /** Compute the \ref ui::Status for an individual PoolItem.
+ * This just takes into account the item and any identical
+ * installed (or available) one.
+ * \code
+ * Assume there are 3 identical 'foo-1.1 (vendor A)' items,
+ * one 'foo-2.1 (vendor A)' and one ''foo-1.1 (vendor B)':
+ *
+ * installed: . foo-1.1 (vendor A) -> S_KeepInstalled
+ * available: foo-2.1 (vendor A) (repo 1) -> S_NoInst
+ * . foo-1.1 (vendor A) (repo 1) -> S_KeepInstalled
+ * . foo-1.1 (vendor A) (repo 2) -> S_KeepInstalled
+ * foo-1.1 (vendor B) (repo 3) -> S_NoInst
+ *
+ * After 'foo-1.1 (vendor A) (repo 1)' was selected to be installed:
+ *
+ * installed: . foo-1.1 (vendor A) -> S_Update
+ * available: foo-2.1 (vendor A) (repo 1) -> S_NoInst
+ * I foo-1.1 (vendor A) (repo 1) -> S_Update
+ * . foo-1.1 (vendor A) (repo 2) -> S_KeepInstalled
+ * foo-1.1 (vendor B) (repo 3) -> S_NoInst
+ * \endcode
+ * \see \ref sat::Solvable::identical
+ */
+ Status pickStatus( const PoolItem & pi_r ) const;
//@}
/** \name Classification of available patches (pseudo installed items).
return _candidate = newCandidate;
}
+
bool Selectable::Impl::pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r )
{
if ( pi_r.satSolvable().ident() != ident() || pi_r.satSolvable().isSystem() )
return pi_r.status().setTransact( yesno_r, causer_r );
}
+ Status Selectable::Impl::pickStatus( const PoolItem & pi_r ) const
+ {
+ return status();
+ }
+
+
ResStatus::TransactByValue Selectable::Impl::modifiedBy() const
{
PoolItem cand( candidateObj() );
typedef SelectableTraits::installed_const_iterator installed_const_iterator;
typedef SelectableTraits::installed_size_type installed_size_type;
+ typedef SelectableTraits::PickList PickList;
+
public:
template <class _Iterator>
Impl( const ResObject::Kind & kind_r,
////////////////////////////////////////////////////////////////////////
+ const PickList & picklist() const
+ {
+ if ( ! _picklistPtr )
+ {
+ _picklistPtr.reset( new PickList( _availableItems.size() ) );
+ // installed without identical avaialble first:
+ for_( it, _installedItems.begin(), _installedItems.end() )
+ {
+ if ( ! identicalAvailable( *it ) )
+ _picklistPtr->push_back( *it );
+ }
+ _picklistPtr->insert( _picklistPtr->end(), availableBegin(), availableEnd() );
+ }
+ return *_picklistPtr;
+ }
+
+ bool picklistEmpty() const
+ { return picklist().empty(); }
+
+ picklist_size_type picklistSize() const
+ { return picklist().size(); }
+
+ picklist_iterator picklistBegin() const
+ { return picklist().begin(); }
+
+ picklist_iterator picklistEnd() const
+ { return picklist().end(); }
+
+ ////////////////////////////////////////////////////////////////////////
+
bool isUnmaintained() const
{ return availableEmpty(); }
bool pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r );
+ Status pickStatus( const PoolItem & pi_r ) const;
+
////////////////////////////////////////////////////////////////////////
bool isUndetermined() const
AvailableItemSet _availableItems;
//! Best among availabe with restpect to installed.
PoolItem _defaultCandidate;
-
//! The object selected by setCandidateObj() method.
PoolItem _candidate;
+ //! lazy initialized picklist
+ mutable scoped_ptr<PickList> _picklistPtr;
};
///////////////////////////////////////////////////////////////////
#define ZYPP_UI_SELECTABLETRAITS_H
#include <set>
+#include <vector>
#include "zypp/base/Iterator.h"
#include "zypp/PoolItem.h"
typedef AvailableItemSet::const_iterator installed_const_iterator;
typedef AvailableItemSet::size_type installed_size_type;
- };
+ typedef std::vector<PoolItem> PickList;
+ typedef PickList::const_iterator picklist_iterator;
+ typedef PickList::size_type picklist_size_type;
+ };
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////