]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/edsp/edspindexfile.cc
report warnings&errors consistently in edit-sources
[apt.git] / apt-pkg / edsp / edspindexfile.cc
... / ...
CommitLineData
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4 The scenario file is designed to work as an intermediate file between
5 APT and the resolver. Its on propose very similar to a dpkg status file
6 ##################################################################### */
7 /*}}}*/
8// Include Files /*{{{*/
9#include <config.h>
10
11#include <apt-pkg/edspindexfile.h>
12#include <apt-pkg/edsplistparser.h>
13#include <apt-pkg/error.h>
14#include <apt-pkg/fileutl.h>
15#include <apt-pkg/indexfile.h>
16#include <apt-pkg/pkgcache.h>
17#include <apt-pkg/pkgrecords.h>
18
19#include <stddef.h>
20#include <unistd.h>
21#include <string>
22 /*}}}*/
23
24// EDSP-like Index /*{{{*/
25edspLikeIndex::edspLikeIndex(std::string const &File) : pkgDebianIndexRealFile(File, true)
26{
27}
28std::string edspLikeIndex::GetArchitecture() const
29{
30 return std::string();
31}
32bool edspLikeIndex::HasPackages() const
33{
34 return true;
35}
36bool edspLikeIndex::Exists() const
37{
38 return true;
39}
40uint8_t edspLikeIndex::GetIndexFlags() const
41{
42 return 0;
43}
44bool edspLikeIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
45{
46 if (FileName.empty() == false && FileName != "/nonexistent/stdin")
47 return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
48 if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
49 return _error->Error("Problem opening %s",FileName.c_str());
50 return true;
51}
52 /*}}}*/
53// EDSP Index /*{{{*/
54edspIndex::edspIndex(std::string const &File) : edspLikeIndex(File)
55{
56}
57std::string edspIndex::GetComponent() const
58{
59 return "edsp";
60}
61pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
62{
63 if (Pkg.IsOpen() == false)
64 return NULL;
65 _error->PushToStack();
66 pkgCacheListParser * const Parser = new edspListParser(&Pkg);
67 bool const newError = _error->PendingError();
68 _error->MergeWithStack();
69 return newError ? NULL : Parser;
70}
71 /*}}}*/
72// EIPP Index /*{{{*/
73eippIndex::eippIndex(std::string const &File) : edspLikeIndex(File)
74{
75}
76std::string eippIndex::GetComponent() const
77{
78 return "eipp";
79}
80pkgCacheListParser * eippIndex::CreateListParser(FileFd &Pkg)
81{
82 if (Pkg.IsOpen() == false)
83 return NULL;
84 _error->PushToStack();
85 pkgCacheListParser * const Parser = new eippListParser(&Pkg);
86 bool const newError = _error->PendingError();
87 _error->MergeWithStack();
88 return newError ? NULL : Parser;
89}
90 /*}}}*/
91
92// Index File types for APT /*{{{*/
93class APT_HIDDEN edspIFType: public pkgIndexFile::Type
94{
95 public:
96 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
97 {
98 // we don't have a record parser for this type as the file is not presistent
99 return NULL;
100 };
101 edspIFType() {Label = "EDSP scenario file";};
102};
103APT_HIDDEN edspIFType _apt_Edsp;
104const pkgIndexFile::Type *edspIndex::GetType() const
105{
106 return &_apt_Edsp;
107}
108
109class APT_HIDDEN eippIFType: public pkgIndexFile::Type
110{
111 public:
112 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
113 {
114 // we don't have a record parser for this type as the file is not presistent
115 return NULL;
116 };
117 eippIFType() {Label = "EIPP scenario file";};
118};
119APT_HIDDEN eippIFType _apt_Eipp;
120const pkgIndexFile::Type *eippIndex::GetType() const
121{
122 return &_apt_Eipp;
123}
124 /*}}}*/
125
126edspLikeIndex::~edspLikeIndex() {}
127edspIndex::~edspIndex() {}
128eippIndex::~eippIndex() {}