MediaSetAccess.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00009 
00010 #ifndef ZYPP_MediaSetAccess_H
00011 #define ZYPP_MediaSetAccess_H
00012 
00013 #include <iosfwd>
00014 #include <string>
00015 #include <vector>
00016 #include <boost/function.hpp>
00017 
00018 #include "zypp/base/ReferenceCounted.h"
00019 #include "zypp/base/NonCopyable.h"
00020 #include "zypp/base/PtrTypes.h"
00021 #include "zypp/media/MediaManager.h"
00022 #include "zypp/Pathname.h"
00023 #include "zypp/CheckSum.h"
00024 #include "zypp/OnMediaLocation.h"
00025 
00027 namespace zypp
00028 { 
00029 
00030     DEFINE_PTR_TYPE(MediaSetAccess);
00031 
00033     //
00034     //  CLASS NAME : MediaSetAccess
00035     //
00076     class MediaSetAccess : public base::ReferenceCounted, private base::NonCopyable
00077     {
00078       friend std::ostream & operator<<( std::ostream & str, const MediaSetAccess & obj );
00079 
00080     public:
00088       MediaSetAccess(const Url &url, const Pathname & prefered_attach_point = "");
00089       ~MediaSetAccess();
00090 
00094       void setVerifier( unsigned media_nr, media::MediaVerifierRef verifier );
00095 
00105       Pathname provideFile( const OnMediaLocation & on_media_file );
00106 
00117       Pathname provideFile(const Pathname & file, unsigned media_nr = 1 );
00118       
00131       Pathname provideDir(const Pathname & dir, bool recursive, unsigned media_nr = 1);
00132 
00139       bool doesFileExist(const Pathname & file, unsigned media_nr = 1 );
00140 
00146       void release();
00147 
00162       static Url rewriteUrl (const Url & url_r, const media::MediaNr medianr);
00163 
00164     protected:
00165       Pathname provideFileInternal(const Pathname & file, unsigned media_nr, bool checkonly, bool cached);
00166       media::MediaAccessId getMediaAccessId (media::MediaNr medianr);
00167       virtual std::ostream & dumpOn( std::ostream & str ) const;
00168 
00169     private:
00171       Url _url;
00172 
00179       Pathname _prefAttachPoint;
00180 
00181       typedef std::map<media::MediaNr, media::MediaAccessId> MediaMap;
00182       typedef std::map<media::MediaNr, media::MediaVerifierRef > VerifierMap;
00183 
00185       MediaMap _medias;
00187       VerifierMap _verifiers;
00188     };
00190 
00192     inline std::ostream & operator<<( std::ostream & str, const MediaSetAccess & obj )
00193     { return obj.dumpOn( str ); }
00194 
00195 
00196 } // namespace zypp
00198 #endif // ZYPP_SOURCE_MediaSetAccess_H

Generated on Tue Sep 25 19:23:02 2007 for libzypp by  doxygen 1.5.3