1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
5 SourceList - Manage a list of sources
7 The Source List class provides access to a list of sources. It
8 can read them from a file and generate a list of all the distinct
11 All sources have a type associated with them that defines the layout
12 of the archive. The exact format of the file is documented in
15 The types are mapped through a list of type definitions which handle
16 the actual construction of the back end type. After loading a source
17 list all you have is a list of package index files that have the ability
20 The vendor machanism is similar, except the vendor types are hard
21 wired. Before loading the source list the vendor list is loaded.
22 This doesn't load key data, just the checks to perform.
24 ##################################################################### */
26 #ifndef PKGLIB_SOURCELIST_H
27 #define PKGLIB_SOURCELIST_H
29 #include <apt-pkg/pkgcache.h>
30 #include <apt-pkg/cacheiterators.h>
31 #include <apt-pkg/macros.h>
39 #ifndef APT_8_CLEANER_HEADERS
40 #include <apt-pkg/tagfile.h>
42 #ifndef APT_8_CLEANER_HEADERS
43 #include <apt-pkg/metaindex.h>
59 // List of supported source list types
64 // Global list of Items supported
65 static Type
**GlobalList
;
66 static unsigned long GlobalListLen
;
67 static Type
*GetType(const char *Type
) APT_PURE
;
72 bool FixupURI(std::string
&URI
) const;
73 virtual bool ParseStanza(std::vector
<metaIndex
*> &List
,
77 virtual bool ParseLine(std::vector
<metaIndex
*> &List
,
79 unsigned long const &CurLine
,std::string
const &File
) const;
80 virtual bool CreateItem(std::vector
<metaIndex
*> &List
,std::string
const &URI
,
81 std::string
const &Dist
,std::string
const &Section
,
82 std::map
<std::string
, std::string
> const &Options
) const = 0;
87 typedef std::vector
<metaIndex
*>::const_iterator const_iterator
;
91 std::vector
<metaIndex
*> SrcList
;
93 int ParseFileDeb822(std::string File
);
94 bool ParseFileOldStyle(std::string File
);
99 bool Read(std::string File
);
103 bool ReadAppend(std::string File
);
104 bool ReadSourceDir(std::string Dir
);
107 inline const_iterator
begin() const {return SrcList
.begin();};
108 inline const_iterator
end() const {return SrcList
.end();};
109 inline unsigned int size() const {return SrcList
.size();};
110 inline bool empty() const {return SrcList
.empty();};
112 bool FindIndex(pkgCache::PkgFileIterator File
,
113 pkgIndexFile
*&Found
) const;
114 bool GetIndexes(pkgAcquire
*Owner
, bool GetAll
=false) const;
116 // query last-modified time
117 time_t GetLastModifiedTime();
120 pkgSourceList(std::string File
);
121 virtual ~pkgSourceList();