apt @VERSION@
|
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 <apt-pkg/fileutl.h> 00023 #include <vector> 00024 00025 class pkgRecords /*{{{*/ 00026 { 00027 public: 00028 class Parser; 00029 00030 private: 00032 void *d; 00033 00034 pkgCache &Cache; 00035 std::vector<Parser *>Files; 00036 00037 public: 00038 // Lookup function 00039 Parser &Lookup(pkgCache::VerFileIterator const &Ver); 00040 Parser &Lookup(pkgCache::DescFileIterator const &Desc); 00041 00042 // Construct destruct 00043 pkgRecords(pkgCache &Cache); 00044 ~pkgRecords(); 00045 }; 00046 /*}}}*/ 00047 class pkgRecords::Parser /*{{{*/ 00048 { 00049 protected: 00050 00051 virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0; 00052 virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0; 00053 00054 public: 00055 friend class pkgRecords; 00056 00057 // These refer to the archive file for the Version 00058 virtual string FileName() {return string();}; 00059 virtual string MD5Hash() {return string();}; 00060 virtual string SHA1Hash() {return string();}; 00061 virtual string SHA256Hash() {return string();}; 00062 virtual string SHA512Hash() {return string();}; 00063 virtual string SourcePkg() {return string();}; 00064 virtual string SourceVer() {return string();}; 00065 00066 // These are some general stats about the package 00067 virtual string Maintainer() {return string();}; 00068 virtual string ShortDesc() {return string();}; 00069 virtual string LongDesc() {return string();}; 00070 virtual string Name() {return string();}; 00071 virtual string Homepage() {return string();} 00072 00073 // An arbitrary custom field 00074 virtual string RecordField(const char *fieldName) { return string();}; 00075 00076 // The record in binary form 00077 virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; 00078 00079 virtual ~Parser() {}; 00080 }; 00081 /*}}}*/ 00082 #endif