tag/MixRampParser: use std::string_view

This commit is contained in:
Max Kellermann 2022-06-30 10:58:49 +02:00
parent d0382caa88
commit 11135b48e6
2 changed files with 8 additions and 8 deletions

View File

@ -21,7 +21,6 @@
#include "VorbisComment.hxx"
#include "MixRampInfo.hxx"
#include "util/ASCII.hxx"
#include "util/StringView.hxx"
#include <cassert>
@ -56,10 +55,10 @@ ParseMixRampTag(MixRampInfo &info,
const char *value;
[[gnu::pure]]
StringView operator[](const char *n) const noexcept {
std::string_view operator[](const char *n) const noexcept {
return StringEqualsCaseASCII(name, n)
? value
: nullptr;
: std::string_view{};
}
};
@ -67,13 +66,13 @@ ParseMixRampTag(MixRampInfo &info,
}
bool
ParseMixRampVorbis(MixRampInfo &info, StringView entry) noexcept
ParseMixRampVorbis(MixRampInfo &info, std::string_view entry) noexcept
{
struct VorbisCommentEntry {
StringView entry;
std::string_view entry;
[[gnu::pure]]
StringView operator[](StringView n) const noexcept {
std::string_view operator[](std::string_view n) const noexcept {
return GetVorbisCommentValue(entry, n);
}
};

View File

@ -19,7 +19,8 @@
#pragma once
struct StringView;
#include <string_view>
class MixRampInfo;
bool
@ -27,4 +28,4 @@ ParseMixRampTag(MixRampInfo &info,
const char *name, const char *value) noexcept;
bool
ParseMixRampVorbis(MixRampInfo &info, StringView entry) noexcept;
ParseMixRampVorbis(MixRampInfo &info, std::string_view entry) noexcept;