db/upnp/Directory: use std::string_view instead of StringView
This commit is contained in:
parent
93834fe389
commit
23235e3194
|
@ -23,23 +23,24 @@
|
|||
#include "tag/Builder.hxx"
|
||||
#include "tag/Table.hxx"
|
||||
#include "util/NumberParser.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using std::string_view_literals::operator""sv;
|
||||
|
||||
/* this destructor exists here just so it won't get inlined */
|
||||
UPnPDirContent::~UPnPDirContent() = default;
|
||||
|
||||
[[gnu::pure]]
|
||||
static UPnPDirObject::ItemClass
|
||||
ParseItemClass(StringView name) noexcept
|
||||
ParseItemClass(std::string_view name) noexcept
|
||||
{
|
||||
if (name.Equals("object.item.audioItem.musicTrack"))
|
||||
if (name == "object.item.audioItem.musicTrack"sv)
|
||||
return UPnPDirObject::ItemClass::MUSIC;
|
||||
else if (name.Equals("object.item.playlistItem"))
|
||||
else if (name == "object.item.playlistItem"sv)
|
||||
return UPnPDirObject::ItemClass::PLAYLIST;
|
||||
else
|
||||
return UPnPDirObject::ItemClass::UNKNOWN;
|
||||
|
@ -224,7 +225,7 @@ protected:
|
|||
break;
|
||||
|
||||
case CLASS:
|
||||
object.item_class = ParseItemClass(StringView(s, len));
|
||||
object.item_class = ParseItemClass(std::string_view(s, len));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "input/InputStream.hxx"
|
||||
#include "input/Error.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
#include "util/StringSplit.hxx"
|
||||
#include "util/UriExtract.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
|
@ -434,14 +434,13 @@ UpdateWalk::DirectoryMakeChildChecked(Directory &parent,
|
|||
|
||||
inline Directory *
|
||||
UpdateWalk::DirectoryMakeUriParentChecked(Directory &root,
|
||||
std::string_view _uri) noexcept
|
||||
std::string_view uri) noexcept
|
||||
{
|
||||
Directory *directory = &root;
|
||||
StringView uri(_uri);
|
||||
|
||||
while (true) {
|
||||
auto [name, rest] = uri.Split('/');
|
||||
if (rest == nullptr)
|
||||
auto [name, rest] = Split(uri, '/');
|
||||
if (rest.data() == nullptr)
|
||||
break;
|
||||
|
||||
if (!name.empty()) {
|
||||
|
|
Loading…
Reference in New Issue