]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debmetaindex.h
879eb3bfca827ab348bf85d14b8d4e8136a25d45
[apt.git] / apt-pkg / deb / debmetaindex.h
1 #ifndef PKGLIB_DEBMETAINDEX_H
2 #define PKGLIB_DEBMETAINDEX_H
3
4 #include <apt-pkg/metaindex.h>
5 #include <apt-pkg/macros.h>
6
7 #include <map>
8 #include <string>
9 #include <vector>
10
11 #ifndef APT_8_CLEANER_HEADERS
12 #include <apt-pkg/sourcelist.h>
13 #endif
14 #ifndef APT_10_CLEANER_HEADERS
15 #include <apt-pkg/init.h>
16 #endif
17
18 class pkgAcquire;
19 class pkgIndexFile;
20 class debDebPkgFileIndex;
21 class IndexTarget;
22 class pkgCacheGenerator;
23 class OpProgress;
24 class debReleaseIndexPrivate;
25
26 class APT_HIDDEN debReleaseIndex : public metaIndex
27 {
28 debReleaseIndexPrivate * const d;
29
30 APT_HIDDEN bool parseSumData(const char *&Start, const char *End, std::string &Name,
31 std::string &Hash, unsigned long long &Size);
32 public:
33
34 APT_HIDDEN std::string MetaIndexInfo(const char *Type) const;
35 APT_HIDDEN std::string MetaIndexFile(const char *Types) const;
36 APT_HIDDEN std::string MetaIndexURI(const char *Type) const;
37
38 debReleaseIndex(std::string const &URI, std::string const &Dist);
39 debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
40 virtual ~debReleaseIndex();
41
42 virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
43 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false);
44 virtual std::vector<IndexTarget> GetIndexTargets() const;
45
46 virtual std::string Describe() const;
47 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
48 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
49
50 virtual bool Load(std::string const &Filename, std::string * const ErrorText);
51 virtual metaIndex * UnloadedClone() const;
52
53 virtual std::vector <pkgIndexFile *> *GetIndexFiles();
54
55 bool SetTrusted(TriState const Trusted);
56 bool SetCheckValidUntil(TriState const Trusted);
57 bool SetValidUntilMin(time_t const Valid);
58 bool SetValidUntilMax(time_t const Valid);
59
60 virtual bool IsTrusted() const;
61
62 void AddComponent(bool const isSrc, std::string const &Name,
63 std::vector<std::string> const &Targets,
64 std::vector<std::string> const &Architectures,
65 std::vector<std::string> Languages);
66 };
67
68 class APT_HIDDEN debDebFileMetaIndex : public metaIndex
69 {
70 private:
71 void * const d;
72 std::string DebFile;
73 debDebPkgFileIndex *DebIndex;
74 public:
75 virtual std::string ArchiveURI(std::string const& /*File*/) const {
76 return DebFile;
77 }
78 virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) {
79 return true;
80 }
81 virtual std::vector<IndexTarget> GetIndexTargets() const {
82 return std::vector<IndexTarget>();
83 }
84 virtual std::vector<pkgIndexFile *> *GetIndexFiles() {
85 return Indexes;
86 }
87 virtual bool IsTrusted() const {
88 return true;
89 }
90 virtual bool Load(std::string const &, std::string * const ErrorText)
91 {
92 LoadedSuccessfully = TRI_NO;
93 if (ErrorText != NULL)
94 strprintf(*ErrorText, "Unparseable metaindex as it represents the standalone deb file %s", DebFile.c_str());
95 return false;
96 }
97 virtual metaIndex * UnloadedClone() const
98 {
99 return NULL;
100 }
101 debDebFileMetaIndex(std::string const &DebFile);
102 virtual ~debDebFileMetaIndex();
103
104 };
105
106 #endif