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 #ifndef APT_8_CLEANER_HEADERS
00017 #include <apt-pkg/fileutl.h>
00018 #endif
00019 
00020 class indexRecords
00021 {
00022    bool parseSumData(const char *&Start, const char *End, std::string &Name,
00023                      std::string &Hash, unsigned long long &Size);
00024    public:
00025    struct checkSum;
00026    std::string ErrorText;
00027    
00028    protected:
00029    std::string Dist;
00030    std::string Suite;
00031    std::string ExpectedDist;
00032    time_t ValidUntil;
00033 
00034    std::map<std::string,checkSum *> Entries;
00035 
00036    public:
00037 
00038    indexRecords();
00039    indexRecords(const std::string ExpectedDist);
00040 
00041    // Lookup function
00042    virtual const checkSum *Lookup(const std::string MetaKey);
00044    bool Exists(std::string const &MetaKey) const;
00045    std::vector<std::string> MetaKeys();
00046 
00047    virtual bool Load(std::string Filename);
00048    std::string GetDist() const;
00049    time_t GetValidUntil() const;
00050    virtual bool CheckDist(const std::string MaybeDist) const;
00051    std::string GetExpectedDist() const;
00052    virtual ~indexRecords(){};
00053 };
00054 
00055 struct indexRecords::checkSum
00056 {
00057    std::string MetaKeyFilename;
00058    HashString Hash;
00059    unsigned long long Size;
00060 };
00061 
00062 #endif