]>
git.saurik.com Git - apt.git/blob - apt-pkg/deb/debrecords.cc
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: debrecords.cc,v 1.4 1999/01/27 02:48:53 jgg Exp $
4 /* ######################################################################
6 Debian Package Records - Parser for debian package records
8 ##################################################################### */
10 // Include Files /*{{{*/
12 #pragma implementation "apt-pkg/debrecords.h"
14 #include <apt-pkg/debrecords.h>
15 #include <apt-pkg/error.h>
18 // RecordParser::debRecordParser - Constructor /*{{{*/
19 // ---------------------------------------------------------------------
21 debRecordParser::debRecordParser(FileFd
&File
) : Tags(File
,4*1024)
25 // RecordParser::Jump - Jump to a specific record /*{{{*/
26 // ---------------------------------------------------------------------
28 bool debRecordParser::Jump(pkgCache::VerFileIterator
const &Ver
)
30 return Tags
.Jump(Section
,Ver
->Offset
);
33 // RecordParser::FindTag - Locate a tag and return a string /*{{{*/
34 // ---------------------------------------------------------------------
36 string
debRecordParser::FindTag(const char *Tag
)
40 if (Section
.Find(Tag
,Start
,Stop
) == false)
42 return string(Start
,Stop
- Start
);
45 // RecordParser::FileName - Return the archive filename on the site /*{{{*/
46 // ---------------------------------------------------------------------
48 string
debRecordParser::FileName()
50 return FindTag("Filename");
53 // RecordParser::MD5Hash - Return the archive hash /*{{{*/
54 // ---------------------------------------------------------------------
56 string
debRecordParser::MD5Hash()
58 return FindTag("MD5sum");
61 // RecordParser::Maintainer - Return the maintainer email /*{{{*/
62 // ---------------------------------------------------------------------
64 string
debRecordParser::Maintainer()
66 return FindTag("Maintainer");
69 // RecordParser::ShortDesc - Return a 1 line description /*{{{*/
70 // ---------------------------------------------------------------------
72 string
debRecordParser::ShortDesc()
74 string Res
= FindTag("Description");
75 string::size_type Pos
= Res
.find('\n');
76 if (Pos
== string::npos
)
78 return string(Res
,0,Pos
);
81 // RecordParser::LongDesc - Return a longer description /*{{{*/
82 // ---------------------------------------------------------------------
84 string
debRecordParser::LongDesc()
86 return FindTag("Description");