summaryrefslogtreecommitdiff
path: root/apt-pkg/tagfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/tagfile.h')
-rw-r--r--apt-pkg/tagfile.h48
1 files changed, 15 insertions, 33 deletions
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);