ResObject::constPtr PoolItem_Ref::resolvable() const
{ return _pimpl->resolvable(); }
+ void PoolItem_Ref::saveState() const
+ { _pimpl->saveState(); }
+
+ void PoolItem_Ref::restoreState() const
+ { _pimpl->restoreState(); }
+
/******************************************************************
**
** FUNCTION NAME : operator<<
private:
/** Pointer to implementation */
RW_pointer<Impl> _pimpl;
+
+ private:
+ /** \name tmp hack for save/restore state. */
+ /** \todo get rid of it. */
+ //@{
+ friend class PoolItemSaver;
+ void saveState() const;
+ void restoreState() const;
+ //@}
};
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ /** Tem. friend of PoolItem */
+ struct PoolItemSaver
+ {
+ void saveState( ResPool_Ref pool_r, const ResObject::Kind & kind_r )
+ {
+ std::for_each( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r),
+ std::mem_fun_ref(&PoolItem::saveState) );
+ }
+
+ void restoreState( ResPool_Ref pool_r, const ResObject::Kind & kind_r )
+ {
+ std::for_each( pool_r.byKindBegin(kind_r), pool_r.byKindEnd(kind_r),
+ std::mem_fun_ref(&PoolItem::restoreState) );
+ }
+ };
+
struct SelPoolHelper
{
typedef std::set<ResPool::Item> ItemC;
const_iterator byKindEnd( const ResObject::Kind & kind_r ) const
{ return _selPool[kind_r].end(); }
+
+ public:
+
+ void saveState( const ResObject::Kind & kind_r ) const
+ { PoolItemSaver().saveState( _pool, kind_r ); }
+
+ void restoreState( const ResObject::Kind & kind_r ) const
+ { PoolItemSaver().restoreState( _pool, kind_r ); }
+
private:
ResPool_Ref _pool;
mutable SelectablePool _selPool;
ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResObject::Kind & kind_r ) const
{ return _pimpl->byKindEnd( kind_r ); }
+ void ResPoolProxy::saveState( const ResObject::Kind & kind_r ) const
+ { _pimpl->saveState( kind_r ); }
+
+ void ResPoolProxy::restoreState( const ResObject::Kind & kind_r ) const
+ { _pimpl->restoreState( kind_r ); }
+
/******************************************************************
**
** FUNCTION NAME : operator<<
bool hasInstalledObj() const
{ return hasInstalledObj( ResTraits<_Res>::kind ); }
-
-
public:
- /** \name Save and restore state.
- * \todo make it work.
+ /** \name Save and restore state per kind of resolvable.
+ * Simple version, no savety net.
*/
//@{
- void SaveState();
- void RestoreState();
+ void saveState( const ResObject::Kind & kind_r ) const;
+
+ template<class _Res>
+ void saveState() const
+ { return saveState( ResTraits<_Res>::kind ); }
+
+ void restoreState( const ResObject::Kind & kind_r ) const;
+
+ template<class _Res>
+ void restoreState() const
+ { return restoreState( ResTraits<_Res>::kind ); }
//@}
private: