- provide ResPoolProxy::save/restore state for whole pool
authorMichael Andres <ma@suse.de>
Mon, 10 Apr 2006 11:36:34 +0000 (11:36 +0000)
committerMichael Andres <ma@suse.de>
Mon, 10 Apr 2006 11:36:34 +0000 (11:36 +0000)
zypp/ResPoolProxy.cc
zypp/ResPoolProxy.h

index afa176c..a7ee1e1 100644 (file)
@@ -28,18 +28,37 @@ namespace zypp
   /** Tem. friend of PoolItem */
   struct PoolItemSaver
   {
+    void saveState( ResPool_Ref pool_r )
+    {
+      std::for_each( pool_r.begin(), pool_r.end(),
+                     std::mem_fun_ref(&PoolItem::saveState) );
+    }
+
     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 )
+    {
+      std::for_each( pool_r.begin(), pool_r.end(),
+                     std::mem_fun_ref(&PoolItem::restoreState) );
+    }
+
     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) );
     }
 
+    bool diffState( ResPool_Ref pool_r ) const
+    {
+      // return whether some PoolItem::sameState reported \c false.
+      return( invokeOnEach( pool_r.begin(), pool_r.end(),
+                            std::mem_fun_ref(&PoolItem::sameState) ) < 0 );
+    }
+
     bool diffState( ResPool_Ref pool_r, const ResObject::Kind & kind_r ) const
     {
       // return whether some PoolItem::sameState reported \c false.
@@ -160,12 +179,21 @@ namespace zypp
 
   public:
 
+    void saveState() const
+    { PoolItemSaver().saveState( _pool ); }
+
     void saveState( const ResObject::Kind & kind_r ) const
     { PoolItemSaver().saveState( _pool, kind_r ); }
 
+    void restoreState() const
+    { PoolItemSaver().restoreState( _pool ); }
+
     void restoreState( const ResObject::Kind & kind_r ) const
     { PoolItemSaver().restoreState( _pool, kind_r ); }
 
+    bool diffState() const
+    { return PoolItemSaver().diffState( _pool ); }
+
     bool diffState( const ResObject::Kind & kind_r ) const
     { return PoolItemSaver().diffState( _pool, kind_r ); }
 
@@ -239,12 +267,21 @@ namespace zypp
   ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResObject::Kind & kind_r ) const
   { return _pimpl->byKindEnd( kind_r ); }
 
+  void ResPoolProxy::saveState() const
+  { _pimpl->saveState(); }
+
   void ResPoolProxy::saveState( const ResObject::Kind & kind_r ) const
   { _pimpl->saveState( kind_r ); }
 
+  void ResPoolProxy::restoreState() const
+  { _pimpl->restoreState(); }
+
   void ResPoolProxy::restoreState( const ResObject::Kind & kind_r ) const
   { _pimpl->restoreState( kind_r ); }
 
+  bool ResPoolProxy::diffState() const
+  { return _pimpl->diffState(); }
+
   bool ResPoolProxy::diffState( const ResObject::Kind & kind_r ) const
   { return _pimpl->diffState( kind_r ); }
 
index f2a66a2..d78c04a 100644 (file)
@@ -109,18 +109,24 @@ namespace zypp
      * state.
     */
     //@{
+    void saveState() const;
+
     void saveState( const ResObject::Kind & kind_r ) const;
 
     template<class _Res>
       void saveState() const
       { return saveState( ResTraits<_Res>::kind ); }
 
+    void restoreState() const;
+
     void restoreState( const ResObject::Kind & kind_r ) const;
 
     template<class _Res>
       void restoreState() const
       { return restoreState( ResTraits<_Res>::kind ); }
 
+    bool diffState() const;
+
     bool diffState( const ResObject::Kind & kind_r ) const;
 
     template<class _Res>