merge with current debian apt/experimental
[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
7 #include <map>
8 #include <string>
9 #include <vector>
10
11 class debReleaseIndex : public metaIndex {
12 public:
13
14 class debSectionEntry
15 {
16 public:
17 debSectionEntry (std::string const &Section, bool const &IsSrc);
18 std::string const Section;
19 bool const IsSrc;
20 };
21
22 private:
23 /** \brief dpointer placeholder (for later in case we need it) */
24 void *d;
25 std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
26 enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
27
28 public:
29
30 debReleaseIndex(std::string const &URI, std::string const &Dist);
31 debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
32 virtual ~debReleaseIndex();
33
34 virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
35 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
36 std::vector <struct IndexTarget *>* ComputeIndexTargets() const;
37 std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const;
38 std::string MetaIndexInfo(const char *Type) const;
39 std::string MetaIndexFile(const char *Types) const;
40 std::string MetaIndexURI(const char *Type) const;
41 std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
42 std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
43 std::string SourceIndexURI(const char *Type, const std::string &Section) const;
44 std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const;
45 std::string TranslationIndexURI(const char *Type, const std::string &Section) const;
46 std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const;
47 virtual std::vector <pkgIndexFile *> *GetIndexFiles();
48
49 void SetTrusted(bool const Trusted);
50 virtual bool IsTrusted() const;
51
52 void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
53 void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
54 void PushSectionEntry(const debSectionEntry *Entry);
55 };
56
57 #endif