Document "pre-auto" option for DSelect::Clean.
[ntk/apt.git] / apt-pkg / sourcelist.h
CommitLineData
6c139d6e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b2e465d6 3// $Id: sourcelist.h,v 1.9 2001/02/20 07:03:17 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.
b2e465d6
AL
15
16 The types are mapped through a list of type definitions which handle
17 the actual construction of the type. After loading a source list all
18 you have is a list of package index files that have the ability
19 to be Acquired.
6c139d6e
AL
20
21 ##################################################################### */
22 /*}}}*/
6c139d6e
AL
23#ifndef PKGLIB_SOURCELIST_H
24#define PKGLIB_SOURCELIST_H
25
26#include <string>
27#include <vector>
094a497d 28#include <apt-pkg/pkgcache.h>
b2e465d6
AL
29#include <apt-pkg/indexfile.h>
30
6c139d6e 31#ifdef __GNUG__
094a497d 32#pragma interface "apt-pkg/sourcelist.h"
6c139d6e
AL
33#endif
34
35class pkgAquire;
36class pkgSourceList
37{
38 public:
39
b2e465d6
AL
40 // List of supported source list types
41 class Type
6c139d6e 42 {
b2e465d6 43 public:
6c139d6e 44
b2e465d6
AL
45 // Global list of Items supported
46 static Type **GlobalList;
47 static unsigned long GlobalListLen;
48 static Type *GetType(const char *Type);
49
50 const char *Name;
51 const char *Label;
52
53 bool FixupURI(string &URI) const;
54 virtual bool ParseLine(vector<pkgIndexFile *> &List,
55 const char *Buffer,
56 unsigned long CurLine,string File) const;
57 virtual bool CreateItem(vector<pkgIndexFile *> &List,string URI,
58 string Dist,string Section) const = 0;
59
60 Type();
61 virtual ~Type() {};
6c139d6e 62 };
b2e465d6
AL
63
64 typedef vector<pkgIndexFile *>::const_iterator const_iterator;
6c139d6e
AL
65
66 protected:
67
b2e465d6 68 vector<pkgIndexFile *> List;
6c139d6e
AL
69
70 public:
71
72 bool ReadMainList();
73 bool Read(string File);
6c139d6e
AL
74
75 // List accessors
76 inline const_iterator begin() const {return List.begin();};
77 inline const_iterator end() const {return List.end();};
78 inline unsigned int size() const {return List.size();};
79 inline bool empty() const {return List.empty();};
0118833a 80
b2e465d6
AL
81 bool FindIndex(pkgCache::PkgFileIterator File,
82 pkgIndexFile *&Found) const;
83 bool GetIndexes(pkgAcquire *Owner) const;
84
6c139d6e
AL
85 pkgSourceList();
86 pkgSourceList(string File);
87};
88
6c139d6e 89#endif