00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_SOURCECACHE_H 00013 #define ZYPP_SOURCECACHE_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 : SourceCache 00032 // 00033 // singleton 00034 // 00035 class SourceCache 00036 { 00037 friend std::ostream & operator<<( std::ostream & str, const SourceCache & obj ); 00038 00039 public: 00041 SourceCache(); 00043 ~SourceCache(); 00044 00045 void setCacheDir(const Pathname& dir_r); 00046 00047 public: 00048 void storeSource(Source_Ref src); 00049 00050 void restoreSources(); 00051 00052 void removeSource(unsigned id); 00053 00054 void removeSource(const Url & url_r, const Pathname & path_r = "/"); 00055 00056 private: 00058 static Pathname _cache_dir; 00060 static unsigned _next_cache_id; 00061 00062 00064 }; 00065 00067 extern std::ostream & operator<<( std::ostream & str, const SourceCache & obj ); 00068 00070 } // namespace zypp 00072 #endif // ZYPP_SOURCECACHE_H