X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/cec8c646c79e40d928464b08a6f2e3ea62bb1611..f4c7a238f4c29ac9b1e1172f103ab7dec5c5807d:/apt-pkg/deb/debrecords.h diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 9692ac94c..38e071940 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -15,45 +15,76 @@ #define PKGLIB_DEBRECORDS_H #include -#include #include +#include +#include + +#include + +#ifndef APT_8_CLEANER_HEADERS +#include +#endif -class debRecordParser : public pkgRecords::Parser +class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser { - /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + protected: + pkgTagSection Section; + + public: + // These refer to the archive file for the Version + virtual std::string FileName(); + virtual std::string SourcePkg(); + virtual std::string SourceVer(); + + virtual HashStringList Hashes() const; + + // These are some general stats about the package + virtual std::string Maintainer(); + virtual std::string ShortDesc(std::string const &lang); + virtual std::string LongDesc(std::string const &lang); + virtual std::string Name(); + virtual std::string Homepage(); + + // An arbitrary custom field + virtual std::string RecordField(const char *fieldName); + + virtual void GetRec(const char *&Start,const char *&Stop); + + debRecordParserBase() : Parser() {} + virtual ~debRecordParserBase(); +}; +class APT_HIDDEN debRecordParser : public debRecordParserBase +{ + protected: FileFd File; pkgTagFile Tags; - pkgTagSection Section; - - protected: - + virtual bool Jump(pkgCache::VerFileIterator const &Ver); virtual bool Jump(pkgCache::DescFileIterator const &Desc); - - public: - // These refer to the archive file for the Version - virtual string FileName(); - virtual string MD5Hash(); - virtual string SHA1Hash(); - virtual string SHA256Hash(); - virtual string SHA512Hash(); - virtual string SourcePkg(); - virtual string SourceVer(); - - // These are some general stats about the package - virtual string Maintainer(); - virtual string ShortDesc(); - virtual string LongDesc(); - virtual string Name(); - virtual string Homepage(); + public: + debRecordParser(std::string FileName,pkgCache &Cache); + virtual ~debRecordParser(); +}; - virtual void GetRec(const char *&Start,const char *&Stop); - - debRecordParser(string FileName,pkgCache &Cache); - virtual ~debRecordParser() {}; +// custom record parser that reads deb files directly +class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase +{ + std::string debFileName; + std::string controlContent; + + APT_HIDDEN bool LoadContent(); + protected: + // single file files, so no jumping whatsoever + bool Jump(pkgCache::VerFileIterator const &) { return LoadContent(); } + bool Jump(pkgCache::DescFileIterator const &) { return LoadContent(); } + + public: + virtual std::string FileName() { return debFileName; } + + debDebFileRecordParser(std::string FileName) + : debRecordParserBase(), debFileName(FileName) {}; }; #endif