]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/debrecords.cc
Fixed another parser glitch
[apt.git] / apt-pkg / deb / debrecords.cc
CommitLineData
f55ece0e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
06bba740 3// $Id: debrecords.cc,v 1.5 1999/02/22 03:30:06 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
21debRecordParser::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 29bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
f55ece0e
AL
30{
31 return Tags.Jump(Section,Ver->Offset);
32}
33 /*}}}*/
7e798dd7
AL
34// RecordParser::FindTag - Locate a tag and return a string /*{{{*/
35// ---------------------------------------------------------------------
36/* */
37string debRecordParser::FindTag(const char *Tag)
38{
39 const char *Start;
40 const char *Stop;
41 if (Section.Find(Tag,Start,Stop) == false)
42 return string();
43 return string(Start,Stop - Start);
44}
45 /*}}}*/
46// RecordParser::FileName - Return the archive filename on the site /*{{{*/
47// ---------------------------------------------------------------------
48/* */
49string debRecordParser::FileName()
50{
51 return FindTag("Filename");
52}
53 /*}}}*/
54// RecordParser::MD5Hash - Return the archive hash /*{{{*/
55// ---------------------------------------------------------------------
56/* */
57string debRecordParser::MD5Hash()
58{
59 return FindTag("MD5sum");
60}
61 /*}}}*/
62// RecordParser::Maintainer - Return the maintainer email /*{{{*/
63// ---------------------------------------------------------------------
64/* */
65string debRecordParser::Maintainer()
66{
67 return FindTag("Maintainer");
68}
69 /*}}}*/
70// RecordParser::ShortDesc - Return a 1 line description /*{{{*/
71// ---------------------------------------------------------------------
72/* */
73string debRecordParser::ShortDesc()
74{
75 string Res = FindTag("Description");
76 string::size_type Pos = Res.find('\n');
77 if (Pos == string::npos)
78 return Res;
79 return string(Res,0,Pos);
80}
81 /*}}}*/
82// RecordParser::LongDesc - Return a longer description /*{{{*/
83// ---------------------------------------------------------------------
84/* */
85string debRecordParser::LongDesc()
86{
cdcc6d34 87 return FindTag("Description");
7e798dd7
AL
88}
89 /*}}}*/