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