1 // -*- mode: cpp; mode: fold -*-
3 // $Id: sourcelist.h,v 1.12.2.1 2003/12/24 23:09:17 mdz Exp $
4 /* ######################################################################
6 SourceList - Manage a list of sources
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
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
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
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 perform.
25 ##################################################################### */
27 #ifndef PKGLIB_SOURCELIST_H
28 #define PKGLIB_SOURCELIST_H
33 #include <apt-pkg/pkgcache.h>
47 // List of supported source list types
52 // Global list of Items supported
53 static Type
**GlobalList
;
54 static unsigned long GlobalListLen
;
55 static Type
*GetType(const char *Type
);
60 bool FixupURI(string
&URI
) const;
61 virtual bool ParseLine(vector
<metaIndex
*> &List
,
63 unsigned long const &CurLine
,string
const &File
) const;
64 virtual bool CreateItem(vector
<metaIndex
*> &List
,string
const &URI
,
65 string
const &Dist
,string
const &Section
,
66 std::map
<string
, string
> const &Options
) const = 0;
71 typedef vector
<metaIndex
*>::const_iterator const_iterator
;
75 vector
<metaIndex
*> SrcList
;
80 bool Read(string File
);
84 bool ReadAppend(string File
);
85 bool ReadSourceDir(string Dir
);
88 inline const_iterator
begin() const {return SrcList
.begin();};
89 inline const_iterator
end() const {return SrcList
.end();};
90 inline unsigned int size() const {return SrcList
.size();};
91 inline bool empty() const {return SrcList
.empty();};
93 bool FindIndex(pkgCache::PkgFileIterator File
,
94 pkgIndexFile
*&Found
) const;
95 bool GetIndexes(pkgAcquire
*Owner
, bool GetAll
=false) const;
97 // query last-modified time
98 time_t GetLastModifiedTime();
101 pkgSourceList(string File
);