apt @VERSION@
indexrecords.h
00001 // -*- mode: cpp; mode: fold -*-
00002 // Description                                                          /*{{{*/
00003 // $Id: indexrecords.h,v 1.1.2.1 2003/12/24 23:09:17 mdz Exp $
00004                                                                         /*}}}*/
00005 #ifndef PKGLIB_INDEXRECORDS_H
00006 #define PKGLIB_INDEXRECORDS_H
00007 
00008 
00009 #include <apt-pkg/pkgcache.h>
00010 #include <apt-pkg/hashes.h>
00011 
00012 #include <map>
00013 #include <vector>
00014 #include <ctime>
00015 
00016 class indexRecords
00017 {
00018    bool parseSumData(const char *&Start, const char *End, std::string &Name,
00019                      std::string &Hash, unsigned long long &Size);
00020    public:
00021    struct checkSum;
00022    std::string ErrorText;
00023    
00024    protected:
00025    std::string Dist;
00026    std::string Suite;
00027    std::string ExpectedDist;
00028    time_t ValidUntil;
00029 
00030    std::map<std::string,checkSum *> Entries;
00031 
00032    public:
00033 
00034    indexRecords();
00035    indexRecords(const std::string ExpectedDist);
00036 
00037    // Lookup function
00038    virtual const checkSum *Lookup(const std::string MetaKey);
00040    bool Exists(std::string const &MetaKey) const;
00041    std::vector<std::string> MetaKeys();
00042 
00043    virtual bool Load(std::string Filename);
00044    std::string GetDist() const;
00045    time_t GetValidUntil() const;
00046    virtual bool CheckDist(const std::string MaybeDist) const;
00047    std::string GetExpectedDist() const;
00048    virtual ~indexRecords(){};
00049 };
00050 
00051 struct indexRecords::checkSum
00052 {
00053    std::string MetaKeyFilename;
00054    HashString Hash;
00055    unsigned long long Size;
00056 };
00057 
00058 #endif