Author: dmacvicar Date: Thu Jul 19 17:07:45 2007 New Revision: 6104 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6104&view=rev Log: documentation, add constructor from file Modified: trunk/libzypp/zypp/repo/SUSEMediaVerifier.cc trunk/libzypp/zypp/repo/SUSEMediaVerifier.h Modified: trunk/libzypp/zypp/repo/SUSEMediaVerifier.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/SUSEMediaVerifier.cc?rev=6104&r1=6103&r2=6104&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/SUSEMediaVerifier.cc (original) +++ trunk/libzypp/zypp/repo/SUSEMediaVerifier.cc Thu Jul 19 17:07:45 2007 @@ -1,3 +1,11 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ #include <fstream> #include "zypp/repo/SUSEMediaVerifier.h" @@ -9,12 +17,32 @@ namespace repo { -SUSEMediaVerifier::SUSEMediaVerifier(const std::string & vendor_r, const std::string & id_r, const media::MediaNr media_nr) +SUSEMediaVerifier::SUSEMediaVerifier(const std::string & vendor_r, + const std::string & id_r, + const media::MediaNr media_nr) : _media_vendor(vendor_r) , _media_id(id_r) , _media_nr(media_nr) {} +SUSEMediaVerifier::SUSEMediaVerifier( const Pathname &path_r ) +{ + std::ifstream str(path_r.asString().c_str()); + std::string vendor; + std::string id; + + if ( str ) + { + getline(str, _media_vendor); + getline(str, _media_id); + } + else + { + ZYPP_THROW(Exception("Can't setup media verifier using file: '" + + path_r.asString() + "'")); + } +} + bool SUSEMediaVerifier::isDesiredMedia(const media::MediaAccessRef &ref) { if (_media_vendor.empty() || _media_id.empty()) Modified: trunk/libzypp/zypp/repo/SUSEMediaVerifier.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/SUSEMediaVerifier.h?rev=6104&r1=6103&r2=6104&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/SUSEMediaVerifier.h (original) +++ trunk/libzypp/zypp/repo/SUSEMediaVerifier.h Thu Jul 19 17:07:45 2007 @@ -1,3 +1,11 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ #ifndef ZYPP_SUSE_MEDIAVERIFIER_H #define ZYPP_SUSE_MEDIAVERIFIER_H @@ -10,16 +18,42 @@ namespace repo { + /** + * \short Implementation of the traditional SUSE media verifier + */ class SUSEMediaVerifier : public zypp::media::MediaVerifierBase { public: - /** ctor */ - SUSEMediaVerifier(const std::string & vendor_r, const std::string & id_r, const media::MediaNr media_nr = 1); /** + * \short create a verifier from attributes + * + * Creates a verifier for the media using + * the attributes + * + * \param vendor_r i.e. "SUSE Linux Products GmbH" + * \param id_r i.e. "20070718164719" + * \param media_nr media number + */ + SUSEMediaVerifier(const std::string & vendor_r, + const std::string & id_r, + const media::MediaNr media_nr = 1); + + /** + * \short creates a verifier from a media file + */ + SUSEMediaVerifier( const Pathname &path_r ); + + /** + * \short Check if it is the desider media + * * Check if the specified attached media contains * the desired media number (e.g. SLES10 CD1). + * + * Reimplementation of virtual function, will be + * called by the component verifying the media. */ virtual bool isDesiredMedia(const media::MediaAccessRef &ref); + private: std::string _media_vendor; std::string _media_id; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org