]> git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edsplistparser.cc
follow method attribute suggestions by gcc
[apt.git] / apt-pkg / edsp / edsplistparser.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4
5 Package Cache Generator - Generator for the cache structure.
6
7 This builds the cache structure from the abstract package list parser.
8
9 ##################################################################### */
10 /*}}}*/
11 // Include Files /*{{{*/
12 #include <config.h>
13
14 #include <apt-pkg/edsplistparser.h>
15 #include <apt-pkg/md5.h>
16 #include <apt-pkg/deblistparser.h>
17 #include <apt-pkg/pkgcache.h>
18 #include <apt-pkg/cacheiterators.h>
19 #include <apt-pkg/tagfile.h>
20
21 #include <string>
22 /*}}}*/
23
24 // ListParser::edspListParser - Constructor /*{{{*/
25 edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch)
26 {}
27 /*}}}*/
28 // ListParser::NewVersion - Fill in the version structure /*{{{*/
29 bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
30 {
31 Ver->ID = Section.FindI("APT-ID", Ver->ID);
32 return debListParser::NewVersion(Ver);
33 }
34 /*}}}*/
35 // ListParser::Description - Return the description string /*{{{*/
36 // ---------------------------------------------------------------------
37 /* Sorry, no description for the resolvers… */
38 std::string edspListParser::Description()
39 {
40 return "";
41 }
42 std::string edspListParser::DescriptionLanguage()
43 {
44 return "";
45 }
46 MD5SumValue edspListParser::Description_md5()
47 {
48 return MD5SumValue("");
49 }
50 /*}}}*/
51 // ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
52 // ---------------------------------------------------------------------
53 /* */
54 unsigned short edspListParser::VersionHash()
55 {
56 if (Section.Exists("APT-Hash") == true)
57 return Section.FindI("APT-Hash");
58 else if (Section.Exists("APT-ID") == true)
59 return Section.FindI("APT-ID");
60 return 0;
61 }
62 /*}}}*/
63 // ListParser::ParseStatus - Parse the status field /*{{{*/
64 // ---------------------------------------------------------------------
65 /* The Status: line here is not a normal dpkg one but just one which tells
66 use if the package is installed or not, where missing means not. */
67 bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
68 pkgCache::VerIterator &Ver)
69 {
70 unsigned long state = 0;
71 if (Section.FindFlag("Hold",state,pkgCache::State::Hold) == false)
72 return false;
73 if (state != 0)
74 Pkg->SelectedState = pkgCache::State::Hold;
75
76 state = 0;
77 if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false)
78 return false;
79 if (state != 0)
80 {
81 Pkg->CurrentState = pkgCache::State::Installed;
82 Pkg->CurrentVer = Ver.Index();
83 }
84
85 return true;
86 }
87 /*}}}*/
88 // ListParser::LoadReleaseInfo - Load the release information /*{{{*/
89 APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/,
90 FileFd & /*File*/, std::string /*component*/)
91 {
92 return true;
93 }
94 /*}}}*/