ignore
[platform/upstream/libzypp.git] / zypp / SourceCache.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/SourceCache.h
10  *
11 */
12 #ifndef ZYPP_SOURCECACHE_H
13 #define ZYPP_SOURCECACHE_H
14
15 #include <iosfwd>
16 #include <string>
17 #include <set>
18
19 #include "zypp/base/PtrTypes.h"
20
21 #include "zypp/Source.h"
22 #include "zypp/Url.h"
23 #include "zypp/Pathname.h"
24
25 ///////////////////////////////////////////////////////////////////
26 namespace zypp
27 { /////////////////////////////////////////////////////////////////
28
29   ///////////////////////////////////////////////////////////////////
30   //
31   //    CLASS NAME : SourceCache
32   //
33   //    singleton
34   //
35   class SourceCache
36   {
37     friend std::ostream & operator<<( std::ostream & str, const SourceCache & obj );
38
39   public:
40     /** Default ctor */
41     SourceCache();
42     /** Dtor */
43     ~SourceCache();
44     
45     void setCacheDir(const Pathname& dir_r);
46
47   public:
48     void storeSource(Source_Ref src);
49
50     void restoreSources();
51
52     void removeSource(unsigned id);
53
54     void removeSource(const Url & url_r, const Pathname & path_r = "/");
55
56   private:
57     /** directory to store cached data */
58     static Pathname _cache_dir;
59     /** counter of caches */
60     static unsigned _next_cache_id;
61
62
63   ///////////////////////////////////////////////////////////////////
64   };
65
66   /** \relates SourceCache Stream output */
67   extern std::ostream & operator<<( std::ostream & str, const SourceCache & obj );
68
69   /////////////////////////////////////////////////////////////////
70 } // namespace zypp
71 ///////////////////////////////////////////////////////////////////
72 #endif // ZYPP_SOURCECACHE_H