]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/sourcelist.h
First draft of make system and name change to apt-pkg
[apt.git] / apt-pkg / sourcelist.h
... / ...
CommitLineData
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: sourcelist.h,v 1.3 1998/07/12 23:58:38 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
26class pkgAquire;
27class 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 string SanitizeURI(string URI);
60 const_iterator MatchPkgFile(pkgCache::VerIterator Ver);
61
62 // List accessors
63 inline const_iterator begin() const {return List.begin();};
64 inline const_iterator end() const {return List.end();};
65 inline unsigned int size() const {return List.size();};
66 inline bool empty() const {return List.empty();};
67
68 pkgSourceList();
69 pkgSourceList(string File);
70};
71
72ostream &operator <<(ostream &O,pkgSourceList::Item &Itm);
73
74#endif