apt @VERSION@
metaindex.h
00001 #ifndef PKGLIB_METAINDEX_H
00002 #define PKGLIB_METAINDEX_H
00003 
00004 
00005 #include <string>
00006 #include <apt-pkg/pkgcache.h>
00007 #include <apt-pkg/srcrecords.h>
00008 #include <apt-pkg/pkgrecords.h>
00009 #include <apt-pkg/indexfile.h>
00010 #include <apt-pkg/vendor.h>
00011     
00012 using std::string;
00013 
00014 class pkgAcquire;
00015 class pkgCacheGenerator;
00016 class OpProgress;
00017 
00018 class metaIndex
00019 {
00020    protected:
00021    vector <pkgIndexFile *> *Indexes;
00022    const char *Type;
00023    string URI;
00024    string Dist;
00025    bool Trusted;
00026 
00027    public:
00028 
00029    
00030    // Various accessors
00031    virtual string GetURI() const {return URI;}
00032    virtual string GetDist() const {return Dist;}
00033    virtual const char* GetType() const {return Type;}
00034 
00035    // Interface for acquire
00036    virtual string ArchiveURI(string const& /*File*/) const = 0;
00037    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
00038    
00039    virtual vector<pkgIndexFile *> *GetIndexFiles() = 0; 
00040    virtual bool IsTrusted() const = 0;
00041 
00042    metaIndex(string const &URI, string const &Dist, char const * const Type) :
00043                 Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
00044    }
00045 
00046    virtual ~metaIndex() {
00047       if (Indexes == 0)
00048          return;
00049       for (vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
00050          delete *I;
00051       delete Indexes;
00052    }
00053 };
00054 
00055 #endif