]> git.saurik.com Git - apt.git/blame - apt-pkg/edsp/edspindexfile.cc
make all d-pointer * const pointers
[apt.git] / apt-pkg / edsp / edspindexfile.cc
CommitLineData
6d38011b
DK
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
e0a78caa 4 The scenario file is designed to work as an intermediate file between
6d38011b
DK
5 APT and the resolver. Its on propose very similar to a dpkg status file
6 ##################################################################### */
7 /*}}}*/
8// Include Files /*{{{*/
ea542140
DK
9#include <config.h>
10
6d38011b
DK
11#include <apt-pkg/edspindexfile.h>
12#include <apt-pkg/edsplistparser.h>
6d38011b 13#include <apt-pkg/error.h>
472ff00e 14#include <apt-pkg/fileutl.h>
453b82a3
DK
15#include <apt-pkg/progress.h>
16#include <apt-pkg/debindexfile.h>
17#include <apt-pkg/indexfile.h>
18#include <apt-pkg/mmap.h>
19#include <apt-pkg/pkgcache.h>
20#include <apt-pkg/cacheiterators.h>
21#include <apt-pkg/pkgcachegen.h>
22#include <apt-pkg/pkgrecords.h>
6d38011b 23
453b82a3
DK
24#include <stddef.h>
25#include <unistd.h>
26#include <string>
6d38011b
DK
27 /*}}}*/
28
29// edspIndex::edspIndex - Constructor /*{{{*/
30// ---------------------------------------------------------------------
31/* */
6c55f07a 32edspIndex::edspIndex(std::string File) : debStatusIndex(File), d(NULL)
6d38011b
DK
33{
34}
35 /*}}}*/
36// StatusIndex::Merge - Load the index file into a cache /*{{{*/
37bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
38{
41ceaf02
DK
39 FileFd Pkg;
40 if (File != "stdin")
41 Pkg.Open(File, FileFd::ReadOnly);
42 else
43 Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly);
6d38011b
DK
44 if (_error->PendingError() == true)
45 return false;
46 edspListParser Parser(&Pkg);
47 if (_error->PendingError() == true)
48 return false;
49
50 if (Prog != NULL)
51 Prog->SubProgress(0,File);
e185d8b3 52 if (Gen.SelectFile(File, *this, "", "edsp") == false)
6d38011b
DK
53 return _error->Error("Problem with SelectFile %s",File.c_str());
54
55 // Store the IMS information
56 pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
b07aeb1a 57 pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(CFile);
76a763e1
DK
58 CFile->Size = Pkg.FileSize();
59 CFile->mtime = Pkg.ModificationTime();
6d38011b
DK
60
61 if (Gen.MergeList(Parser) == false)
62 return _error->Error("Problem with MergeList %s",File.c_str());
63 return true;
64}
65 /*}}}*/
66// Index File types for APT /*{{{*/
dce45dbe 67class APT_HIDDEN edspIFType: public pkgIndexFile::Type
6d38011b
DK
68{
69 public:
65512241 70 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator) const
6d38011b
DK
71 {
72 // we don't have a record parser for this type as the file is not presistent
73 return NULL;
74 };
e0a78caa 75 edspIFType() {Label = "EDSP scenario file";};
6d38011b 76};
dce45dbe 77APT_HIDDEN edspIFType _apt_Universe;
6d38011b
DK
78
79const pkgIndexFile::Type *edspIndex::GetType() const
80{
81 return &_apt_Universe;
82}
83 /*}}}*/
c8a4ce6c
DK
84
85edspIndex::~edspIndex() {}