From f751574c767d52408c33cf0499a8be9c66821962 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 1 Feb 2008 23:19:54 +0000 Subject: [PATCH] - move the cookie saving code --- zypp/RepoStatus.cc | 10 ++++++++++ zypp/RepoStatus.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/zypp/RepoStatus.cc b/zypp/RepoStatus.cc index 1f5af4b..fdea7a5 100644 --- a/zypp/RepoStatus.cc +++ b/zypp/RepoStatus.cc @@ -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() ) { diff --git a/zypp/RepoStatus.h b/zypp/RepoStatus.h index 211f17f..5bdf1ca 100644 --- a/zypp/RepoStatus.h +++ b/zypp/RepoStatus.h @@ -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 -- 2.7.4