]> git.saurik.com Git - apt.git/blame - apt-pkg/edsp/edspindexfile.cc
pkgCacheGenerator::hash: Do not call tolower_ascii()
[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 15#include <apt-pkg/indexfile.h>
453b82a3 16#include <apt-pkg/pkgcache.h>
453b82a3 17#include <apt-pkg/pkgrecords.h>
6d38011b 18
453b82a3
DK
19#include <stddef.h>
20#include <unistd.h>
21#include <string>
6d38011b
DK
22 /*}}}*/
23
c9443c01
DK
24// EDSP Index /*{{{*/
25edspIndex::edspIndex(std::string const &File) : pkgDebianIndexRealFile(File, true), d(NULL)
6d38011b
DK
26{
27}
c9443c01 28std::string edspIndex::GetComponent() const
6d38011b 29{
c9443c01
DK
30 return "edsp";
31}
32std::string edspIndex::GetArchitecture() const
33{
34 return std::string();
35}
36bool edspIndex::HasPackages() const
37{
38 return true;
39}
40bool edspIndex::Exists() const
41{
42 return true;
43}
44uint8_t edspIndex::GetIndexFlags() const
45{
46 return 0;
47}
48bool edspIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
49{
7f58427b 50 if (FileName.empty() == false && FileName != "/nonexistent/stdin")
c9443c01
DK
51 return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
52 if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
53 return _error->Error("Problem opening %s",FileName.c_str());
6d38011b 54 return true;
c9443c01
DK
55}
56pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
57{
58 if (Pkg.IsOpen() == false)
59 return NULL;
60 _error->PushToStack();
61 pkgCacheListParser * const Parser = new edspListParser(&Pkg);
62 bool const newError = _error->PendingError();
63 _error->MergeWithStack();
64 return newError ? NULL : Parser;
6d38011b
DK
65}
66 /*}}}*/
c9443c01 67
6d38011b 68// Index File types for APT /*{{{*/
dce45dbe 69class APT_HIDDEN edspIFType: public pkgIndexFile::Type
6d38011b
DK
70{
71 public:
c9443c01 72 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
6d38011b
DK
73 {
74 // we don't have a record parser for this type as the file is not presistent
75 return NULL;
76 };
e0a78caa 77 edspIFType() {Label = "EDSP scenario file";};
6d38011b 78};
c9443c01 79APT_HIDDEN edspIFType _apt_Edsp;
6d38011b
DK
80
81const pkgIndexFile::Type *edspIndex::GetType() const
82{
c9443c01 83 return &_apt_Edsp;
6d38011b
DK
84}
85 /*}}}*/
c8a4ce6c
DK
86
87edspIndex::~edspIndex() {}