SourceFactory.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_SOURCEFACTORY_H
00013 #define ZYPP_SOURCEFACTORY_H
00014 
00015 #include <iosfwd>
00016 #include <string>
00017 #include <set>
00018 
00019 #include "zypp/base/PtrTypes.h"
00020 
00021 #include "zypp/Source.h"
00022 #include "zypp/Url.h"
00023 #include "zypp/Pathname.h"
00024 
00026 namespace zypp
00027 { 
00028 
00030   //
00031   //    CLASS NAME : SourceFactory
00032   //
00037   class SourceFactory
00038   {
00039     friend std::ostream & operator<<( std::ostream & str, const SourceFactory & obj );
00040 
00041   public:
00043     SourceFactory();
00045     ~SourceFactory();
00046 
00047   public:
00051     Source_Ref createFrom( const Source_Ref::Impl_Ptr & impl_r );
00052 
00056     Source_Ref createFrom( const Url & url_r, const Pathname & path_r = "/", const std::string & alias_r ="", const Pathname & cache_dir_r = "", bool base_source = false );
00057 
00061     Source_Ref createFrom( const std::string & type,  const Url & url_r, const Pathname & path_r, const std::string & alias_r, const Pathname & cache_dir_r, bool base_source, bool auto_refresh);
00062 
00063   private:
00065     class Impl;
00067     RW_pointer<Impl> _pimpl;
00068 
00069   public:
00070    struct ProductEntry {
00071       Pathname    _dir;
00072       std::string _name;
00073       ProductEntry( const Pathname & dir_r = "/", const std::string & name_r = std::string() ){
00074         _dir  = dir_r;
00075         _name = name_r;
00076       }
00077       bool operator<( const ProductEntry & rhs ) const {
00078         return( _dir.asString() < rhs._dir.asString() );
00079       }
00080     };
00081 
00082     typedef std::set<ProductEntry> ProductSet;
00083 
00087     void listProducts( const Url & url_r, ProductSet & products_r );
00088 
00089   private:
00090     void scanProductsFile( const Pathname & file_r, ProductSet & pset_r ) const;
00091   };
00093 
00095   extern std::ostream & operator<<( std::ostream & str, const SourceFactory & obj );
00096 
00098 } // namespace zypp
00100 #endif // ZYPP_SOURCEFACTORY_H

Generated on Thu Jul 6 00:07:25 2006 for zypp by  doxygen 1.4.6