playlist/cue/Parser: use Split()
This commit is contained in:
parent
ced6a5ae07
commit
1429d6bfb9
@ -20,6 +20,7 @@
|
|||||||
#include "CueParser.hxx"
|
#include "CueParser.hxx"
|
||||||
#include "tag/ParseName.hxx"
|
#include "tag/ParseName.hxx"
|
||||||
#include "util/CharUtil.hxx"
|
#include "util/CharUtil.hxx"
|
||||||
|
#include "util/StringSplit.hxx"
|
||||||
#include "util/StringStrip.hxx"
|
#include "util/StringStrip.hxx"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -43,13 +44,12 @@ cue_next_word(std::string_view &src) noexcept
|
|||||||
static std::string_view
|
static std::string_view
|
||||||
cue_next_quoted(std::string_view &src) noexcept
|
cue_next_quoted(std::string_view &src) noexcept
|
||||||
{
|
{
|
||||||
auto end = src.find('"');
|
auto [value, rest] = Split(src, '"');
|
||||||
if (end == src.npos)
|
if (rest.data() == nullptr)
|
||||||
/* syntax error - ignore it silently */
|
/* syntax error - ignore it silently */
|
||||||
return std::exchange(src, {});
|
return std::exchange(src, {});
|
||||||
|
|
||||||
auto value = src.substr(0, end);
|
src = rest;
|
||||||
src = src.substr(end + 1);
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user