#include "zypp/base/Tr1hash.h"
#include "zypp/PoolItem.h"
+#include "zypp/pool/ByIdent.h"
#include "zypp/sat/Pool.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ class PoolQuery;
+
///////////////////////////////////////////////////////////////////
namespace pool
{ /////////////////////////////////////////////////////////////////
struct ByPoolItem
{
bool operator()( const PoolItem & pi ) const
- { return pi; }
+ { return bool(pi); }
};
- /** Main filter selecting PoolItems by \c name and \c kind.
- *
- */
- class ByIdent
+ /** In CXX0X std::_Select2nd does no longer derive from std::unary_function
+ */
+ template<typename _Pair>
+ struct P_Select2nd : public std::unary_function<_Pair, typename _Pair::second_type>
{
- public:
- ByIdent()
- : _id( 0 )
- {}
-
- explicit ByIdent( sat::Solvable slv_r )
- : _id( makeIdent( slv_r ) )
- {}
-
- explicit ByIdent( IdString ident_r )
- : _id( ident_r.id() )
- {}
-
- ByIdent( ResKind kind_r, IdString name_r )
- : _id( makeIdent( kind_r, name_r ) )
- {}
-
- ByIdent( ResKind kind_r, const C_Str & name_r )
- : _id( makeIdent( kind_r, name_r ) )
- {}
-
- public:
- bool operator()( sat::Solvable slv_r ) const
- {
- return _id >= 0 ? ( slv_r.ident().id() == _id && ! slv_r.isKind( ResKind::srcpackage ) )
- : ( slv_r.ident().id() == -_id && slv_r.isKind( ResKind::srcpackage ) );
- }
-
- bool operator()( const PoolItem & pi_r ) const
- { return operator()( pi_r.satSolvable() ); }
-
- bool operator()( ResObject::constPtr p_r ) const
- { return p_r ? operator()( p_r->satSolvable() ) : !_id; }
-
- private:
- sat::detail::IdType makeIdent( sat::Solvable slv_r )
- {
- return slv_r.isKind( ResKind::srcpackage ) ? -slv_r.ident().id()
- : slv_r.ident().id();
- }
-
- sat::detail::IdType makeIdent( ResKind kind_r, IdString name_r )
- {
- if ( kind_r == ResKind::package )
- return name_r.id();
- else if ( kind_r == ResKind::srcpackage )
- return -name_r.id();
- return IdString( str::form( "%s:%s", kind_r.c_str(), name_r.c_str() ) ).id();
- }
-
- sat::detail::IdType makeIdent( ResKind kind_r, const C_Str & name_r )
- {
- if ( kind_r == ResKind::package )
- return IdString( name_r ).id();
- else if ( kind_r == ResKind::srcpackage )
- return -(IdString( name_r ).id());
- return IdString( str::form( "%s:%s", kind_r.c_str(), name_r.c_str() ) ).id();
- }
-
- public:
- sat::detail::IdType get() const { return _id; }
-
- private:
- /** negative \c _id for \c srcpackage, as they use the same \c ident
- * as \c package.
- */
- sat::detail::IdType _id;
+ typename _Pair::second_type&
+ operator()(_Pair& __x) const
+ { return __x.second; }
+
+ const typename _Pair::second_type&
+ operator()(const _Pair& __x) const
+ { return __x.second; }
};
///////////////////////////////////////////////////////////////////
/** ident index */
typedef std::tr1::unordered_multimap<sat::detail::IdType, PoolItem>
Id2ItemT;
- typedef std::_Select2nd<Id2ItemT::value_type> Id2ItemValueSelector;
+ typedef P_Select2nd<Id2ItemT::value_type> Id2ItemValueSelector;
typedef transform_iterator<Id2ItemValueSelector, Id2ItemT::const_iterator>
byIdent_iterator;
- /* list of known Repositories */
- typedef std::list<Repository> RepoContainerT;
- typedef RepoContainerT::const_iterator repository_iterator;
+ /** list of known Repositories */
+ typedef sat::Pool::RepositoryIterator repository_iterator;
+
+ /** hard locks from etc/zypp/locks */
+ typedef std::list<PoolQuery> HardLockQueries;
+ typedef HardLockQueries::const_iterator hardLockQueries_iterator;
typedef PoolImpl Impl;
typedef shared_ptr<PoolImpl> Impl_Ptr;
typedef shared_ptr<const PoolImpl> Impl_constPtr;
-
- /** Map of Capabilities and "who" has set it*/
- typedef std::map<ResStatus::TransactByValue,Capabilities> AdditionalCapabilities;
-
};
///////////////////////////////////////////////////////////////////