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/indexfile.h>
00008 
00009 class pkgAcquire;
00010 class pkgCacheGenerator;
00011 class OpProgress;
00012 
00013 class metaIndex
00014 {
00015    protected:
00016    std::vector <pkgIndexFile *> *Indexes;
00017    const char *Type;
00018    std::string URI;
00019    std::string Dist;
00020    bool Trusted;
00021 
00022    public:
00023 
00024    
00025    // Various accessors
00026    virtual std::string GetURI() const {return URI;}
00027    virtual std::string GetDist() const {return Dist;}
00028    virtual const char* GetType() const {return Type;}
00029 
00030    // Interface for acquire
00031    virtual std::string ArchiveURI(std::string const& /*File*/) const = 0;
00032    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
00033    
00034    virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0; 
00035    virtual bool IsTrusted() const = 0;
00036 
00037    metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) :
00038                 Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
00039    }
00040 
00041    virtual ~metaIndex() {
00042       if (Indexes == 0)
00043          return;
00044       for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
00045          delete *I;
00046       delete Indexes;
00047    }
00048 };
00049 
00050 #endif