]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/debrecords.cc
* remove all the remaining #pragma implementation
[apt.git] / apt-pkg / deb / debrecords.cc
CommitLineData
f55ece0e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
a7c835af 3// $Id: debrecords.cc,v 1.10 2001/03/13 06:51:46 jgg Exp $
f55ece0e
AL
4/* ######################################################################
5
6 Debian Package Records - Parser for debian package records
7
8 ##################################################################### */
9 /*}}}*/
10// Include Files /*{{{*/
f55ece0e
AL
11#include <apt-pkg/debrecords.h>
12#include <apt-pkg/error.h>
13 /*}}}*/
14
15// RecordParser::debRecordParser - Constructor /*{{{*/
16// ---------------------------------------------------------------------
17/* */
b2e465d6
AL
18debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
19 File(FileName,FileFd::ReadOnly),
20 Tags(&File,Cache.Head().MaxVerFileSize + 200)
f55ece0e
AL
21{
22}
23 /*}}}*/
24// RecordParser::Jump - Jump to a specific record /*{{{*/
25// ---------------------------------------------------------------------
26/* */
03e39e59 27bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
f55ece0e
AL
28{
29 return Tags.Jump(Section,Ver->Offset);
30}
31 /*}}}*/
7e798dd7
AL
32// RecordParser::FileName - Return the archive filename on the site /*{{{*/
33// ---------------------------------------------------------------------
34/* */
35string debRecordParser::FileName()
36{
7974b907 37 return Section.FindS("Filename");
7e798dd7
AL
38}
39 /*}}}*/
b2e465d6
AL
40// RecordParser::Name - Return the package name /*{{{*/
41// ---------------------------------------------------------------------
42/* */
43string debRecordParser::Name()
44{
45 return Section.FindS("Package");
46}
47 /*}}}*/
7e798dd7
AL
48// RecordParser::MD5Hash - Return the archive hash /*{{{*/
49// ---------------------------------------------------------------------
50/* */
51string debRecordParser::MD5Hash()
52{
a7c835af
AL
53 return Section.FindS("MD5Sum");
54}
55 /*}}}*/
56// RecordParser::SHA1Hash - Return the archive hash /*{{{*/
57// ---------------------------------------------------------------------
58/* */
59string debRecordParser::SHA1Hash()
60{
61 return Section.FindS("SHA1Sum");
7e798dd7
AL
62}
63 /*}}}*/
64// RecordParser::Maintainer - Return the maintainer email /*{{{*/
65// ---------------------------------------------------------------------
66/* */
67string debRecordParser::Maintainer()
68{
7974b907 69 return Section.FindS("Maintainer");
7e798dd7
AL
70}
71 /*}}}*/
72// RecordParser::ShortDesc - Return a 1 line description /*{{{*/
73// ---------------------------------------------------------------------
74/* */
75string debRecordParser::ShortDesc()
76{
7974b907 77 string Res = Section.FindS("Description");
7e798dd7
AL
78 string::size_type Pos = Res.find('\n');
79 if (Pos == string::npos)
80 return Res;
81 return string(Res,0,Pos);
82}
83 /*}}}*/
84// RecordParser::LongDesc - Return a longer description /*{{{*/
85// ---------------------------------------------------------------------
86/* */
87string debRecordParser::LongDesc()
88{
7974b907 89 return Section.FindS("Description");
7e798dd7
AL
90}
91 /*}}}*/
04f232fc 92// RecordParser::SourcePkg - Return the source package name if any /*{{{*/
36375005
AL
93// ---------------------------------------------------------------------
94/* */
95string debRecordParser::SourcePkg()
96{
04f232fc
AL
97 string Res = Section.FindS("Source");
98 string::size_type Pos = Res.find(' ');
99 if (Pos == string::npos)
100 return Res;
101 return string(Res,0,Pos);
36375005
AL
102}
103 /*}}}*/
b2e465d6
AL
104// RecordParser::GetRec - Return the whole record /*{{{*/
105// ---------------------------------------------------------------------
106/* */
107void debRecordParser::GetRec(const char *&Start,const char *&Stop)
108{
109 Section.GetSection(Start,Stop);
110}
111 /*}}}*/