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