do not pollute namespace in the headers with using (Closes: #500198)
[ntk/apt.git] / apt-pkg / deb / deblistparser.h
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/indexfile.h>
16 #include <apt-pkg/tagfile.h>
17
18 class debListParser : public pkgCacheGenerator::ListParser
19 {
20 public:
21
22 // Parser Helper
23 struct WordList
24 {
25 const char *Str;
26 unsigned char Val;
27 };
28
29 private:
30 /** \brief dpointer placeholder (for later in case we need it) */
31 void *d;
32
33 protected:
34 pkgTagFile Tags;
35 pkgTagSection Section;
36 unsigned long iOffset;
37 std::string Arch;
38 std::vector<std::string> Architectures;
39 bool MultiArchEnabled;
40
41 unsigned long UniqFindTagWrite(const char *Tag);
42 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
43 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
44 unsigned int Type);
45 bool ParseProvides(pkgCache::VerIterator &Ver);
46 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version);
47 static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
48
49 public:
50
51 static unsigned char GetPrio(std::string Str);
52
53 // These all operate against the current section
54 virtual std::string Package();
55 virtual std::string Architecture();
56 virtual bool ArchitectureAll();
57 virtual std::string Version();
58 virtual bool NewVersion(pkgCache::VerIterator &Ver);
59 virtual std::string Description();
60 virtual std::string DescriptionLanguage();
61 virtual MD5SumValue Description_md5();
62 virtual unsigned short VersionHash();
63 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
64 pkgCache::VerIterator &Ver);
65 virtual unsigned long Offset() {return iOffset;};
66 virtual unsigned long Size() {return Section.size();};
67
68 virtual bool Step();
69
70 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
71 std::string section);
72
73 static const char *ParseDepends(const char *Start,const char *Stop,
74 std::string &Package,std::string &Ver,unsigned int &Op,
75 bool const &ParseArchFlags = false,
76 bool const &StripMultiArch = true);
77 static const char *ConvertRelation(const char *I,unsigned int &Op);
78
79 debListParser(FileFd *File, std::string const &Arch = "");
80 virtual ~debListParser() {};
81 };
82
83 #endif