apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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