From 232084c2f955e6545bbcdd6ac7103ead1fa0d658 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max.kellermann@gmail.com> Date: Thu, 30 Jun 2022 10:39:42 +0200 Subject: [PATCH] playlist/cue/CueParser: use std::string_view in public API --- src/playlist/cue/CueParser.cxx | 8 +++++--- src/playlist/cue/CueParser.hxx | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/playlist/cue/CueParser.cxx b/src/playlist/cue/CueParser.cxx index 6e12e77ff..d04f1fc16 100644 --- a/src/playlist/cue/CueParser.cxx +++ b/src/playlist/cue/CueParser.cxx @@ -19,8 +19,8 @@ #include "CueParser.hxx" #include "tag/ParseName.hxx" -#include "util/StringView.hxx" #include "util/CharUtil.hxx" +#include "util/StringView.hxx" #include <algorithm> #include <cassert> @@ -110,7 +110,7 @@ CueParser::GetCurrentTag() noexcept } static bool -IsDigit(StringView s) noexcept +IsDigit(std::string_view s) noexcept { return !s.empty() && IsDigitASCII(s.front()); } @@ -174,10 +174,12 @@ CueParser::Commit() noexcept } void -CueParser::Feed(StringView src) noexcept +CueParser::Feed(std::string_view _src) noexcept { assert(!end); + StringView src{_src}; + auto command = cue_next_token(src); if (command == nullptr) return; diff --git a/src/playlist/cue/CueParser.hxx b/src/playlist/cue/CueParser.hxx index 5ddfa2e1d..50deb43b7 100644 --- a/src/playlist/cue/CueParser.hxx +++ b/src/playlist/cue/CueParser.hxx @@ -24,10 +24,9 @@ #include "tag/Builder.hxx" #include "util/Compiler.h" -#include <string> #include <memory> - -struct StringView; +#include <string> +#include <string_view> class CueParser { enum { @@ -106,7 +105,7 @@ public: * Feed a text line from the CUE file into the parser. Call * 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