]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/deb/deblistparser.h
ensure that short-name -> long-name detection for dpkg-status works for reinstalls too
[apt.git] / apt-pkg / deb / deblistparser.h
... / ...
CommitLineData
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: deblistparser.h,v 1.9 2001/02/20 07:03:17 jgg Exp $
4/* ######################################################################
5
6 Debian Package List Parser - This implements the abstract parser
7 interface for Debian package files
8
9 ##################################################################### */
10 /*}}}*/
11#ifndef PKGLIB_DEBLISTPARSER_H
12#define PKGLIB_DEBLISTPARSER_H
13
14#include <apt-pkg/pkgcachegen.h>
15#include <apt-pkg/tagfile.h>
16
17#ifndef APT_8_CLEANER_HEADERS
18#include <apt-pkg/indexfile.h>
19#endif
20
21class debListParser : public pkgCacheGenerator::ListParser
22{
23 public:
24
25 // Parser Helper
26 struct WordList
27 {
28 const char *Str;
29 unsigned char Val;
30 };
31
32 private:
33 /** \brief dpointer placeholder (for later in case we need it) */
34 void *d;
35
36 protected:
37 pkgTagFile Tags;
38 pkgTagSection Section;
39 unsigned long iOffset;
40 std::string Arch;
41 std::vector<std::string> Architectures;
42 bool MultiArchEnabled;
43
44 unsigned long UniqFindTagWrite(const char *Tag);
45 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
46 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
47 unsigned int Type);
48 bool ParseProvides(pkgCache::VerIterator &Ver);
49 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version);
50 static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
51
52 public:
53
54 static unsigned char GetPrio(std::string Str);
55
56 // These all operate against the current section
57 virtual std::string Package();
58 virtual std::string Architecture();
59 virtual bool ArchitectureAll();
60 virtual std::string Version();
61 virtual bool NewVersion(pkgCache::VerIterator &Ver);
62 virtual std::string Description();
63 virtual std::string DescriptionLanguage();
64 virtual MD5SumValue Description_md5();
65 virtual unsigned short VersionHash();
66 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
67 pkgCache::VerIterator &Ver);
68 virtual unsigned long Offset() {return iOffset;};
69 virtual unsigned long Size() {return Section.size();};
70
71 virtual bool Step();
72
73 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
74 std::string section);
75
76 static const char *ParseDepends(const char *Start,const char *Stop,
77 std::string &Package,std::string &Ver,unsigned int &Op,
78 bool const &ParseArchFlags = false,
79 bool const &StripMultiArch = true);
80 static const char *ConvertRelation(const char *I,unsigned int &Op);
81
82 debListParser(FileFd *File, std::string const &Arch = "");
83 virtual ~debListParser() {};
84};
85
86#endif