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    ##################################################################### */ 
  22 #ifndef PKGLIB_SOURCELIST_H 
  23 #define PKGLIB_SOURCELIST_H 
  25 #include <apt-pkg/pkgcache.h> 
  26 #include <apt-pkg/cacheiterators.h> 
  27 #include <apt-pkg/macros.h> 
  35 #ifndef APT_8_CLEANER_HEADERS 
  36 #include <apt-pkg/tagfile.h> 
  38 #ifndef APT_8_CLEANER_HEADERS 
  39 #include <apt-pkg/metaindex.h> 
  55    // List of supported source list types 
  60       // Global list of Items supported 
  61       static Type 
**GlobalList
; 
  62       static unsigned long GlobalListLen
; 
  63       static Type 
*GetType(const char *Type
) APT_PURE
; 
  65       char const * const Name
; 
  66       char const * const Label
; 
  68       bool FixupURI(std::string 
&URI
) const; 
  69       virtual bool ParseStanza(std::vector
<metaIndex 
*> &List
, 
  71                                unsigned int const stanza_n
, 
  73       virtual bool ParseLine(std::vector
<metaIndex 
*> &List
, 
  75                              unsigned int const CurLine
,std::string 
const &File
) const; 
  76       virtual bool CreateItem(std::vector
<metaIndex 
*> &List
,std::string 
const &URI
, 
  77                               std::string 
const &Dist
,std::string 
const &Section
, 
  78                               std::map
<std::string
, std::string
> const &Options
) const = 0; 
  79       Type(char const * const Name
, char const * const Label
); 
  83    typedef std::vector
<metaIndex 
*>::const_iterator const_iterator
; 
  87    std::vector
<metaIndex 
*> SrcList
; 
  90    APT_HIDDEN 
bool ParseFileDeb822(std::string 
const &File
); 
  91    APT_HIDDEN 
bool ParseFileOldStyle(std::string 
const &File
); 
  96    bool Read(std::string 
const &File
); 
 100    bool ReadAppend(std::string 
const &File
); 
 101    bool ReadSourceDir(std::string 
const &Dir
); 
 104    inline const_iterator 
begin() const {return SrcList
.begin();}; 
 105    inline const_iterator 
end() const {return SrcList
.end();}; 
 106    inline unsigned int size() const {return SrcList
.size();}; 
 107    inline bool empty() const {return SrcList
.empty();}; 
 109    bool FindIndex(pkgCache::PkgFileIterator File
, 
 110                   pkgIndexFile 
*&Found
) const; 
 111    bool GetIndexes(pkgAcquire 
*Owner
, bool GetAll
=false) const; 
 113    // query last-modified time 
 114    time_t GetLastModifiedTime(); 
 117    virtual ~pkgSourceList();