/** True if there are items of a certain kind. */
bool empty( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
bool empty() const
- { return empty( ResTraits<TRes>::kind ); }
+ { return empty( ResTraits<_Res>::kind ); }
/** Number of Items of a certain kind. */
size_type size( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
size_type size() const
- { return size( ResTraits<TRes>::kind ); }
+ { return size( ResTraits<_Res>::kind ); }
const_iterator byKindBegin( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
const_iterator byKindBegin() const
- { return byKindBegin( ResTraits<TRes>::kind ); }
+ { return byKindBegin( ResTraits<_Res>::kind ); }
const_iterator byKindEnd( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
const_iterator byKindEnd() const
- { return byKindEnd( ResTraits<TRes>::kind ); }
-
-
- Iterable<const_iterator> byKind( const ResKind & kind_r ) const
- { return makeIterable( byKindBegin( kind_r ), byKindEnd( kind_r ) ); }
-
- template<class TRes>
- Iterable<const_iterator> byKind() const
- { return makeIterable( byKindBegin<TRes>(), byKindEnd<TRes>() ); }
-
+ { return byKindEnd( ResTraits<_Res>::kind ); }
//@}
public:
repository_iterator knownRepositoriesBegin() const;
repository_iterator knownRepositoriesEnd() const;
-
- Iterable<repository_iterator> knownRepositories() const
- { return makeIterable( knownRepositoriesBegin(), knownRepositoriesEnd() ); }
//@}
public:
!= make_end<ui::selfilter::ByHasInstalledObj>( kind_r ) );
}
- template<class TRes>
+ template<class _Res>
bool hasInstalledObj() const
- { return hasInstalledObj( ResTraits<TRes>::kind ); }
+ { return hasInstalledObj( ResTraits<_Res>::kind ); }
public:
/** \name Save and restore state per kind of resolvable.
- * Simple version, no safety net. So don't restore or diff,
+ * Simple version, no savety net. So don't restore or diff,
* if you didn't save before.
*
* Diff returns true, if current stat differs from the saved
* state.
- *
- * Use \ref scopedSaveState for exception safe scoped save/restore
- */
+ */
//@{
void saveState() const;
void saveState( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
void saveState() const
- { return saveState( ResTraits<TRes>::kind ); }
+ { return saveState( ResTraits<_Res>::kind ); }
void restoreState() const;
void restoreState( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
void restoreState() const
- { return restoreState( ResTraits<TRes>::kind ); }
+ { return restoreState( ResTraits<_Res>::kind ); }
bool diffState() const;
bool diffState( const ResKind & kind_r ) const;
- template<class TRes>
+ template<class _Res>
bool diffState() const
- { return diffState( ResTraits<TRes>::kind ); }
-
- /**
- * \class ScopedSaveState
- * \brief Exception safe scoped save/restore state.
- * Call \ref acceptState to prevent the class from restoring
- * the remembered state.
- * \ingroup g_RAII
- */
- struct ScopedSaveState;
-
- ScopedSaveState scopedSaveState() const;
-
- ScopedSaveState scopedSaveState( const ResKind & kind_r ) const;
-
- template<class TRes>
- ScopedSaveState && scopedSaveState() const
- { return scopedSaveState( ResTraits<TRes>::kind ); }
-
+ { return diffState( ResTraits<_Res>::kind ); }
//@}
private:
- template<class TFilter>
- filter_iterator<TFilter,const_iterator>
- make_begin( TFilter filter_r, const ResKind & kind_r ) const
+ template<class _Filter>
+ filter_iterator<_Filter,const_iterator>
+ make_begin( _Filter filter_r, const ResKind & kind_r ) const
{
return make_filter_iterator( filter_r,
byKindBegin(kind_r),
byKindEnd(kind_r) );
}
- template<class TFilter>
- filter_iterator<TFilter,const_iterator>
+ template<class _Filter>
+ filter_iterator<_Filter,const_iterator>
make_begin( const ResKind & kind_r ) const
{
- return make_begin( TFilter(), kind_r );
+ return make_begin( _Filter(), kind_r );
}
- template<class TFilter>
- filter_iterator<TFilter,const_iterator>
- make_end( TFilter filter_r, const ResKind & kind_r ) const
+ template<class _Filter>
+ filter_iterator<_Filter,const_iterator>
+ make_end( _Filter filter_r, const ResKind & kind_r ) const
{
return make_filter_iterator( filter_r,
byKindEnd(kind_r),
byKindEnd(kind_r) );
}
- template<class TFilter>
- filter_iterator<TFilter,const_iterator>
+ template<class _Filter>
+ filter_iterator<_Filter,const_iterator>
make_end( const ResKind & kind_r ) const
{
- return make_end( TFilter(), kind_r );
+ return make_end( _Filter(), kind_r );
}
private:
/** \relates ResPoolProxy Verbose stream output */
std::ostream & dumpOn( std::ostream & str, const ResPoolProxy & obj );
- ///////////////////////////////////////////////////////////////////
-
- struct ResPoolProxy::ScopedSaveState
- {
- NON_COPYABLE_BUT_MOVE( ScopedSaveState );
-
- ScopedSaveState( const ResPoolProxy & pool_r )
- : _pimpl( new Impl( pool_r ) )
- { _pimpl->saveState(); }
-
- ScopedSaveState( const ResPoolProxy & pool_r, const ResKind & kind_r )
- : _pimpl( new Impl( pool_r, kind_r ) )
- { _pimpl->saveState(); }
-
- ~ScopedSaveState()
- { if ( _pimpl ) _pimpl->restoreState(); }
-
- void acceptState()
- { _pimpl.reset(); }
-
- private:
- struct Impl
- {
- Impl( const ResPoolProxy & pool_r )
- : _pool( pool_r )
- {}
- Impl( const ResPoolProxy & pool_r, const ResKind & kind_r )
- : _pool( pool_r ), _kind( new ResKind( kind_r ) )
- {}
- void saveState()
- { if ( _kind ) _pool.saveState( *_kind ); else _pool.saveState(); }
- void restoreState()
- { if ( _kind ) _pool.restoreState( *_kind ); else _pool.restoreState(); }
- ResPoolProxy _pool;
- scoped_ptr<ResKind> _kind;
-
- };
- std::unique_ptr<Impl> _pimpl;
- };
-
- inline ResPoolProxy::ScopedSaveState ResPoolProxy::scopedSaveState() const
- { return ScopedSaveState( *this ); }
-
- inline ResPoolProxy::ScopedSaveState ResPoolProxy::scopedSaveState( const ResKind & kind_r ) const
- { return ScopedSaveState( *this, kind_r ); }
-
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////