]>
Commit | Line | Data |
---|---|---|
f55ece0e AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
04f232fc | 3 | // $Id: debrecords.cc,v 1.8 1999/05/18 05:28:03 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 | /* */ | |
06bba740 AL |
21 | debRecordParser::debRecordParser(FileFd &File,pkgCache &Cache) : |
22 | Tags(File,Cache.Head().MaxVerFileSize + 20) | |
f55ece0e AL |
23 | { |
24 | } | |
25 | /*}}}*/ | |
26 | // RecordParser::Jump - Jump to a specific record /*{{{*/ | |
27 | // --------------------------------------------------------------------- | |
28 | /* */ | |
03e39e59 | 29 | bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver) |
f55ece0e AL |
30 | { |
31 | return Tags.Jump(Section,Ver->Offset); | |
32 | } | |
33 | /*}}}*/ | |
7e798dd7 AL |
34 | // RecordParser::FileName - Return the archive filename on the site /*{{{*/ |
35 | // --------------------------------------------------------------------- | |
36 | /* */ | |
37 | string debRecordParser::FileName() | |
38 | { | |
7974b907 | 39 | return Section.FindS("Filename"); |
7e798dd7 AL |
40 | } |
41 | /*}}}*/ | |
42 | // RecordParser::MD5Hash - Return the archive hash /*{{{*/ | |
43 | // --------------------------------------------------------------------- | |
44 | /* */ | |
45 | string debRecordParser::MD5Hash() | |
46 | { | |
7974b907 | 47 | return Section.FindS("MD5sum"); |
7e798dd7 AL |
48 | } |
49 | /*}}}*/ | |
50 | // RecordParser::Maintainer - Return the maintainer email /*{{{*/ | |
51 | // --------------------------------------------------------------------- | |
52 | /* */ | |
53 | string debRecordParser::Maintainer() | |
54 | { | |
7974b907 | 55 | return Section.FindS("Maintainer"); |
7e798dd7 AL |
56 | } |
57 | /*}}}*/ | |
58 | // RecordParser::ShortDesc - Return a 1 line description /*{{{*/ | |
59 | // --------------------------------------------------------------------- | |
60 | /* */ | |
61 | string debRecordParser::ShortDesc() | |
62 | { | |
7974b907 | 63 | string Res = Section.FindS("Description"); |
7e798dd7 AL |
64 | string::size_type Pos = Res.find('\n'); |
65 | if (Pos == string::npos) | |
66 | return Res; | |
67 | return string(Res,0,Pos); | |
68 | } | |
69 | /*}}}*/ | |
70 | // RecordParser::LongDesc - Return a longer description /*{{{*/ | |
71 | // --------------------------------------------------------------------- | |
72 | /* */ | |
73 | string debRecordParser::LongDesc() | |
74 | { | |
7974b907 | 75 | return Section.FindS("Description"); |
7e798dd7 AL |
76 | } |
77 | /*}}}*/ | |
04f232fc | 78 | // RecordParser::SourcePkg - Return the source package name if any /*{{{*/ |
36375005 AL |
79 | // --------------------------------------------------------------------- |
80 | /* */ | |
81 | string debRecordParser::SourcePkg() | |
82 | { | |
04f232fc AL |
83 | string Res = Section.FindS("Source"); |
84 | string::size_type Pos = Res.find(' '); | |
85 | if (Pos == string::npos) | |
86 | return Res; | |
87 | return string(Res,0,Pos); | |
36375005 AL |
88 | } |
89 | /*}}}*/ |