]>
Commit | Line | Data |
---|---|---|
f55ece0e AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
cdcc6d34 | 3 | // $Id: debrecords.cc,v 1.4 1999/01/27 02:48:53 jgg Exp $ |
f55ece0e AL |
4 | /* ###################################################################### |
5 | ||
6 | Debian Package Records - Parser for debian package records | |
7 | ||
8 | ##################################################################### */ | |
9 | /*}}}*/ | |
10 | // Include Files /*{{{*/ | |
11 | #ifdef __GNUG__ | |
12 | #pragma implementation "apt-pkg/debrecords.h" | |
13 | #endif | |
14 | #include <apt-pkg/debrecords.h> | |
15 | #include <apt-pkg/error.h> | |
16 | /*}}}*/ | |
17 | ||
18 | // RecordParser::debRecordParser - Constructor /*{{{*/ | |
19 | // --------------------------------------------------------------------- | |
20 | /* */ | |
21 | debRecordParser::debRecordParser(FileFd &File) : Tags(File,4*1024) | |
22 | { | |
23 | } | |
24 | /*}}}*/ | |
25 | // RecordParser::Jump - Jump to a specific record /*{{{*/ | |
26 | // --------------------------------------------------------------------- | |
27 | /* */ | |
03e39e59 | 28 | bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver) |
f55ece0e AL |
29 | { |
30 | return Tags.Jump(Section,Ver->Offset); | |
31 | } | |
32 | /*}}}*/ | |
7e798dd7 AL |
33 | // RecordParser::FindTag - Locate a tag and return a string /*{{{*/ |
34 | // --------------------------------------------------------------------- | |
35 | /* */ | |
36 | string debRecordParser::FindTag(const char *Tag) | |
37 | { | |
38 | const char *Start; | |
39 | const char *Stop; | |
40 | if (Section.Find(Tag,Start,Stop) == false) | |
41 | return string(); | |
42 | return string(Start,Stop - Start); | |
43 | } | |
44 | /*}}}*/ | |
45 | // RecordParser::FileName - Return the archive filename on the site /*{{{*/ | |
46 | // --------------------------------------------------------------------- | |
47 | /* */ | |
48 | string debRecordParser::FileName() | |
49 | { | |
50 | return FindTag("Filename"); | |
51 | } | |
52 | /*}}}*/ | |
53 | // RecordParser::MD5Hash - Return the archive hash /*{{{*/ | |
54 | // --------------------------------------------------------------------- | |
55 | /* */ | |
56 | string debRecordParser::MD5Hash() | |
57 | { | |
58 | return FindTag("MD5sum"); | |
59 | } | |
60 | /*}}}*/ | |
61 | // RecordParser::Maintainer - Return the maintainer email /*{{{*/ | |
62 | // --------------------------------------------------------------------- | |
63 | /* */ | |
64 | string debRecordParser::Maintainer() | |
65 | { | |
66 | return FindTag("Maintainer"); | |
67 | } | |
68 | /*}}}*/ | |
69 | // RecordParser::ShortDesc - Return a 1 line description /*{{{*/ | |
70 | // --------------------------------------------------------------------- | |
71 | /* */ | |
72 | string debRecordParser::ShortDesc() | |
73 | { | |
74 | string Res = FindTag("Description"); | |
75 | string::size_type Pos = Res.find('\n'); | |
76 | if (Pos == string::npos) | |
77 | return Res; | |
78 | return string(Res,0,Pos); | |
79 | } | |
80 | /*}}}*/ | |
81 | // RecordParser::LongDesc - Return a longer description /*{{{*/ | |
82 | // --------------------------------------------------------------------- | |
83 | /* */ | |
84 | string debRecordParser::LongDesc() | |
85 | { | |
cdcc6d34 | 86 | return FindTag("Description"); |
7e798dd7 AL |
87 | } |
88 | /*}}}*/ |