playlist/cue/CueParser: use std::string_view in public API

This commit is contained in:
Max Kellermann 2022-06-30 10:39:42 +02:00
parent 2ba092711f
commit 232084c2f9
2 changed files with 8 additions and 7 deletions

View File

@ -19,8 +19,8 @@
#include "CueParser.hxx" #include "CueParser.hxx"
#include "tag/ParseName.hxx" #include "tag/ParseName.hxx"
#include "util/StringView.hxx"
#include "util/CharUtil.hxx" #include "util/CharUtil.hxx"
#include "util/StringView.hxx"
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
@ -110,7 +110,7 @@ CueParser::GetCurrentTag() noexcept
} }
static bool static bool
IsDigit(StringView s) noexcept IsDigit(std::string_view s) noexcept
{ {
return !s.empty() && IsDigitASCII(s.front()); return !s.empty() && IsDigitASCII(s.front());
} }
@ -174,10 +174,12 @@ CueParser::Commit() noexcept
} }
void void
CueParser::Feed(StringView src) noexcept CueParser::Feed(std::string_view _src) noexcept
{ {
assert(!end); assert(!end);
StringView src{_src};
auto command = cue_next_token(src); auto command = cue_next_token(src);
if (command == nullptr) if (command == nullptr)
return; return;

View File

@ -24,10 +24,9 @@
#include "tag/Builder.hxx" #include "tag/Builder.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"
#include <string>
#include <memory> #include <memory>
#include <string>
struct StringView; #include <string_view>
class CueParser { class CueParser {
enum { enum {
@ -106,7 +105,7 @@ public:
* Feed a text line from the CUE file into the parser. Call * Feed a text line from the CUE file into the parser. Call
* Get() after this to see if a song has been finished. * Get() after this to see if a song has been finished.
*/ */
void Feed(StringView line) noexcept; void Feed(std::string_view line) noexcept;
/** /**
* Tell the parser that the end of the file has been reached. Call * Tell the parser that the end of the file has been reached. Call