Sync
[ntk/apt.git] / apt-pkg / sourcelist.h
CommitLineData
6c139d6e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: sourcelist.h,v 1.1 1998/07/07 04:17:06 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 <pkglib/pkgcache.h>
21
22#ifdef __GNUG__
23#pragma interface "pkglib/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
72bool pkgUpdateMeta(pkgSourceList &List,pkgAquire &Engine);
73bool pkgMakeSrcCache(pkgSourceList &List);
74bool pkgMakeStatusCache();
75
76ostream &operator <<(ostream &O,pkgSourceList::Item &Itm);
77
78#endif