merged from http://bzr.debian.org/bzr/apt/apt/debian-sid
[ntk/apt.git] / apt-pkg / deb / debmetaindex.h
1 // ijones, walters
2 #ifndef PKGLIB_DEBMETAINDEX_H
3 #define PKGLIB_DEBMETAINDEX_H
4
5 #include <apt-pkg/metaindex.h>
6 #include <apt-pkg/sourcelist.h>
7
8 #include <map>
9
10 class debReleaseIndex : public metaIndex {
11 public:
12
13 class debSectionEntry
14 {
15 public:
16 debSectionEntry (string const &Section, bool const &IsSrc);
17 string const Section;
18 bool const IsSrc;
19 };
20
21 private:
22 /** \brief dpointer placeholder (for later in case we need it) */
23 void *d;
24 std::map<string, vector<debSectionEntry const*> > ArchEntries;
25 enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
26
27 public:
28
29 debReleaseIndex(string const &URI, string const &Dist);
30 debReleaseIndex(string const &URI, string const &Dist, bool const Trusted);
31 virtual ~debReleaseIndex();
32
33 virtual string ArchiveURI(string const &File) const {return URI + File;};
34 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
35 vector <struct IndexTarget *>* ComputeIndexTargets() const;
36 string Info(const char *Type, string const &Section, string const &Arch="") const;
37 string MetaIndexInfo(const char *Type) const;
38 string MetaIndexFile(const char *Types) const;
39 string MetaIndexURI(const char *Type) const;
40 string IndexURI(const char *Type, string const &Section, string const &Arch="native") const;
41 string IndexURISuffix(const char *Type, string const &Section, string const &Arch="native") const;
42 string SourceIndexURI(const char *Type, const string &Section) const;
43 string SourceIndexURISuffix(const char *Type, const string &Section) const;
44 string TranslationIndexURI(const char *Type, const string &Section) const;
45 string TranslationIndexURISuffix(const char *Type, const string &Section) const;
46 virtual vector <pkgIndexFile *> *GetIndexFiles();
47
48 void SetTrusted(bool const Trusted);
49 virtual bool IsTrusted() const;
50
51 void PushSectionEntry(vector<string> const &Archs, const debSectionEntry *Entry);
52 void PushSectionEntry(string const &Arch, const debSectionEntry *Entry);
53 void PushSectionEntry(const debSectionEntry *Entry);
54 };
55
56 #endif