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