Fetcher.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_FETCHER_H
00013 #define ZYPP_FETCHER_H
00014 
00015 #include <iosfwd>
00016 #include <list>
00017 
00018 #include "zypp/base/Flags.h"
00019 #include "zypp/base/PtrTypes.h"
00020 #include "zypp/Pathname.h"
00021 #include "zypp/Url.h"
00022 #include "zypp/OnMediaLocation.h"
00023 #include "zypp/Digest.h"
00024 #include "zypp/MediaSetAccess.h"
00025 #include "zypp/FileChecker.h"
00026 #include "zypp/ProgressData.h"
00027 
00029 namespace zypp
00030 { 
00031 
00098   class Fetcher
00099   {
00100     friend std::ostream & operator<<( std::ostream & str,
00101                                       const Fetcher & obj );
00102   public:
00104     class Impl;
00105   public:
00106 
00110     enum Option
00111     {
00116       AutoAddContentFileIndexes = 0x0001,
00121       AutoAddSha1sumsIndexes = 0x0002,
00126       AutoAddIndexes = 0x0001 | 0x0002,
00127     };
00128     ZYPP_DECLARE_FLAGS(Options, Option);
00129 
00131     Fetcher();
00133     virtual ~Fetcher();
00134 
00135   public:
00136 
00141     void setOptions( Options options );
00142 
00147     Options options() const;
00148 
00173     void addIndex( const OnMediaLocation &resource );
00174    
00180     void enqueue( const OnMediaLocation &resource,
00181                   const FileChecker &checker = FileChecker() );
00182     
00194     void enqueueDigested( const OnMediaLocation &resource,
00195                           const FileChecker &checker = FileChecker() );
00196 
00197 
00237     void enqueueDir( const OnMediaLocation &resource,
00238                      bool recursive = false,
00239                      const FileChecker &checker = FileChecker() );
00240 
00281     void enqueueDigestedDir( const OnMediaLocation &resource,
00282                              bool recursive = false,
00283                              const FileChecker &checker = FileChecker() );
00284     
00289     void addCachePath( const Pathname &cache_dir );
00290     
00295     void reset();
00296     
00306     void start( const Pathname &dest_dir,
00307                 MediaSetAccess &media,
00308                 const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
00309 
00310   private:
00312     RWCOW_pointer<Impl> _pimpl;
00313   };
00315   ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Fetcher::Options);
00316 
00318   std::ostream & operator<<( std::ostream & str, const Fetcher & obj );
00319 
00321 } // namespace zypp
00323 #endif // ZYPP_FETCHER_H

doxygen