playlist/PlaylistPlugin: use std::string_view

This commit is contained in:
Max Kellermann 2022-07-01 11:31:01 +02:00
parent 9d50306e2f
commit d882c3361d
2 changed files with 8 additions and 8 deletions

View File

@ -19,24 +19,23 @@
#include "PlaylistPlugin.hxx" #include "PlaylistPlugin.hxx"
#include "util/StringUtil.hxx" #include "util/StringUtil.hxx"
#include "util/StringView.hxx"
bool bool
PlaylistPlugin::SupportsScheme(StringView scheme) const noexcept PlaylistPlugin::SupportsScheme(std::string_view scheme) const noexcept
{ {
return schemes != nullptr && return schemes != nullptr &&
StringArrayContainsCase(schemes, scheme); StringArrayContainsCase(schemes, scheme);
} }
bool bool
PlaylistPlugin::SupportsSuffix(StringView suffix) const noexcept PlaylistPlugin::SupportsSuffix(std::string_view suffix) const noexcept
{ {
return suffixes != nullptr && return suffixes != nullptr &&
StringArrayContainsCase(suffixes, suffix); StringArrayContainsCase(suffixes, suffix);
} }
bool bool
PlaylistPlugin::SupportsMimeType(StringView mime_type) const noexcept PlaylistPlugin::SupportsMimeType(std::string_view mime_type) const noexcept
{ {
return mime_types != nullptr && return mime_types != nullptr &&
StringArrayContainsCase(mime_types, mime_type); StringArrayContainsCase(mime_types, mime_type);

View File

@ -24,9 +24,10 @@
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"
#include <string_view>
struct ConfigBlock; struct ConfigBlock;
struct Tag; struct Tag;
struct StringView;
class SongEnumerator; class SongEnumerator;
struct PlaylistPlugin { struct PlaylistPlugin {
@ -120,19 +121,19 @@ struct PlaylistPlugin {
* Does the plugin announce the specified URI scheme? * Does the plugin announce the specified URI scheme?
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool SupportsScheme(StringView scheme) const noexcept; bool SupportsScheme(std::string_view scheme) const noexcept;
/** /**
* Does the plugin announce the specified file name suffix? * Does the plugin announce the specified file name suffix?
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool SupportsSuffix(StringView suffix) const noexcept; bool SupportsSuffix(std::string_view suffix) const noexcept;
/** /**
* Does the plugin announce the specified MIME type? * Does the plugin announce the specified MIME type?
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool SupportsMimeType(StringView mime_type) const noexcept; bool SupportsMimeType(std::string_view mime_type) const noexcept;
}; };
/** /**