1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
5 Source Package Records - Allows access to source package records
7 Parses and allows access to the list of source records and searching by
8 source name on that list.
10 ##################################################################### */
12 #ifndef PKGLIB_SRCRECORDS_H
13 #define PKGLIB_SRCRECORDS_H
15 #include <apt-pkg/macros.h>
16 #include <apt-pkg/hashes.h>
21 #ifndef APT_8_CLEANER_HEADERS
32 APT_IGNORE_DEPRECATED_PUSH
33 // Describes a single file
36 APT_DEPRECATED_MSG("Use Hashes member instead of hardcoded hash algorithm") std::string MD5Hash
;
37 APT_DEPRECATED_MSG("Use FileSize member instead") unsigned long Size
;
41 struct File2
: public File
43 unsigned long long FileSize
;
44 HashStringList Hashes
;
46 APT_IGNORE_DEPRECATED_POP
48 // Abstract parser for each source record
54 const pkgIndexFile
*iIndex
;
58 enum BuildDep
{BuildDepend
=0x0,BuildDependIndep
=0x1,
59 BuildConflict
=0x2,BuildConflictIndep
=0x3,
60 BuildDependArch
=0x4,BuildConflictArch
=0x5};
70 inline const pkgIndexFile
&Index() const {return *iIndex
;};
72 virtual bool Restart() = 0;
73 virtual bool Step() = 0;
74 virtual bool Jump(unsigned long const &Off
) = 0;
75 virtual unsigned long Offset() = 0;
76 virtual std::string
AsStr() = 0;
78 virtual std::string
Package() const = 0;
79 virtual std::string
Version() const = 0;
80 virtual std::string
Maintainer() const = 0;
81 virtual std::string
Section() const = 0;
82 virtual const char **Binaries() = 0; // Ownership does not transfer
84 //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching
85 virtual bool BuildDepends(std::vector
<BuildDepRec
> &BuildDeps
, bool const &ArchOnly
, bool const &StripMultiArch
= true) = 0;
86 static const char *BuildDepType(unsigned char const &Type
) APT_PURE
;
88 virtual bool Files(std::vector
<pkgSrcRecords::File
> &F
) = 0;
89 bool Files2(std::vector
<pkgSrcRecords::File2
> &F
);
91 explicit Parser(const pkgIndexFile
*Index
);
96 /** \brief dpointer placeholder (for later in case we need it) */
99 // The list of files and the current parser pointer
100 std::vector
<Parser
*> Files
;
101 std::vector
<Parser
*>::iterator Current
;
108 // Step to the next SourcePackage and return pointer to the
109 // next SourceRecord. The pointer is owned by libapt.
110 const Parser
* Step();
112 // Locate a package by name and return pointer to the Parser.
113 // The pointer is owned by libapt.
114 Parser
* Find(const char *Package
,bool const &SrcOnly
= false);
116 explicit pkgSrcRecords(pkgSourceList
&List
);
117 virtual ~pkgSrcRecords();