]>
git.saurik.com Git - apt.git/blob - apt-pkg/deb/debrecords.cc
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: debrecords.cc,v 1.8 1999/05/18 05:28:03 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
,pkgCache
&Cache
) :
22 Tags(File
,Cache
.Head().MaxVerFileSize
+ 20)
26 // RecordParser::Jump - Jump to a specific record /*{{{*/
27 // ---------------------------------------------------------------------
29 bool debRecordParser::Jump(pkgCache::VerFileIterator
const &Ver
)
31 return Tags
.Jump(Section
,Ver
->Offset
);
34 // RecordParser::FileName - Return the archive filename on the site /*{{{*/
35 // ---------------------------------------------------------------------
37 string
debRecordParser::FileName()
39 return Section
.FindS("Filename");
42 // RecordParser::MD5Hash - Return the archive hash /*{{{*/
43 // ---------------------------------------------------------------------
45 string
debRecordParser::MD5Hash()
47 return Section
.FindS("MD5sum");
50 // RecordParser::Maintainer - Return the maintainer email /*{{{*/
51 // ---------------------------------------------------------------------
53 string
debRecordParser::Maintainer()
55 return Section
.FindS("Maintainer");
58 // RecordParser::ShortDesc - Return a 1 line description /*{{{*/
59 // ---------------------------------------------------------------------
61 string
debRecordParser::ShortDesc()
63 string Res
= Section
.FindS("Description");
64 string::size_type Pos
= Res
.find('\n');
65 if (Pos
== string::npos
)
67 return string(Res
,0,Pos
);
70 // RecordParser::LongDesc - Return a longer description /*{{{*/
71 // ---------------------------------------------------------------------
73 string
debRecordParser::LongDesc()
75 return Section
.FindS("Description");
78 // RecordParser::SourcePkg - Return the source package name if any /*{{{*/
79 // ---------------------------------------------------------------------
81 string
debRecordParser::SourcePkg()
83 string Res
= Section
.FindS("Source");
84 string::size_type Pos
= Res
.find(' ');
85 if (Pos
== string::npos
)
87 return string(Res
,0,Pos
);