]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgrecords.h
use free() instead of delete() when realloc is used
[apt.git] / apt-pkg / pkgrecords.h
CommitLineData
f55ece0e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
a7c835af 3// $Id: pkgrecords.h,v 1.6 2001/03/13 06:51:46 jgg Exp $
f55ece0e
AL
4/* ######################################################################
5
6 Package Records - Allows access to complete package description records
7 directly from the file.
8
9 The package record system abstracts the actual parsing of the
10 package files. This is different than the generators parser in that
11 it is used to access information not generate information. No
12 information touched by the generator should be parable from here as
13 it can always be retreived directly from the cache.
14
15 ##################################################################### */
16 /*}}}*/
f55ece0e
AL
17#ifndef PKGLIB_PKGRECORDS_H
18#define PKGLIB_PKGRECORDS_H
19
f55ece0e 20#include <apt-pkg/pkgcache.h>
453b82a3
DK
21
22#include <string>
30257943 23#include <vector>
f55ece0e 24
92fcbfc1 25class pkgRecords /*{{{*/
f55ece0e
AL
26{
27 public:
28 class Parser;
29
30 private:
be9b62f7
MV
31 /** \brief dpointer placeholder (for later in case we need it) */
32 void *d;
f55ece0e
AL
33
34 pkgCache &Cache;
30257943
MV
35 std::vector<Parser *>Files;
36
be9b62f7 37 public:
f55ece0e 38 // Lookup function
03e39e59 39 Parser &Lookup(pkgCache::VerFileIterator const &Ver);
a52f938b 40 Parser &Lookup(pkgCache::DescFileIterator const &Desc);
03e39e59 41
f55ece0e
AL
42 // Construct destruct
43 pkgRecords(pkgCache &Cache);
44 ~pkgRecords();
45};
92fcbfc1
DK
46 /*}}}*/
47class pkgRecords::Parser /*{{{*/
f55ece0e 48{
7e798dd7 49 protected:
f55ece0e 50
03e39e59 51 virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
a52f938b 52 virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
f55ece0e 53
7e798dd7 54 public:
b2e465d6 55 friend class pkgRecords;
7e798dd7
AL
56
57 // These refer to the archive file for the Version
8f3ba4e8
DK
58 virtual std::string FileName() {return std::string();};
59 virtual std::string MD5Hash() {return std::string();};
60 virtual std::string SHA1Hash() {return std::string();};
61 virtual std::string SHA256Hash() {return std::string();};
62 virtual std::string SHA512Hash() {return std::string();};
63 virtual std::string SourcePkg() {return std::string();};
64 virtual std::string SourceVer() {return std::string();};
b2e465d6 65
7e798dd7 66 // These are some general stats about the package
8f3ba4e8
DK
67 virtual std::string Maintainer() {return std::string();};
68 virtual std::string ShortDesc() {return std::string();};
69 virtual std::string LongDesc() {return std::string();};
70 virtual std::string Name() {return std::string();};
71 virtual std::string Homepage() {return std::string();}
75bda619
MV
72
73 // An arbitrary custom field
65512241 74 virtual std::string RecordField(const char * /*fieldName*/) { return std::string();};
75bda619 75
b2e465d6
AL
76 // The record in binary form
77 virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
78
f55ece0e
AL
79 virtual ~Parser() {};
80};
92fcbfc1 81 /*}}}*/
f55ece0e 82#endif