winch support
[ntk/apt.git] / apt-pkg / deb / debrecords.cc
CommitLineData
f55ece0e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
7e798dd7 3// $Id: debrecords.cc,v 1.2 1998/10/08 04:55:02 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/* */
21debRecordParser::debRecordParser(FileFd &File) : Tags(File,4*1024)
22{
23}
24 /*}}}*/
25// RecordParser::Jump - Jump to a specific record /*{{{*/
26// ---------------------------------------------------------------------
27/* */
28bool debRecordParser::Jump(pkgCache::VerFileIterator &Ver)
29{
30 return Tags.Jump(Section,Ver->Offset);
31}
32 /*}}}*/
7e798dd7
AL
33// RecordParser::FindTag - Locate a tag and return a string /*{{{*/
34// ---------------------------------------------------------------------
35/* */
36string 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/* */
48string debRecordParser::FileName()
49{
50 return FindTag("Filename");
51}
52 /*}}}*/
53// RecordParser::MD5Hash - Return the archive hash /*{{{*/
54// ---------------------------------------------------------------------
55/* */
56string debRecordParser::MD5Hash()
57{
58 return FindTag("MD5sum");
59}
60 /*}}}*/
61// RecordParser::Maintainer - Return the maintainer email /*{{{*/
62// ---------------------------------------------------------------------
63/* */
64string debRecordParser::Maintainer()
65{
66 return FindTag("Maintainer");
67}
68 /*}}}*/
69// RecordParser::ShortDesc - Return a 1 line description /*{{{*/
70// ---------------------------------------------------------------------
71/* */
72string 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/* */
84string debRecordParser::LongDesc()
85{
86 return string();
87}
88 /*}}}*/