]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debrecords.cc
* Added DPkg::FlushSTDIN to control the flushing of std...
[apt.git] / apt-pkg / deb / debrecords.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: debrecords.cc,v 1.8 1999/05/18 05:28:03 jgg Exp $
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 /* */
21 debRecordParser::debRecordParser(FileFd &File,pkgCache &Cache) :
22 Tags(File,Cache.Head().MaxVerFileSize + 20)
23 {
24 }
25 /*}}}*/
26 // RecordParser::Jump - Jump to a specific record /*{{{*/
27 // ---------------------------------------------------------------------
28 /* */
29 bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
30 {
31 return Tags.Jump(Section,Ver->Offset);
32 }
33 /*}}}*/
34 // RecordParser::FileName - Return the archive filename on the site /*{{{*/
35 // ---------------------------------------------------------------------
36 /* */
37 string debRecordParser::FileName()
38 {
39 return Section.FindS("Filename");
40 }
41 /*}}}*/
42 // RecordParser::MD5Hash - Return the archive hash /*{{{*/
43 // ---------------------------------------------------------------------
44 /* */
45 string debRecordParser::MD5Hash()
46 {
47 return Section.FindS("MD5sum");
48 }
49 /*}}}*/
50 // RecordParser::Maintainer - Return the maintainer email /*{{{*/
51 // ---------------------------------------------------------------------
52 /* */
53 string debRecordParser::Maintainer()
54 {
55 return Section.FindS("Maintainer");
56 }
57 /*}}}*/
58 // RecordParser::ShortDesc - Return a 1 line description /*{{{*/
59 // ---------------------------------------------------------------------
60 /* */
61 string debRecordParser::ShortDesc()
62 {
63 string Res = Section.FindS("Description");
64 string::size_type Pos = Res.find('\n');
65 if (Pos == string::npos)
66 return Res;
67 return string(Res,0,Pos);
68 }
69 /*}}}*/
70 // RecordParser::LongDesc - Return a longer description /*{{{*/
71 // ---------------------------------------------------------------------
72 /* */
73 string debRecordParser::LongDesc()
74 {
75 return Section.FindS("Description");
76 }
77 /*}}}*/
78 // RecordParser::SourcePkg - Return the source package name if any /*{{{*/
79 // ---------------------------------------------------------------------
80 /* */
81 string debRecordParser::SourcePkg()
82 {
83 string Res = Section.FindS("Source");
84 string::size_type Pos = Res.find(' ');
85 if (Pos == string::npos)
86 return Res;
87 return string(Res,0,Pos);
88 }
89 /*}}}*/