]> git.saurik.com Git - apt.git/blob - apt-pkg/sourcelist.h
Add missing \n
[apt.git] / apt-pkg / sourcelist.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: sourcelist.h,v 1.10 2001/03/13 06:51:46 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 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.
15
16 The types are mapped through a list of type definitions which handle
17 the actual construction of the back end type. After loading a source
18 list all you have is a list of package index files that have the ability
19 to be Acquired.
20
21 The vendor machanism is similar, except the vendor types are hard
22 wired. Before loading the source list the vendor list is loaded.
23 This doesn't load key data, just the checks to preform.
24
25 ##################################################################### */
26 /*}}}*/
27 #ifndef PKGLIB_SOURCELIST_H
28 #define PKGLIB_SOURCELIST_H
29
30 #include <string>
31 #include <vector>
32 #include <apt-pkg/pkgcache.h>
33 #include <apt-pkg/indexfile.h>
34
35 #ifdef __GNUG__
36 #pragma interface "apt-pkg/sourcelist.h"
37 #endif
38
39 class pkgAquire;
40 class pkgSourceList
41 {
42 public:
43
44 // An available vendor
45 struct Vendor
46 {
47 string VendorID;
48 string FingerPrint;
49 string Description;
50
51 /* Lets revisit these..
52 bool MatchFingerPrint(string FingerPrint);
53 string FingerPrintDescr();*/
54 };
55
56 // List of supported source list types
57 class Type
58 {
59 public:
60
61 // Global list of Items supported
62 static Type **GlobalList;
63 static unsigned long GlobalListLen;
64 static Type *GetType(const char *Type);
65
66 const char *Name;
67 const char *Label;
68
69 bool FixupURI(string &URI) const;
70 virtual bool ParseLine(vector<pkgIndexFile *> &List,
71 Vendor const *Vendor,
72 const char *Buffer,
73 unsigned long CurLine,string File) const;
74 virtual bool CreateItem(vector<pkgIndexFile *> &List,string URI,
75 string Dist,string Section,
76 Vendor const *Vendor) const = 0;
77
78 Type();
79 virtual ~Type() {};
80 };
81
82 typedef vector<pkgIndexFile *>::const_iterator const_iterator;
83
84 protected:
85
86 vector<pkgIndexFile *> SrcList;
87 vector<Vendor const *> VendorList;
88
89 public:
90
91 bool ReadMainList();
92 bool Read(string File);
93 bool ReadVendors();
94
95 // List accessors
96 inline const_iterator begin() const {return SrcList.begin();};
97 inline const_iterator end() const {return SrcList.end();};
98 inline unsigned int size() const {return SrcList.size();};
99 inline bool empty() const {return SrcList.empty();};
100
101 bool FindIndex(pkgCache::PkgFileIterator File,
102 pkgIndexFile *&Found) const;
103 bool GetIndexes(pkgAcquire *Owner) const;
104
105 pkgSourceList();
106 pkgSourceList(string File);
107 };
108
109 #endif