]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/edsp/edspindexfile.cc
review of new/changed translatable program strings
[apt.git] / apt-pkg / edsp / edspindexfile.cc
index f5881e66362a9b95b0363f232642fa13bd74cd69..4e0f9c26a99c088afb12ad96bbd50d78e24c28c0 100644 (file)
@@ -6,73 +6,82 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/edsplistparser.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/progress.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/pkgrecords.h>
 
 
-#include <sys/stat.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <string>
                                                                        /*}}}*/
 
                                                                        /*}}}*/
 
-// edspIndex::edspIndex - Constructor                                  /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-edspIndex::edspIndex(string File) : debStatusIndex(File)
+// EDSP Index                                                          /*{{{*/
+edspIndex::edspIndex(std::string const &File) : pkgDebianIndexRealFile(File, true), d(NULL)
 {
 }
 {
 }
-                                                                       /*}}}*/
-// StatusIndex::Merge - Load the index file into a cache               /*{{{*/
-bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
+std::string edspIndex::GetComponent() const
 {
 {
-   FileFd Pkg;
-   if (File != "stdin")
-      Pkg.Open(File, FileFd::ReadOnly);
-   else
-      Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly);
-   if (_error->PendingError() == true)
-      return false;
-   edspListParser Parser(&Pkg);
-   if (_error->PendingError() == true)
-      return false;
-
-   if (Prog != NULL)
-      Prog->SubProgress(0,File);
-   if (Gen.SelectFile(File,string(),*this) == false)
-      return _error->Error("Problem with SelectFile %s",File.c_str());
-
-   // Store the IMS information
-   pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
-   struct stat St;
-   if (fstat(Pkg.Fd(),&St) != 0)
-      return _error->Errno("fstat","Failed to stat");
-   CFile->Size = St.st_size;
-   CFile->mtime = St.st_mtime;
-   CFile->Archive = Gen.WriteUniqString("edsp::scenario");
-
-   if (Gen.MergeList(Parser) == false)
-      return _error->Error("Problem with MergeList %s",File.c_str());
+   return "edsp";
+}
+std::string edspIndex::GetArchitecture() const
+{
+   return std::string();
+}
+bool edspIndex::HasPackages() const
+{
+   return true;
+}
+bool edspIndex::Exists() const
+{
+   return true;
+}
+uint8_t edspIndex::GetIndexFlags() const
+{
+   return 0;
+}
+bool edspIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
+{
+   if (FileName.empty() == false && FileName != "/nonexistent/stdin")
+      return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
+   if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
+      return _error->Error("Problem opening %s",FileName.c_str());
    return true;
    return true;
+}
+pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
+{
+   if (Pkg.IsOpen() == false)
+      return NULL;
+   _error->PushToStack();
+   pkgCacheListParser * const Parser = new edspListParser(&Pkg);
+   bool const newError = _error->PendingError();
+   _error->MergeWithStack();
+   return newError ? NULL : Parser;
 }
                                                                        /*}}}*/
 }
                                                                        /*}}}*/
+
 // Index File types for APT                                            /*{{{*/
 // Index File types for APT                                            /*{{{*/
-class edspIFType: public pkgIndexFile::Type
+class APT_HIDDEN edspIFType: public pkgIndexFile::Type
 {
    public:
 {
    public:
-   virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
+   virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
    {
       // we don't have a record parser for this type as the file is not presistent
       return NULL;
    };
    edspIFType() {Label = "EDSP scenario file";};
 };
    {
       // we don't have a record parser for this type as the file is not presistent
       return NULL;
    };
    edspIFType() {Label = "EDSP scenario file";};
 };
-static edspIFType _apt_Universe;
+APT_HIDDEN edspIFType _apt_Edsp;
 
 const pkgIndexFile::Type *edspIndex::GetType() const
 {
 
 const pkgIndexFile::Type *edspIndex::GetType() const
 {
-   return &_apt_Universe;
+   return &_apt_Edsp;
 }
                                                                        /*}}}*/
 }
                                                                        /*}}}*/
+
+edspIndex::~edspIndex() {}