libzypp  10.5.0
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     
00200     void enqueueDigested( const OnMediaLocation &resource,
00201                           const FileChecker &checker = FileChecker(), const Pathname &deltafile = Pathname());
00202 
00203 
00243     void enqueueDir( const OnMediaLocation &resource,
00244                      bool recursive = false,
00245                      const FileChecker &checker = FileChecker() );
00246 
00287     void enqueueDigestedDir( const OnMediaLocation &resource,
00288                              bool recursive = false,
00289                              const FileChecker &checker = FileChecker() );
00290     
00295     void addCachePath( const Pathname &cache_dir );
00296     
00301     void reset();
00302     
00312     void start( const Pathname &dest_dir,
00313                 MediaSetAccess &media,
00314                 const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
00315 
00316   private:
00318     RWCOW_pointer<Impl> _pimpl;
00319   };
00321   ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Fetcher::Options);
00322 
00324   std::ostream & operator<<( std::ostream & str, const Fetcher & obj );
00325 
00327 } // namespace zypp
00329 #endif // ZYPP_FETCHER_H