summaryrefslogtreecommitdiff
path: root/apt-pkg/tagfile.h
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-01-07 19:16:23 +0100
committerJulian Andres Klode <jak@debian.org>2016-01-07 19:59:08 +0100
commiteff0c22e59e65b6b63e854ff41eb091278e05714 (patch)
tree8496b397479c397085bb57dd4756c9113b4e2cbf /apt-pkg/tagfile.h
parentfe7fa47c1141066c89ab3382c318a4b9d00fe249 (diff)
Switch performance critical code to use APT::StringView
This improves performance of the cache generation on my ARM platform (4x Cortex A15) by about 10% to 20% from 2.35-2.50 to 2.1 seconds.
Diffstat (limited to 'apt-pkg/tagfile.h')
-rw-r--r--apt-pkg/tagfile.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index 460cf2cd6..0f4c15436 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -27,6 +27,9 @@
#include <string>
#include <vector>
#include <list>
+#ifdef APT_PKG_EXPOSE_STRING_VIEW
+#include <apt-pkg/string_view.h>
+#endif
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/fileutl.h>
@@ -58,19 +61,40 @@ 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;
- std::string FindS(const char *Tag) const;
- std::string FindRawS(const char *Tag) 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 static FindFlag(uint8_t &Flags, uint8_t const Flag,
- const char* const Start, const char* const Stop);
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;
+
+#ifdef APT_PKG_EXPOSE_STRING_VIEW
+ 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,
+ uint8_t const Flag) const;
+ APT_HIDDEN bool FindFlag(APT::StringView Tag,unsigned long &Flags,
+ unsigned long Flag) const;
+ APT_HIDDEN bool Exists(APT::StringView Tag) const;
+#endif
+
+ bool static FindFlag(uint8_t &Flags, uint8_t const Flag,
+ const char* const Start, const char* const Stop);
bool static FindFlag(unsigned long &Flags, unsigned long Flag,
const char* Start, const char* Stop);
@@ -102,7 +126,6 @@ class pkgTagSection
* times, but only the last occurrence is available via Find methods.
*/
unsigned int Count() const;
- bool Exists(const char* const Tag) const;
void Get(const char *&Start,const char *&Stop,unsigned int I) const;