- move the cookie saving code
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 1 Feb 2008 23:19:54 +0000 (23:19 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Fri, 1 Feb 2008 23:19:54 +0000 (23:19 +0000)
zypp/RepoStatus.cc
zypp/RepoStatus.h

index 1f5af4b..fdea7a5 100644 (file)
@@ -105,6 +105,16 @@ namespace zypp
     return status;
   }
 
+  void RepoStatus::saveToCookieFile( const Pathname &cookiefile )
+  {
+    std::ofstream file(cookiefile.c_str());
+    if (!file) {
+      ZYPP_THROW (Exception( "Can't open " + cookiefile.asString() ) );
+    }
+    file << *(this);
+    file.close();
+  }
+
   RepoStatus::RepoStatus( const Pathname &path )
     : _pimpl( new Impl() )
   {
index 211f17f..5bdf1ca 100644 (file)
@@ -49,6 +49,12 @@ namespace zypp
     static RepoStatus fromCookieFile( const Pathname &path );
   
     /**
+     * save the status information to a cookie file
+     * \throws Exception if the file can't be saved
+     */
+    void saveToCookieFile( const Pathname &path );
+
+    /**
      * Checksum of the repository.
      * Usually the checksum of the index, but any
      * checksum that changes when the repository changes