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