DumpAvail works and apt-cache is complete
[ntk/apt.git] / apt-pkg / sourcelist.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: sourcelist.h,v 1.4 1998/07/19 04:22:05 jgg Exp $
4 /* ######################################################################
5
6 SourceList - Manage a list of sources
7
8 The Source List class provides access to a list of sources. It
9 can read them from a file and generate a list of all the permutations.
10
11 ##################################################################### */
12 /*}}}*/
13 // Header section: pkglib
14 #ifndef PKGLIB_SOURCELIST_H
15 #define PKGLIB_SOURCELIST_H
16
17 #include <string>
18 #include <vector>
19 #include <iostream.h>
20 #include <apt-pkg/pkgcache.h>
21
22 #ifdef __GNUG__
23 #pragma interface "apt-pkg/sourcelist.h"
24 #endif
25
26 class pkgAquire;
27 class pkgSourceList
28 {
29 public:
30
31 /* Each item in the source list, each line can have more than one
32 item */
33 struct Item
34 {
35 enum {Deb} Type;
36
37 string URI;
38 string Dist;
39 string Section;
40
41 bool SetType(string S);
42 bool SetURI(string S);
43 string PackagesURI() const;
44 string PackagesInfo() const;
45 string SiteOnly(string URI) const;
46 string ArchiveInfo(pkgCache::VerIterator Ver) const;
47 string ArchiveURI(string File) const;
48 };
49 typedef vector<Item>::const_iterator const_iterator;
50
51 protected:
52
53 vector<Item> List;
54
55 public:
56
57 bool ReadMainList();
58 bool Read(string File);
59
60 // List accessors
61 inline const_iterator begin() const {return List.begin();};
62 inline const_iterator end() const {return List.end();};
63 inline unsigned int size() const {return List.size();};
64 inline bool empty() const {return List.empty();};
65
66 pkgSourceList();
67 pkgSourceList(string File);
68 };
69
70 ostream &operator <<(ostream &O,pkgSourceList::Item &Itm);
71
72 #endif