apt @VERSION@

debindexfile.h

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 {
00025    string File;
00026    
00027    public:
00028 
00029    virtual const Type *GetType() const;
00030    
00031    // Interface for acquire
00032    virtual string Describe(bool Short) const {return File;};
00033    
00034    // Interface for the Cache Generator
00035    virtual bool Exists() const;
00036    virtual bool HasPackages() const {return true;};
00037    virtual unsigned long Size() const;
00038    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
00039    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
00040 
00041    debStatusIndex(string File);
00042 };
00043     
00044 class debPackagesIndex : public pkgIndexFile
00045 {
00046    string URI;
00047    string Dist;
00048    string Section;
00049    string Architecture;
00050 
00051    string Info(const char *Type) const;
00052    string IndexFile(const char *Type) const;
00053    string IndexURI(const char *Type) const;
00054    
00055    public:
00056    
00057    virtual const Type *GetType() const;
00058 
00059    // Stuff for accessing files on remote items
00060    virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
00061    virtual string ArchiveURI(string File) const {return URI + File;};
00062    
00063    // Interface for acquire
00064    virtual string Describe(bool Short) const;   
00065    
00066    // Interface for the Cache Generator
00067    virtual bool Exists() const;
00068    virtual bool HasPackages() const {return true;};
00069    virtual unsigned long Size() const;
00070    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
00071    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
00072 
00073    debPackagesIndex(string const &URI, string const &Dist, string const &Section,
00074                         bool const &Trusted, string const &Arch = "native");
00075 };
00076 
00077 class debTranslationsIndex : public pkgIndexFile
00078 {
00079    string URI;
00080    string Dist;
00081    string Section;
00082    const char * const Language;
00083    
00084    string Info(const char *Type) const;
00085    string IndexFile(const char *Type) const;
00086    string IndexURI(const char *Type) const;
00087 
00088    inline string TranslationFile() const {return string("Translation-").append(Language);};
00089 
00090    public:
00091    
00092    virtual const Type *GetType() const;
00093 
00094    // Interface for acquire
00095    virtual string Describe(bool Short) const;   
00096    virtual bool GetIndexes(pkgAcquire *Owner) const;
00097    
00098    // Interface for the Cache Generator
00099    virtual bool Exists() const;
00100    virtual bool HasPackages() const;
00101    virtual unsigned long Size() const;
00102    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
00103    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
00104 
00105    debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
00106 };
00107 
00108 class debSourcesIndex : public pkgIndexFile
00109 {
00110    string URI;
00111    string Dist;
00112    string Section;
00113 
00114    string Info(const char *Type) const;
00115    string IndexFile(const char *Type) const;
00116    string IndexURI(const char *Type) const;
00117    
00118    public:
00119 
00120    virtual const Type *GetType() const;
00121 
00122    // Stuff for accessing files on remote items
00123    virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
00124                              pkgSrcRecords::File const &File) const;
00125    virtual string ArchiveURI(string File) const {return URI + File;};
00126    
00127    // Interface for acquire
00128    virtual string Describe(bool Short) const;   
00129 
00130    // Interface for the record parsers
00131    virtual pkgSrcRecords::Parser *CreateSrcParser() const;
00132    
00133    // Interface for the Cache Generator
00134    virtual bool Exists() const;
00135    virtual bool HasPackages() const {return false;};
00136    virtual unsigned long Size() const;
00137    
00138    debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
00139 };
00140 
00141 #endif