]> git.saurik.com Git - apt.git/blame - apt-pkg/srcrecords.h
Merge branch 'debian/sid' into debian/experimental
[apt.git] / apt-pkg / srcrecords.h
CommitLineData
11e7af84
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b3d44315 3// $Id: srcrecords.h,v 1.8.2.1 2003/12/26 16:27:34 mdz Exp $
11e7af84
AL
4/* ######################################################################
5
6 Source Package Records - Allows access to source package records
7
8 Parses and allows access to the list of source records and searching by
9 source name on that list.
10
11 ##################################################################### */
12 /*}}}*/
13#ifndef PKGLIB_SRCRECORDS_H
14#define PKGLIB_SRCRECORDS_H
15
a02db58f 16#include <apt-pkg/macros.h>
11e7af84 17
b2e465d6 18#include <string>
8f3ba4e8 19#include <vector>
0a843901 20
a4f6bdc8
DK
21#ifndef APT_8_CLEANER_HEADERS
22using std::string;
23using std::vector;
24#endif
25
b2e465d6
AL
26class pkgSourceList;
27class pkgIndexFile;
11e7af84
AL
28class pkgSrcRecords
29{
30 public:
36f610f1
AL
31
32 // Describes a single file
33 struct File
34 {
a1b5561a 35 std::string MD5Hash;
cb6a2b3e 36 std::string Hash;
36f610f1 37 unsigned long Size;
8f3ba4e8
DK
38 std::string Path;
39 std::string Type;
36f610f1 40 };
11e7af84 41
36f610f1 42 // Abstract parser for each source record
11e7af84
AL
43 class Parser
44 {
b2e465d6
AL
45 protected:
46
47 const pkgIndexFile *iIndex;
36375005 48
11e7af84
AL
49 public:
50
b2e465d6
AL
51 enum BuildDep {BuildDepend=0x0,BuildDependIndep=0x1,
52 BuildConflict=0x2,BuildConflictIndep=0x3};
53
54 struct BuildDepRec
55 {
8f3ba4e8
DK
56 std::string Package;
57 std::string Version;
b2e465d6
AL
58 unsigned int Op;
59 unsigned char Type;
60 };
61
62 inline const pkgIndexFile &Index() const {return *iIndex;};
36375005 63
11e7af84
AL
64 virtual bool Restart() = 0;
65 virtual bool Step() = 0;
41c81fd8 66 virtual bool Jump(unsigned long const &Off) = 0;
11e7af84 67 virtual unsigned long Offset() = 0;
8f3ba4e8 68 virtual std::string AsStr() = 0;
11e7af84 69
8f3ba4e8
DK
70 virtual std::string Package() const = 0;
71 virtual std::string Version() const = 0;
72 virtual std::string Maintainer() const = 0;
73 virtual std::string Section() const = 0;
b2e465d6
AL
74 virtual const char **Binaries() = 0; // Ownership does not transfer
75
65f99834 76 //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching
8f3ba4e8 77 virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0;
a02db58f 78 static const char *BuildDepType(unsigned char const &Type) APT_PURE;
b2e465d6 79
8f3ba4e8 80 virtual bool Files(std::vector<pkgSrcRecords::File> &F) = 0;
11e7af84 81
b2e465d6
AL
82 Parser(const pkgIndexFile *Index) : iIndex(Index) {};
83 virtual ~Parser() {};
11e7af84
AL
84 };
85
86 private:
be9b62f7
MV
87 /** \brief dpointer placeholder (for later in case we need it) */
88 void *d;
11e7af84
AL
89
90 // The list of files and the current parser pointer
8f3ba4e8
DK
91 std::vector<Parser*> Files;
92 std::vector<Parser *>::iterator Current;
11e7af84
AL
93
94 public:
95
96 // Reset the search
97 bool Restart();
98
99 // Locate a package by name
41c81fd8 100 Parser *Find(const char *Package,bool const &SrcOnly = false);
11e7af84
AL
101
102 pkgSrcRecords(pkgSourceList &List);
ff72bd0d 103 virtual ~pkgSrcRecords();
11e7af84
AL
104};
105
11e7af84 106#endif