]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/debrecords.cc
Join with aliencode
[apt.git] / apt-pkg / deb / debrecords.cc
CommitLineData
f55ece0e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b2e465d6 3// $Id: debrecords.cc,v 1.9 2001/02/20 07:03:17 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/* */
b2e465d6
AL
21debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
22 File(FileName,FileFd::ReadOnly),
23 Tags(&File,Cache.Head().MaxVerFileSize + 200)
f55ece0e
AL
24{
25}
26 /*}}}*/
27// RecordParser::Jump - Jump to a specific record /*{{{*/
28// ---------------------------------------------------------------------
29/* */
03e39e59 30bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
f55ece0e
AL
31{
32 return Tags.Jump(Section,Ver->Offset);
33}
34 /*}}}*/
7e798dd7
AL
35// RecordParser::FileName - Return the archive filename on the site /*{{{*/
36// ---------------------------------------------------------------------
37/* */
38string debRecordParser::FileName()
39{
7974b907 40 return Section.FindS("Filename");
7e798dd7
AL
41}
42 /*}}}*/
b2e465d6
AL
43// RecordParser::Name - Return the package name /*{{{*/
44// ---------------------------------------------------------------------
45/* */
46string debRecordParser::Name()
47{
48 return Section.FindS("Package");
49}
50 /*}}}*/
7e798dd7
AL
51// RecordParser::MD5Hash - Return the archive hash /*{{{*/
52// ---------------------------------------------------------------------
53/* */
54string debRecordParser::MD5Hash()
55{
7974b907 56 return Section.FindS("MD5sum");
7e798dd7
AL
57}
58 /*}}}*/
59// RecordParser::Maintainer - Return the maintainer email /*{{{*/
60// ---------------------------------------------------------------------
61/* */
62string debRecordParser::Maintainer()
63{
7974b907 64 return Section.FindS("Maintainer");
7e798dd7
AL
65}
66 /*}}}*/
67// RecordParser::ShortDesc - Return a 1 line description /*{{{*/
68// ---------------------------------------------------------------------
69/* */
70string debRecordParser::ShortDesc()
71{
7974b907 72 string Res = Section.FindS("Description");
7e798dd7
AL
73 string::size_type Pos = Res.find('\n');
74 if (Pos == string::npos)
75 return Res;
76 return string(Res,0,Pos);
77}
78 /*}}}*/
79// RecordParser::LongDesc - Return a longer description /*{{{*/
80// ---------------------------------------------------------------------
81/* */
82string debRecordParser::LongDesc()
83{
7974b907 84 return Section.FindS("Description");
7e798dd7
AL
85}
86 /*}}}*/
04f232fc 87// RecordParser::SourcePkg - Return the source package name if any /*{{{*/
36375005
AL
88// ---------------------------------------------------------------------
89/* */
90string debRecordParser::SourcePkg()
91{
04f232fc
AL
92 string Res = Section.FindS("Source");
93 string::size_type Pos = Res.find(' ');
94 if (Pos == string::npos)
95 return Res;
96 return string(Res,0,Pos);
36375005
AL
97}
98 /*}}}*/
b2e465d6
AL
99// RecordParser::GetRec - Return the whole record /*{{{*/
100// ---------------------------------------------------------------------
101/* */
102void debRecordParser::GetRec(const char *&Start,const char *&Stop)
103{
104 Section.GetSection(Start,Stop);
105}
106 /*}}}*/