util/ASCII: migrate to std::string_view
This commit is contained in:
parent
45b60b3d38
commit
8a1f1fbe06
|
@ -36,6 +36,7 @@
|
|||
#include "event/Loop.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
#include "util/NumberParser.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "ReplayGainInfo.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/NumberParser.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "Table.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
#ifndef ASCII_HXX
|
||||
#define ASCII_HXX
|
||||
|
||||
#include "StringView.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <string_view>
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
|
@ -73,17 +73,19 @@ StringEqualsCaseASCII(const char *a, const char *b, size_t n) noexcept
|
|||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static inline bool
|
||||
StringStartsWithCaseASCII(const char *haystack, StringView needle) noexcept
|
||||
StringStartsWithCaseASCII(const char *haystack,
|
||||
std::string_view needle) noexcept
|
||||
{
|
||||
return StringEqualsCaseASCII(haystack, needle.data, needle.size);
|
||||
return StringEqualsCaseASCII(haystack, needle.data(), needle.length());
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static inline const char *
|
||||
StringAfterPrefixCaseASCII(const char *haystack, StringView needle) noexcept
|
||||
StringAfterPrefixCaseASCII(const char *haystack,
|
||||
std::string_view needle) noexcept
|
||||
{
|
||||
return StringStartsWithCaseASCII(haystack, needle)
|
||||
? haystack + needle.size
|
||||
? haystack + needle.length()
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue