From: Michael Andres Date: Fri, 3 Feb 2012 12:11:57 +0000 (+0100) Subject: Add Checksum ctor autodetecting the type. X-Git-Tag: 11.1.0~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=13a308ea82fcc8943025ddcec1f88364d9da2ed4;p=platform%2Fupstream%2Flibzypp.git Add Checksum ctor autodetecting the type. --- diff --git a/zypp/CheckSum.cc b/zypp/CheckSum.cc index ac34c4284..e4913310e 100644 --- a/zypp/CheckSum.cc +++ b/zypp/CheckSum.cc @@ -41,6 +41,11 @@ namespace zypp CheckSum::CheckSum() {} + CheckSum::CheckSum( const std::string & checksum ) + { + *this = CheckSum( std::string(), checksum ); + } + CheckSum::CheckSum( const std::string & type, const std::string & checksum ) : _type( str::toLower( type ) ) , _checksum( checksum ) diff --git a/zypp/CheckSum.h b/zypp/CheckSum.h index 5004ee30e..0a6f5538b 100644 --- a/zypp/CheckSum.h +++ b/zypp/CheckSum.h @@ -32,13 +32,22 @@ namespace zypp class CheckSum { public: + /** Default Ctor: empty checksum. */ + CheckSum(); + /** + * Creates a checksum auto probing the algorithm type. + * \throws CheckSumException if the checksum is invalid and can't be constructed + */ + CheckSum( const std::string & checksum ); /** - * Creates a checksum for algorithm \param type + * Creates a checksum for algorithm \param type. * \throws CheckSumException if the checksum is invalid and can't be constructed */ CheckSum( const std::string & type, const std::string & checksum ); + /** + * Reads the content of \param input_r and computes the checksum. + */ CheckSum( const std::string & type, std::istream & input_r ); - CheckSum(); public: static const std::string & md5Type();