X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a2fdb57ff93c1b1f35b796c3c99878ec3ae54a06..bc4ccfeb6096fc6f9a74e2abff3abe31261b5df2:/apt-pkg/tagfile.h diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index db43bfbf9..d09e7046c 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -33,23 +33,22 @@ #endif class FileFd; +class pkgTagSectionPrivate; class pkgTagSection { const char *Section; - struct TagData { - unsigned int StartTag; - unsigned int EndTag; - unsigned int StartValue; - unsigned int NextInBucket; - - TagData(unsigned int const StartTag) : StartTag(StartTag), NextInBucket(0) {} - }; - std::vector Tags; - unsigned int LookupTable[0x100]; + // We have a limit of 256 tags per section with the old abi +#if APT_PKG_ABI < 413 + APT_DEPRECATED unsigned int Indexes[256]; +#endif + unsigned int AlphaIndexes[0x100]; +#if APT_PKG_ABI < 413 + APT_DEPRECATED unsigned int TagCount; +#endif // dpointer placeholder (for later in case we need it) - void *d; + pkgTagSectionPrivate *d; protected: const char *Stop; @@ -86,7 +85,13 @@ class pkgTagSection * @return \b true if section end was found, \b false otherwise. * Beware that internal state will be inconsistent if \b false is returned! */ +#if APT_PKG_ABI >= 413 APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength, bool const Restart = true); +#else + APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength, bool const Restart); + APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength); +#endif + inline unsigned long size() const {return Stop - Section;}; void Trim(); virtual void TrimRecord(bool BeforeRecord, const char* &End); @@ -94,13 +99,16 @@ class pkgTagSection /** \brief amount of Tags in the current section * * Note: if a Tag is mentioned repeatly it will be counted multiple - * times, but only the last occurance is available via Find methods. + * times, but only the last occurrence is available via Find methods. */ unsigned int Count() const; +#if APT_PKG_ABI >= 413 bool Exists(const char* const Tag) const; +#else + bool Exists(const char* const Tag); +#endif - inline void Get(const char *&Start,const char *&Stop,unsigned int I) const - {Start = Section + Tags[I].StartTag; Stop = Section + Tags[I+1].StartTag;} + void Get(const char *&Start,const char *&Stop,unsigned int I) const; inline void GetSection(const char *&Start,const char *&Stop) const { @@ -109,7 +117,7 @@ class pkgTagSection }; pkgTagSection(); - virtual ~pkgTagSection() {}; + virtual ~pkgTagSection(); }; class pkgTagFilePrivate;