summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/CMakeLists.txt2
-rw-r--r--apt-pkg/cacheiterators.h8
-rw-r--r--apt-pkg/contrib/hashsum_template.h15
-rw-r--r--apt-pkg/contrib/string_view.h4
-rw-r--r--apt-pkg/contrib/strutl.cc5
-rw-r--r--apt-pkg/contrib/strutl.h7
-rw-r--r--apt-pkg/deb/deblistparser.h18
-rw-r--r--apt-pkg/depcache.h6
-rw-r--r--apt-pkg/pkgcache.cc33
-rw-r--r--apt-pkg/pkgcache.h29
-rw-r--r--apt-pkg/pkgcachegen.h20
-rw-r--r--apt-pkg/tagfile-compat.cc75
-rw-r--r--apt-pkg/tagfile.h48
13 files changed, 31 insertions, 239 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index efa680f6b..db23a30f7 100644
--- a/apt-pkg/CMakeLists.txt
+++ b/apt-pkg/CMakeLists.txt
@@ -1,8 +1,6 @@
# Include apt-pkg directly, as some files have #include <system.h>
include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
-add_definitions("-DAPT_PKG_EXPOSE_STRING_VIEW")
-
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/apt-pkg/)
execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--ignore-case
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 27daf4c43..fbd4bcb8d 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -37,9 +37,7 @@
#include <iosfwd>
#include <iterator>
#include <string>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <string.h>
@@ -118,11 +116,7 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
inline PkgIterator PackageList() const;
- PkgIterator FindPkg(std::string Arch = "any") const;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN PkgIterator FindPkg(APT::StringView Arch = APT::StringView("any", 3)) const;
- APT_HIDDEN PkgIterator FindPkg(const char *Arch) const;
-#endif
+ PkgIterator FindPkg(APT::StringView Arch = APT::StringView("any", 3)) const;
/** \brief find the package with the "best" architecture
The best architecture is either the "native" or the first
diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h
index f11fc2f1c..52b2cbab3 100644
--- a/apt-pkg/contrib/hashsum_template.h
+++ b/apt-pkg/contrib/hashsum_template.h
@@ -11,9 +11,7 @@
#include <cstring>
#include <string>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <apt-pkg/strutl.h>
@@ -77,17 +75,10 @@ class HashSumValue
return Value();
}
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN bool Set(APT::StringView Str)
- {
- return Hex2Num(Str,Sum,sizeof(Sum));
- }
-#else
- bool Set(std::string Str)
+ bool Set(APT::StringView Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
}
-#endif
inline void Set(unsigned char S[N/8])
{
for (int I = 0; I != sizeof(Sum); ++I)
@@ -99,8 +90,7 @@ class HashSumValue
memset(Sum,0,sizeof(Sum));
Set(Str);
}
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN explicit HashSumValue(APT::StringView const &Str)
+ explicit HashSumValue(APT::StringView const &Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -110,7 +100,6 @@ class HashSumValue
memset(Sum,0,sizeof(Sum));
Set(Str);
}
-#endif
HashSumValue()
{
memset(Sum,0,sizeof(Sum));
diff --git a/apt-pkg/contrib/string_view.h b/apt-pkg/contrib/string_view.h
index 536744e32..443ea395e 100644
--- a/apt-pkg/contrib/string_view.h
+++ b/apt-pkg/contrib/string_view.h
@@ -9,7 +9,7 @@
* (at your option) any later version.
*/
-#if !defined(APT_STRINGVIEW_H) && defined(APT_PKG_EXPOSE_STRING_VIEW)
+#if !defined(APT_STRINGVIEW_H)
#define APT_STRINGVIEW_H
#include <apt-pkg/macros.h>
#include <string>
@@ -24,7 +24,7 @@ namespace APT {
* used by APT. It is not meant to be used in programs, only inside the
* library for performance critical paths.
*/
-class APT_HIDDEN StringView {
+class StringView {
const char *data_;
size_t size_;
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index e854c5bf1..c00bce5d5 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1202,11 +1202,6 @@ static int HexDigit(int c)
// Hex2Num - Convert a long hex number into a buffer /*{{{*/
// ---------------------------------------------------------------------
/* The length of the buffer must be exactly 1/2 the length of the string. */
-bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length)
-{
- return Hex2Num(APT::StringView(Str), Num, Length);
-}
-
bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length)
{
if (Str.length() != Length*2)
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index ae0aaedf9..3853d5ba6 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -20,9 +20,7 @@
#include <limits>
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <stddef.h>
#include <time.h>
@@ -100,10 +98,7 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0)
bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
bool Base256ToNum(const char *Str,unsigned long long &Res,unsigned int Len);
-bool Hex2Num(const std::string &Str,unsigned char *Num,unsigned int Length);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
-APT_HIDDEN bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length);
-#endif
+bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length);
// input changing string split
bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax);
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 8143f855f..1d731d5a9 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -18,9 +18,7 @@
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/indexfile.h>
@@ -32,14 +30,12 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
{
public:
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
// Parser Helper
struct WordList
{
APT::StringView Str;
unsigned char Val;
};
-#endif
private:
std::vector<std::string> forceEssential;
@@ -57,9 +53,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
unsigned int Type);
bool ParseProvides(pkgCache::VerIterator &Ver);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN static bool GrabWord(APT::StringView Word,const WordList *List,unsigned char &Out);
-#endif
APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
public:
@@ -69,15 +63,11 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
// These all operate against the current section
virtual std::string Package() APT_OVERRIDE;
virtual bool ArchitectureAll() APT_OVERRIDE;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Architecture() APT_OVERRIDE;
virtual APT::StringView Version() APT_OVERRIDE;
-#endif
virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Description_md5() APT_OVERRIDE;
-#endif
virtual unsigned short VersionHash() APT_OVERRIDE;
virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
@@ -105,19 +95,17 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
bool const &ParseRestrictionsList,
std::string const &Arch);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop,
+ APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
APT::StringView &Package,
APT::StringView &Ver,unsigned int &Op,
bool const ParseArchFlags = false, bool StripMultiArch = true,
bool const ParseRestrictionsList = false);
- APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop,
+ APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
APT::StringView &Package,
APT::StringView &Ver,unsigned int &Op,
bool const ParseArchFlags, bool StripMultiArch,
bool const ParseRestrictionsList,
std::string const &Arch);
-#endif
APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);
@@ -139,11 +127,9 @@ class APT_HIDDEN debDebFileParser : public debListParser
class APT_HIDDEN debTranslationsParser : public debListParser
{
public:
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
// a translation can never be a real package
virtual APT::StringView Architecture() APT_OVERRIDE { return ""; }
virtual APT::StringView Version() APT_OVERRIDE { return ""; }
-#endif
explicit debTranslationsParser(FileFd *File)
: debListParser(File) {};
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 3013c0ddb..5cbaf5f9a 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -356,9 +356,9 @@ class pkgDepCache : protected pkgCache::Namespace
inline Header &Head() {return *Cache->HeaderP;};
inline GrpIterator GrpBegin() {return Cache->GrpBegin();};
inline PkgIterator PkgBegin() {return Cache->PkgBegin();};
- inline GrpIterator FindGrp(std::string const &Name) {return Cache->FindGrp(Name);};
- inline PkgIterator FindPkg(std::string const &Name) {return Cache->FindPkg(Name);};
- inline PkgIterator FindPkg(std::string const &Name, std::string const &Arch) {return Cache->FindPkg(Name, Arch);};
+ inline GrpIterator FindGrp(APT::StringView Name) {return Cache->FindGrp(Name);};
+ inline PkgIterator FindPkg(APT::StringView Name) {return Cache->FindPkg(Name);};
+ inline PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch) {return Cache->FindPkg(Name, Arch);};
inline pkgCache &GetCache() {return *Cache;};
inline pkgVersioningSystem &VS() {return *Cache->VS;};
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 5819a9b4a..edd5cf30e 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -213,21 +213,6 @@ map_id_t pkgCache::sHash(StringView Str) const
Hash = 33 * Hash + tolower_ascii_unsafe(*I);
return Hash % HeaderP->GetHashTableSize();
}
-map_id_t pkgCache::sHash(const string &Str) const
-{
- uint32_t Hash = 5381;
- for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
- Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
- return Hash % HeaderP->GetHashTableSize();
-}
-
-map_id_t pkgCache::sHash(const char *Str) const
-{
- uint32_t Hash = 5381;
- for (const char *I = Str; *I != 0; ++I)
- Hash = 33 * Hash + tolower_ascii_unsafe((signed char)*I);
- return Hash % HeaderP->GetHashTableSize();
-}
#if defined(HAVE_FMV_SSE42_AND_CRC32)
@@ -305,10 +290,6 @@ uint32_t pkgCache::CacheHash()
// Cache::FindPkg - Locate a package by name /*{{{*/
// ---------------------------------------------------------------------
/* Returns 0 on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
- return FindPkg(StringView(Name));
-}
-
pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
auto const found = Name.rfind(':');
if (found == string::npos)
@@ -325,10 +306,6 @@ pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
// Cache::FindPkg - Locate a package by name /*{{{*/
// ---------------------------------------------------------------------
/* Returns 0 on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string const &Arch) {
- return FindPkg(StringView(Name), StringView(Arch));
-}
-
pkgCache::PkgIterator pkgCache::FindPkg(StringView Name, StringView Arch) {
/* We make a detour via the GrpIterator here as
on a multi-arch environment a group is easier to
@@ -343,10 +320,6 @@ pkgCache::PkgIterator pkgCache::FindPkg(StringView Name, StringView Arch) {
// Cache::FindGrp - Locate a group by name /*{{{*/
// ---------------------------------------------------------------------
/* Returns End-Pointer on error, pointer to the group otherwise */
-pkgCache::GrpIterator pkgCache::FindGrp(const string &Name) {
- return FindGrp(StringView(Name));
-}
-
pkgCache::GrpIterator pkgCache::FindGrp(StringView Name) {
if (unlikely(Name.empty() == true))
return GrpIterator(*this,0);
@@ -416,12 +389,6 @@ const char *pkgCache::Priority(unsigned char Prio)
// GrpIterator::FindPkg - Locate a package by arch /*{{{*/
// ---------------------------------------------------------------------
/* Returns an End-Pointer on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
- return FindPkg(StringView(Arch));
-}
-pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(const char *Arch) const {
- return FindPkg(StringView(Arch));
-}
pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(StringView Arch) const {
if (unlikely(IsGood() == false || S->FirstPackage == 0))
return PkgIterator(*Owner, 0);
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index c20320a56..4511aade0 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -81,9 +81,7 @@
#include <stdint.h>
#include <time.h>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#ifndef APT_8_CLEANER_HEADERS
using std::string;
@@ -199,11 +197,7 @@ class pkgCache /*{{{*/
// Memory mapped cache file
std::string CacheFile;
MMap &Map;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN map_id_t sHash(APT::StringView S) const APT_PURE;
-#endif
- map_id_t sHash(const std::string &S) const APT_PURE;
- map_id_t sHash(const char *S) const APT_PURE;
+ map_id_t sHash(APT::StringView S) const APT_PURE;
public:
@@ -228,11 +222,7 @@ class pkgCache /*{{{*/
inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}
// String hashing function (512 range)
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN inline map_id_t Hash(APT::StringView S) const {return sHash(S);}
-#endif
- inline map_id_t Hash(const std::string &S) const {return sHash(S);}
- inline map_id_t Hash(const char *S) const {return sHash(S);}
+ inline map_id_t Hash(APT::StringView S) const {return sHash(S);}
APT_HIDDEN uint32_t CacheHash();
@@ -240,25 +230,16 @@ class pkgCache /*{{{*/
static const char *Priority(unsigned char Priority);
// Accessors
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN GrpIterator FindGrp(APT::StringView Name);
- APT_HIDDEN PkgIterator FindPkg(APT::StringView Name);
- APT_HIDDEN PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch);
-#endif
+ GrpIterator FindGrp(APT::StringView Name);
+ PkgIterator FindPkg(APT::StringView Name);
+ PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT::StringView ViewString(map_stringitem_t idx) const
{
char *name = StrP + idx;
uint16_t len = *reinterpret_cast<const uint16_t*>(name - sizeof(uint16_t));
return APT::StringView(name, len);
}
-#endif
-
-
- GrpIterator FindGrp(const std::string &Name);
- PkgIterator FindPkg(const std::string &Name);
- PkgIterator FindPkg(const std::string &Name, const std::string &Arch);
Header &Head() {return *HeaderP;}
inline GrpIterator GrpBegin();
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index 42ea3aa34..1f639c526 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -28,9 +28,7 @@
#if __cplusplus >= 201103L
#include <unordered_set>
#endif
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
class FileFd;
class pkgSourceList;
@@ -40,9 +38,7 @@ class pkgCacheListParser;
class APT_HIDDEN pkgCacheGenerator /*{{{*/
{
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN map_stringitem_t WriteStringInMap(APT::StringView String) { return WriteStringInMap(String.data(), String.size()); };
-#endif
APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String);
APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String, const unsigned long &Len);
APT_HIDDEN map_pointer_t AllocateInMap(const unsigned long &size);
@@ -112,14 +108,12 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
std::string PkgFileName;
pkgCache::PackageFile *CurrentFile;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
bool NewGroup(pkgCache::GrpIterator &Grp, APT::StringView Name);
bool NewPackage(pkgCache::PkgIterator &Pkg, APT::StringView Name, APT::StringView Arch);
map_pointer_t NewVersion(pkgCache::VerIterator &Ver, APT::StringView const &VerStr,
map_pointer_t const ParentPkg, unsigned short const Hash,
map_pointer_t const Next);
map_pointer_t NewDescription(pkgCache::DescIterator &Desc,const std::string &Lang, APT::StringView md5sum,map_stringitem_t const idxmd5str);
-#endif
bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
@@ -133,9 +127,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
enum StringType { MIXED, PKGNAME, VERSIONNUMBER, SECTION };
map_stringitem_t StoreString(StringType const type, const char * S, unsigned int const Size);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
inline map_stringitem_t StoreString(enum StringType const type, APT::StringView S) {return StoreString(type, S.data(),S.length());};
-#endif
void DropProgress() {Progress = 0;};
bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, unsigned long Flags = 0);
@@ -163,19 +155,15 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
void * const d;
APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName);
APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
APT::StringView const &Version, pkgCache::VerIterator* &OutVer);
-#endif
APT_HIDDEN bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P,
pkgCache::VerIterator &V);
APT_HIDDEN bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
APT_HIDDEN bool AddNewDescription(ListParser &List, pkgCache::VerIterator &Ver,
std::string const &lang, APT::StringView CurMd5, map_stringitem_t &md5idx);
-#endif
};
/*}}}*/
// This is the abstract package list parser class. /*{{{*/
@@ -193,13 +181,10 @@ class APT_HIDDEN pkgCacheListParser
protected:
inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, const char *S,unsigned int Size) {return Owner->StoreString(type, S, Size);};
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, APT::StringView S) {return Owner->StoreString(type, S);};
inline map_stringitem_t WriteString(APT::StringView S) {return Owner->WriteStringInMap(S.data(), S.size());};
-#endif
inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);};
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
bool NewDepends(pkgCache::VerIterator &Ver,APT::StringView Package, APT::StringView Arch,
APT::StringView Version,uint8_t const Op,
uint8_t const Type);
@@ -208,21 +193,16 @@ class APT_HIDDEN pkgCacheListParser
uint8_t const Flags);
bool NewProvidesAllArch(pkgCache::VerIterator &Ver, APT::StringView Package,
APT::StringView Version, uint8_t const Flags);
-#endif
public:
// These all operate against the current section
virtual std::string Package() = 0;
virtual bool ArchitectureAll() = 0;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Architecture() = 0;
virtual APT::StringView Version() = 0;
-#endif
virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0;
virtual std::vector<std::string> AvailableDescriptionLanguages() = 0;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
virtual APT::StringView Description_md5() = 0;
-#endif
virtual unsigned short VersionHash() = 0;
/** compare currently parsed version with given version
*
diff --git a/apt-pkg/tagfile-compat.cc b/apt-pkg/tagfile-compat.cc
deleted file mode 100644
index 1e1d23e8c..000000000
--- a/apt-pkg/tagfile-compat.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-/* ######################################################################
-
- Fast scanner for RFC-822 type header information
-
- This uses a rotating buffer to load the package information into.
- The scanner runs over it and isolates and indexes a single section.
-
- This defines compat functions for the external code.
-
- ##################################################################### */
- /*}}}*/
-
-#include <config.h>
-#define APT_COMPILING_TAGFILE_COMPAT_CC
-#include <apt-pkg/tagfile.h>
-
-using std::string;
-using APT::StringView;
-
-
-bool pkgTagSection::Exists(const char* const Tag) const
-{
- return Exists(StringView(Tag));
-}
-
-bool pkgTagSection::Find(const char *Tag,unsigned int &Pos) const
-{
- return Find(StringView(Tag), Pos);
-}
-
-bool pkgTagSection::Find(const char *Tag,const char *&Start,
- const char *&End) const
-{
- return Find(StringView(Tag), Start, End);
-}
-
-string pkgTagSection::FindS(const char *Tag) const
-{
- return Find(StringView(Tag)).to_string();
-}
-
-string pkgTagSection::FindRawS(const char *Tag) const
-{
- return FindRaw(StringView(Tag)).to_string();
-}
-
-signed int pkgTagSection::FindI(const char *Tag,signed long Default) const
-{
- return FindI(StringView(Tag), Default);
-}
-
-unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const
-{
- return FindULL(StringView(Tag), Default);
-}
- /*}}}*/
-
-bool pkgTagSection::FindB(const char *Tag, bool const &Default) const
-{
- return FindB(StringView(Tag), Default);
-}
-
-bool pkgTagSection::FindFlag(const char * const Tag, uint8_t &Flags,
- uint8_t const Flag) const
-{
- return FindFlag(StringView(Tag), Flags, Flag);
-}
-
-bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
- unsigned long Flag) const
-{
- return FindFlag(StringView(Tag), Flags, Flag);
-}
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index de7bfcbaf..c2ec79504 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -27,9 +27,7 @@
#include <list>
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h>
@@ -55,10 +53,8 @@ class pkgTagSection
pkgTagSectionPrivate * const d;
APT_HIDDEN bool FindInternal(unsigned int Pos,const char *&Start, const char *&End) const;
-#if defined(APT_PKG_EXPOSE_STRING_VIEW)
APT_HIDDEN APT::StringView FindInternal(unsigned int Pos) const;
APT_HIDDEN APT::StringView FindRawInternal(unsigned int Pos) const;
-#endif
APT_HIDDEN signed int FindIInternal(unsigned int Pos,signed long Default = 0) const;
APT_HIDDEN bool FindBInternal(unsigned int Pos, bool Default = false) const;
APT_HIDDEN unsigned long long FindULLInternal(unsigned int Pos, unsigned long long const &Default = 0) const;
@@ -73,21 +69,9 @@ class pkgTagSection
inline bool operator ==(const pkgTagSection &rhs) {return Section == rhs.Section;};
inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs.Section;};
-#if !defined(APT_PKG_EXPOSE_STRING_VIEW) || defined(APT_COMPILING_TAGFILE_COMPAT_CC)
- bool Find(const char *Tag,const char *&Start, const char *&End) const;
- bool Find(const char *Tag,unsigned int &Pos) const;
- signed int FindI(const char *Tag,signed long Default = 0) const;
- bool FindB(const char *Tag, bool const &Default = false) const;
- unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const;
- bool FindFlag(const char * const Tag,uint8_t &Flags,
- uint8_t const Flag) const;
- bool FindFlag(const char *Tag,unsigned long &Flags,
- unsigned long Flag) const;
- bool Exists(const char* const Tag) const;
-#endif
// TODO: Remove internally
- std::string FindS(const char *Tag) const;
- std::string FindRawS(const char *Tag) const;
+ std::string FindS(APT::StringView sv) const { return Find(sv).to_string(); }
+ std::string FindRawS(APT::StringView sv) const { return FindRaw(sv).to_string(); };
// Functions for lookup with a perfect hash function
enum class Key;
@@ -99,23 +83,21 @@ class pkgTagSection
APT_HIDDEN bool FindFlag(Key key,uint8_t &Flags, uint8_t const Flag) const;
APT_HIDDEN bool FindFlag(Key key,unsigned long &Flags, unsigned long Flag) const;
APT_HIDDEN bool Exists(Key key) const;
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN APT::StringView Find(Key key) const;
- APT_HIDDEN APT::StringView FindRaw(Key key) const;
- APT_HIDDEN bool Find(APT::StringView Tag,const char *&Start, const char *&End) const;
- APT_HIDDEN bool Find(APT::StringView Tag,unsigned int &Pos) const;
- APT_HIDDEN APT::StringView Find(APT::StringView Tag) const;
- APT_HIDDEN APT::StringView FindRaw(APT::StringView Tag) const;
- APT_HIDDEN signed int FindI(APT::StringView Tag,signed long Default = 0) const;
- APT_HIDDEN bool FindB(APT::StringView, bool Default = false) const;
- APT_HIDDEN unsigned long long FindULL(APT::StringView Tag, unsigned long long const &Default = 0) const;
-
- APT_HIDDEN bool FindFlag(APT::StringView Tag,uint8_t &Flags,
+ APT::StringView Find(Key key) const;
+ APT::StringView FindRaw(Key key) const;
+ bool Find(APT::StringView Tag,const char *&Start, const char *&End) const;
+ bool Find(APT::StringView Tag,unsigned int &Pos) const;
+ APT::StringView Find(APT::StringView Tag) const;
+ APT::StringView FindRaw(APT::StringView Tag) const;
+ signed int FindI(APT::StringView Tag,signed long Default = 0) const;
+ bool FindB(APT::StringView, bool Default = false) const;
+ unsigned long long FindULL(APT::StringView Tag, unsigned long long const &Default = 0) const;
+
+ bool FindFlag(APT::StringView Tag,uint8_t &Flags,
uint8_t const Flag) const;
- APT_HIDDEN bool FindFlag(APT::StringView Tag,unsigned long &Flags,
+ bool FindFlag(APT::StringView Tag,unsigned long &Flags,
unsigned long Flag) const;
- APT_HIDDEN bool Exists(APT::StringView Tag) const;
-#endif
+ bool Exists(APT::StringView Tag) const;
bool static FindFlag(uint8_t &Flags, uint8_t const Flag,
const char* const Start, const char* const Stop);