public:
- bool isSatisfied() const
+ bool isRelevant() const
{
- return _resolvable->isSatisfied();
+ return true;
}
- bool isRelevant() const
+ bool isSatisfied() const
{
- return _resolvable->isRelevant();
+ return true;
}
- bool validate() const
+ bool isBroken() const
{
- return _resolvable->validate();
- }
+ return true;
+ }
private:
mutable ResStatus _status;
ResStatus & PoolItem::statusReset() const
{ return _pimpl->statusReset(); }
+ bool PoolItem::isRelevant() const
+ { return _pimpl->isSatisfied(); }
+
bool PoolItem::isSatisfied() const
{ return _pimpl->isSatisfied(); }
- ResObject::constPtr PoolItem::resolvable() const
- { return _pimpl->resolvable(); }
+ bool PoolItem::isBroken() const
+ { return _pimpl->isSatisfied(); }
void PoolItem::saveState() const
{ _pimpl->saveState(); }
bool PoolItem::sameState() const
{ return _pimpl->sameState(); }
+ ResObject::constPtr PoolItem::resolvable() const
+ { return _pimpl->resolvable(); }
+
/******************************************************************
**
** FUNCTION NAME : operator<<
~PoolItem();
public:
+ /** \name Status related methods. */
+ //@{
/** Returns the current status. */
ResStatus & status() const;
/** Reset status. */
ResStatus & statusReset() const;
- /** Whether the items requirements are met. */
- bool isSatisfied() const;
-
- /** Whether the items requirements are broken. */
- bool isBroken() const
- { return ! isSatisfied(); }
- /** Returns true if the solvable is relevant which means e.G. for patches
+ /** \name Status validation.
+ *
+ */
+ //@{
+ /** Returns true if the solvable is relevant which means e.g. for patches
* that at least one package of the patch is installed.
*/
bool isRelevant() const;
- /** Check if the solvable is satisfied,broken or not relevant
- * (not important, so it can be ignored)
- * \return BROKEN, SATISFIED, NOTRELEVANT
- */
- ValidValue validate() const;
+ /** Whether a relevant items requirements are met. */
+ bool isSatisfied() const;
+ /** Whether a relevant items requirements are broken. */
+ bool isBroken() const;
+ //@}
+
+ //@}
public:
/** Return the \ref ResPool the item belongs to. */
ResPool pool() const;
*/
#include "zypp/Resolvable.h"
#include "zypp/ResObject.h"
-
+#include "zypp/PoolItem.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//
+ // METHOD NAME : Resolvable::poolItem
+ // METHOD TYPE : PoolItem
+ //
+ PoolItem Resolvable::poolItem() const
+ { return PoolItem( *this ); }
+
+ ///////////////////////////////////////////////////////////////////
+ //
// METHOD NAME : Resolvable::dumpOn
// METHOD TYPE : std::ostream &
//
{ /////////////////////////////////////////////////////////////////
struct NVRAD;
+ class PoolItem;
///////////////////////////////////////////////////////////////////
//
//@}
public:
- /** Returns true if the solvable is satisfied */
- using sat::Solvable::isSatisfied;
-
- /** Returns true if the solvable is satisfied */
- using sat::Solvable::isBroken;
-
- /** Returns true if the solvable is relevant which means e.G. for patches
- * that at least one package of the patch is installed.
- */
- using sat::Solvable::isRelevant;
-
- /** Check if the solvable is satisfied,broken or not relevant
- * (not important, so it can be ignored)
- * \return BROKEN, SATISFIED, NOTRELEVANT
- */
- using sat::Solvable::validate;
-
- public:
+ /** Access the corresponding \ref sat:::Solvable. */
const sat::Solvable & satSolvable() const { return *this; }
+ /** Access the corresponding \ref PoolItem. */
+ PoolItem poolItem() const;
+
protected:
/** Ctor */
Resolvable( const sat::Solvable & solvable_r );
//#include "zypp/base/Logger.h"
#include "zypp/sat/SolvIterMixin.h"
+#include "zypp/sat/Solvable.h"
#include "zypp/ResPoolProxy.h"
using std::endl;
namespace zypp
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- namespace ui
+ namespace sat
{ /////////////////////////////////////////////////////////////////
- Selectable_Ptr asSelectable::operator()( const sat::Solvable & sov_r ) const
+ namespace solvitermixin_detail
+ {
+ bool UnifyByIdent::operator()( const Solvable & solv_r ) const
{
- return ResPool::instance().proxy().lookup( sov_r );
+ return( solv_r && _uset->insert( solv_r.ident().id() ).second );
}
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ namespace ui
+ { /////////////////////////////////////////////////////////////////
+
+ Selectable_Ptr asSelectable::operator()( const sat::Solvable & sov_r ) const
+ {
+ return ResPool::instance().proxy().lookup( sov_r );
+ }
/////////////////////////////////////////////////////////////////
} // namespace ui
#include "zypp/base/PtrTypes.h"
#include "zypp/base/Iterator.h"
+#include "zypp/base/Tr1hash.h"
///////////////////////////////////////////////////////////////////
namespace zypp
class Solvable;
+ namespace solvitermixin_detail
+ {
+ /** Unify by \c ident \c (kind:name).
+ * Return true on the 1st appearance of a new \c ident. This is
+ * used in \ref SolvIterMixin when mapping a Solvable iterator
+ * to a Selectable iterator.
+ */
+ struct UnifyByIdent
+ {
+ bool operator()( const Solvable & solv_r ) const;
+
+ typedef std::tr1::unordered_set<unsigned> Uset;
+ UnifyByIdent()
+ : _uset( new Uset )
+ {}
+ shared_ptr<Uset> _uset;
+ };
+ } // namespace solvitermixin_detail
+
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : SolvIterMixin<Derived,DerivedSolvable_iterator>
{ return make_transform_iterator( solvableEnd(), asPoolItem() ); }
//@}
+ private:
+ typedef filter_iterator<solvitermixin_detail::UnifyByIdent,Solvable_iterator> UnifiedSolvable_iterator;
+ public:
/** \name Iterate ui::Selectable::Ptr */
//@{
- typedef transform_iterator<ui::asSelectable,Solvable_iterator> Selectable_iterator;
+ typedef transform_iterator<ui::asSelectable,UnifiedSolvable_iterator> Selectable_iterator;
Selectable_iterator selectableBegin() const
- { return make_transform_iterator( solvableBegin(), ui::asSelectable() ); }
+ { return make_transform_iterator( unifiedSolvableBegin(), ui::asSelectable() ); }
Selectable_iterator selectableEnd() const
- { return make_transform_iterator( solvableEnd(), ui::asSelectable() ); }
+ { return make_transform_iterator( unifiedSolvableEnd(), ui::asSelectable() ); }
//@}
private:
+ /** \name Iterate unified Solbvables to be transformed into Selectable. */
+ //@{
+ UnifiedSolvable_iterator unifiedSolvableBegin() const
+ { return make_filter_iterator( solvitermixin_detail::UnifyByIdent(), solvableBegin(), solvableEnd() ); }
+ UnifiedSolvable_iterator unifiedSolvableEnd() const
+ { return make_filter_iterator( solvitermixin_detail::UnifyByIdent(), solvableEnd(), solvableEnd() );; }
+ //@}
+ private:
const Derived & self() const
{ return *static_cast<const Derived*>( this ); }
protected:
}
///////////////////////////////////////////////////////////////////
-
- ValidValue Solvable::validate() const
- {
- NO_SOLVABLE_RETURN( NOTRELEVANT );
- int ret = solvable_trivial_installable_repo (_solvable, Pool::instance().systemRepo().get());
- if (ret == 0)
- return BROKEN;
- else if (ret > 0)
- return SATISFIED;
- else
- return NOTRELEVANT;
- }
-
- bool Solvable::isSatisfied() const
- {
- return validate() == SATISFIED;
- }
-
- bool Solvable::isRelevant() const
- {
- NO_SOLVABLE_RETURN( false );
- if (isKind (ResKind::package))
- return true; // packages are always relevant
-
- return validate() == BROKEN;
- }
-
-
- ///////////////////////////////////////////////////////////////////
namespace
{ /////////////////////////////////////////////////////////////////
/** Expand \ref Capability and call \c fnc_r for each namescpace:language
class CheckSum;
class OnMediaLocation;
- enum ValidValue { BROKEN, SATISFIED, NOTRELEVANT };
-
///////////////////////////////////////////////////////////////////
namespace sat
{ /////////////////////////////////////////////////////////////////
//@}
public:
- /** Returns true if the solvable is satisfied */
- bool isSatisfied() const;
- /** Returns true if the solvable is satisfied */
- bool isBroken() const { return !isSatisfied(); }
- /** Returns true if the solvable is relevant which means e.G. for patches
- * that at least one package of the patch is installed.
- */
- bool isRelevant() const;
-
- /** Check if the solvable is satisfied,broken or not relevant
- * (not important, so it can be ignored)
- * \return BROKEN, SATISFIED, NOTRELEVANT
- */
-
- ValidValue validate() const;
-
- public:
/** \name Locale support. */
//@{
/** Whether this \c Solvable claims to support locales. */