]> git.saurik.com Git - apt-legacy.git/blob - apt-pkg/deb/deblistparser.h
Fix compilation of http when embedding into Cydia.
[apt-legacy.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
31 pkgTagFile Tags;
32 pkgTagSection Section;
33 unsigned long iOffset;
34 string Arch;
35
36 unsigned long FindTagWrite(const char *Tag);
37 unsigned long UniqFindTagWrite(const char *Tag);
38 bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
39 bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag,
40 unsigned int Type);
41 bool ParseProvides(pkgCache::VerIterator Ver);
42 bool ParseTag(pkgCache::PkgIterator Pkg);
43 static bool GrabWord(string Word,WordList *List,unsigned char &Out);
44 static bool GrabWord(const srkString &Word,WordList *List,unsigned char &Out);
45
46 public:
47
48 srkString Find(const char *Tag) {
49 srkString S;
50 const char *Stop;
51 if (Section.Find(Tag, S.Start, Stop))
52 S.Size = Stop - S.Start;
53 else {
54 S.Start = NULL;
55 S.Size = 0;
56 }
57 return S;
58 }
59
60 static unsigned char GetPrio(string Str);
61
62 // These all operate against the current section
63 virtual string Package();
64 virtual string Version();
65 virtual bool NewVersion(pkgCache::VerIterator Ver);
66 virtual string Description();
67 void Description(srkString &Str);
68 virtual string DescriptionLanguage();
69 virtual MD5SumValue Description_md5();
70 virtual unsigned short VersionHash();
71 virtual bool UsePackage(pkgCache::PkgIterator Pkg,
72 pkgCache::VerIterator Ver);
73 virtual unsigned long Offset() {return iOffset;};
74 virtual unsigned long Size() {return Section.size();};
75
76 virtual bool Step();
77
78 bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File,
79 string section);
80
81 static const char *ParseDepends(const char *Start,const char *Stop,
82 string &Package,string &Ver,unsigned int &Op,
83 bool ParseArchFlags = false);
84 static const char *ParseDepends(const char *Start,const char *Stop,
85 srkString &Package,srkString &Ver,unsigned int &Op,
86 bool ParseArchFlags = false);
87 static const char *ConvertRelation(const char *I,unsigned int &Op);
88
89 debListParser(FileFd *File);
90 };
91
92 #endif