apt
1.5
|
00001 // -*- mode: cpp; mode: fold -*- 00002 // Description /*{{{*/ 00003 // $Id: pkgrecords.h,v 1.6 2001/03/13 06:51:46 jgg Exp $ 00004 /* ###################################################################### 00005 00006 Package Records - Allows access to complete package description records 00007 directly from the file. 00008 00009 The package record system abstracts the actual parsing of the 00010 package files. This is different than the generators parser in that 00011 it is used to access information not generate information. No 00012 information touched by the generator should be parable from here as 00013 it can always be retreived directly from the cache. 00014 00015 ##################################################################### */ 00016 /*}}}*/ 00017 #ifndef PKGLIB_PKGRECORDS_H 00018 #define PKGLIB_PKGRECORDS_H 00019 00020 00021 #include <apt-pkg/pkgcache.h> 00022 #include <vector> 00023 00024 class pkgRecords /*{{{*/ 00025 { 00026 public: 00027 class Parser; 00028 00029 private: 00031 void *d; 00032 00033 pkgCache &Cache; 00034 std::vector<Parser *>Files; 00035 00036 public: 00037 // Lookup function 00038 Parser &Lookup(pkgCache::VerFileIterator const &Ver); 00039 Parser &Lookup(pkgCache::DescFileIterator const &Desc); 00040 00041 // Construct destruct 00042 pkgRecords(pkgCache &Cache); 00043 ~pkgRecords(); 00044 }; 00045 /*}}}*/ 00046 class pkgRecords::Parser /*{{{*/ 00047 { 00048 protected: 00049 00050 virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0; 00051 virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0; 00052 00053 public: 00054 friend class pkgRecords; 00055 00056 // These refer to the archive file for the Version 00057 virtual std::string FileName() {return std::string();}; 00058 virtual std::string MD5Hash() {return std::string();}; 00059 virtual std::string SHA1Hash() {return std::string();}; 00060 virtual std::string SHA256Hash() {return std::string();}; 00061 virtual std::string SHA512Hash() {return std::string();}; 00062 virtual std::string SourcePkg() {return std::string();}; 00063 virtual std::string SourceVer() {return std::string();}; 00064 00065 // These are some general stats about the package 00066 virtual std::string Maintainer() {return std::string();}; 00067 virtual std::string ShortDesc() {return std::string();}; 00068 virtual std::string LongDesc() {return std::string();}; 00069 virtual std::string Name() {return std::string();}; 00070 virtual std::string Homepage() {return std::string();} 00071 00072 // An arbitrary custom field 00073 virtual std::string RecordField(const char *fieldName) { return std::string();}; 00074 00075 // The record in binary form 00076 virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; 00077 00078 virtual ~Parser() {}; 00079 }; 00080 /*}}}*/ 00081 #endif