00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef PKGLIB_SOURCELIST_H
00028 #define PKGLIB_SOURCELIST_H
00029
00030 #include <string>
00031 #include <vector>
00032 #include <map>
00033 #include <apt-pkg/pkgcache.h>
00034 #include <apt-pkg/metaindex.h>
00035
00036 using std::string;
00037 using std::vector;
00038
00039
00040 class pkgAquire;
00041 class pkgSourceList
00042 {
00043 public:
00044
00045
00046 class Type
00047 {
00048 public:
00049
00050
00051 static Type **GlobalList;
00052 static unsigned long GlobalListLen;
00053 static Type *GetType(const char *Type);
00054
00055 const char *Name;
00056 const char *Label;
00057
00058 bool FixupURI(string &URI) const;
00059 virtual bool ParseLine(vector<metaIndex *> &List,
00060 const char *Buffer,
00061 unsigned long const &CurLine,string const &File) const;
00062 virtual bool CreateItem(vector<metaIndex *> &List,string const &URI,
00063 string const &Dist,string const &Section,
00064 std::map<string, string> const &Options) const = 0;
00065 Type();
00066 virtual ~Type() {};
00067 };
00068
00069 typedef vector<metaIndex *>::const_iterator const_iterator;
00070
00071 protected:
00072
00073 vector<metaIndex *> SrcList;
00074
00075 public:
00076
00077 bool ReadMainList();
00078 bool Read(string File);
00079
00080
00081 void Reset();
00082 bool ReadAppend(string File);
00083 bool ReadSourceDir(string Dir);
00084
00085
00086 inline const_iterator begin() const {return SrcList.begin();};
00087 inline const_iterator end() const {return SrcList.end();};
00088 inline unsigned int size() const {return SrcList.size();};
00089 inline bool empty() const {return SrcList.empty();};
00090
00091 bool FindIndex(pkgCache::PkgFileIterator File,
00092 pkgIndexFile *&Found) const;
00093 bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const;
00094
00095 pkgSourceList();
00096 pkgSourceList(string File);
00097 ~pkgSourceList();
00098 };
00099
00100 #endif