1 // -*- mode: cpp; mode: fold -*-
3 // $Id: srcrecords.h,v 1.8.2.1 2003/12/26 16:27:34 mdz Exp $
4 /* ######################################################################
6 Source Package Records - Allows access to source package records
8 Parses and allows access to the list of source records and searching by
9 source name on that list.
11 ##################################################################### */
13 #ifndef PKGLIB_SRCRECORDS_H
14 #define PKGLIB_SRCRECORDS_H
16 #include <apt-pkg/macros.h>
17 #include <apt-pkg/hashes.h>
22 #ifndef APT_8_CLEANER_HEADERS
33 APT_IGNORE_DEPRECATED_PUSH
34 // Describes a single file
37 APT_DEPRECATED
std::string MD5Hash
;
38 APT_DEPRECATED
unsigned long Size
;
42 struct File2
: public File
44 unsigned long long FileSize
;
45 HashStringList Hashes
;
47 APT_IGNORE_DEPRECATED_POP
49 // Abstract parser for each source record
54 const pkgIndexFile
*iIndex
;
58 enum BuildDep
{BuildDepend
=0x0,BuildDependIndep
=0x1,
59 BuildConflict
=0x2,BuildConflictIndep
=0x3};
69 inline const pkgIndexFile
&Index() const {return *iIndex
;};
71 virtual bool Restart() = 0;
72 virtual bool Step() = 0;
73 virtual bool Jump(unsigned long const &Off
) = 0;
74 virtual unsigned long Offset() = 0;
75 virtual std::string
AsStr() = 0;
77 virtual std::string
Package() const = 0;
78 virtual std::string
Version() const = 0;
79 virtual std::string
Maintainer() const = 0;
80 virtual std::string
Section() const = 0;
81 virtual const char **Binaries() = 0; // Ownership does not transfer
83 //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching
84 virtual bool BuildDepends(std::vector
<BuildDepRec
> &BuildDeps
, bool const &ArchOnly
, bool const &StripMultiArch
= true) = 0;
85 static const char *BuildDepType(unsigned char const &Type
) APT_PURE
;
87 virtual bool Files(std::vector
<pkgSrcRecords::File
> &F
) = 0;
88 bool Files2(std::vector
<pkgSrcRecords::File2
> &F
);
90 Parser(const pkgIndexFile
*Index
) : iIndex(Index
) {};
95 /** \brief dpointer placeholder (for later in case we need it) */
98 // The list of files and the current parser pointer
99 std::vector
<Parser
*> Files
;
100 std::vector
<Parser
*>::iterator Current
;
107 // Step to the next SourcePackage and return pointer to the
108 // next SourceRecord. The pointer is owned by libapt.
109 const Parser
* Step();
111 // Locate a package by name and return pointer to the Parser.
112 // The pointer is owned by libapt.
113 Parser
* Find(const char *Package
,bool const &SrcOnly
= false);
115 pkgSrcRecords(pkgSourceList
&List
);
116 virtual ~pkgSrcRecords();