apt
1.5
|
00001 // -*- mode: cpp; mode: fold -*- 00002 // Description /*{{{*/ 00003 // $Id: debindexfile.h,v 1.3.2.1 2003/12/24 23:09:17 mdz Exp $ 00004 /* ###################################################################### 00005 00006 Debian Index Files 00007 00008 There are three sorts currently 00009 00010 Package files that have File: tags 00011 Package files that don't (/var/lib/dpkg/status) 00012 Source files 00013 00014 ##################################################################### */ 00015 /*}}}*/ 00016 #ifndef PKGLIB_DEBINDEXFILE_H 00017 #define PKGLIB_DEBINDEXFILE_H 00018 00019 00020 00021 #include <apt-pkg/indexfile.h> 00022 00023 class debStatusIndex : public pkgIndexFile 00024 { 00026 void *d; 00027 00028 protected: 00029 std::string File; 00030 00031 public: 00032 00033 virtual const Type *GetType() const; 00034 00035 // Interface for acquire 00036 virtual std::string Describe(bool Short) const {return File;}; 00037 00038 // Interface for the Cache Generator 00039 virtual bool Exists() const; 00040 virtual bool HasPackages() const {return true;}; 00041 virtual unsigned long Size() const; 00042 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; 00043 bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const; 00044 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; 00045 00046 debStatusIndex(std::string File); 00047 virtual ~debStatusIndex() {}; 00048 }; 00049 00050 class debPackagesIndex : public pkgIndexFile 00051 { 00053 void *d; 00054 00055 std::string URI; 00056 std::string Dist; 00057 std::string Section; 00058 std::string Architecture; 00059 00060 std::string Info(const char *Type) const; 00061 std::string IndexFile(const char *Type) const; 00062 std::string IndexURI(const char *Type) const; 00063 00064 public: 00065 00066 virtual const Type *GetType() const; 00067 00068 // Stuff for accessing files on remote items 00069 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; 00070 virtual std::string ArchiveURI(std::string File) const {return URI + File;}; 00071 00072 // Interface for acquire 00073 virtual std::string Describe(bool Short) const; 00074 00075 // Interface for the Cache Generator 00076 virtual bool Exists() const; 00077 virtual bool HasPackages() const {return true;}; 00078 virtual unsigned long Size() const; 00079 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; 00080 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; 00081 00082 debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section, 00083 bool const &Trusted, std::string const &Arch = "native"); 00084 virtual ~debPackagesIndex() {}; 00085 }; 00086 00087 class debTranslationsIndex : public pkgIndexFile 00088 { 00090 void *d; 00091 00092 std::string URI; 00093 std::string Dist; 00094 std::string Section; 00095 const char * const Language; 00096 00097 std::string Info(const char *Type) const; 00098 std::string IndexFile(const char *Type) const; 00099 std::string IndexURI(const char *Type) const; 00100 00101 inline std::string TranslationFile() const {return std::string("Translation-").append(Language);}; 00102 00103 public: 00104 00105 virtual const Type *GetType() const; 00106 00107 // Interface for acquire 00108 virtual std::string Describe(bool Short) const; 00109 virtual bool GetIndexes(pkgAcquire *Owner) const; 00110 00111 // Interface for the Cache Generator 00112 virtual bool Exists() const; 00113 virtual bool HasPackages() const; 00114 virtual unsigned long Size() const; 00115 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; 00116 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; 00117 00118 debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language); 00119 virtual ~debTranslationsIndex() {}; 00120 }; 00121 00122 class debSourcesIndex : public pkgIndexFile 00123 { 00125 void *d; 00126 00127 std::string URI; 00128 std::string Dist; 00129 std::string Section; 00130 00131 std::string Info(const char *Type) const; 00132 std::string IndexFile(const char *Type) const; 00133 std::string IndexURI(const char *Type) const; 00134 00135 public: 00136 00137 virtual const Type *GetType() const; 00138 00139 // Stuff for accessing files on remote items 00140 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, 00141 pkgSrcRecords::File const &File) const; 00142 virtual std::string ArchiveURI(std::string File) const {return URI + File;}; 00143 00144 // Interface for acquire 00145 virtual std::string Describe(bool Short) const; 00146 00147 // Interface for the record parsers 00148 virtual pkgSrcRecords::Parser *CreateSrcParser() const; 00149 00150 // Interface for the Cache Generator 00151 virtual bool Exists() const; 00152 virtual bool HasPackages() const {return false;}; 00153 virtual unsigned long Size() const; 00154 00155 debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted); 00156 virtual ~debSourcesIndex() {}; 00157 }; 00158 00159 #endif