util/SplitString: convert parameter to std::string_view
This commit is contained in:
parent
ae4fd576bf
commit
870151214d
@ -591,7 +591,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
{
|
{
|
||||||
DatabaseVisitorHelper helper(CheckSelection(selection), visit_song);
|
DatabaseVisitorHelper helper(CheckSelection(selection), visit_song);
|
||||||
|
|
||||||
auto vpath = SplitString(selection.uri.c_str(), '/');
|
auto vpath = SplitString(selection.uri, '/');
|
||||||
if (vpath.empty()) {
|
if (vpath.empty()) {
|
||||||
for (const auto &server : discovery->GetDirectories()) {
|
for (const auto &server : discovery->GetDirectories()) {
|
||||||
if (visit_directory) {
|
if (visit_directory) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2013-2016 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -32,13 +32,14 @@
|
|||||||
#include "StringStrip.hxx"
|
#include "StringStrip.hxx"
|
||||||
|
|
||||||
std::forward_list<std::string>
|
std::forward_list<std::string>
|
||||||
SplitString(const char *s, char separator, bool strip) noexcept
|
SplitString(std::string_view _s, char separator, bool strip) noexcept
|
||||||
{
|
{
|
||||||
|
StringView s(_s);
|
||||||
if (strip)
|
if (strip)
|
||||||
s = StripLeft(s);
|
s.StripLeft();
|
||||||
|
|
||||||
std::forward_list<std::string> list;
|
std::forward_list<std::string> list;
|
||||||
if (*s == 0)
|
if (s.empty())
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
auto i = list.before_begin();
|
auto i = list.before_begin();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2013-2016 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <forward_list>
|
#include <forward_list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split a string at a certain separator character into sub strings
|
* Split a string at a certain separator character into sub strings
|
||||||
@ -44,6 +45,6 @@
|
|||||||
* (and not a list with an empty string).
|
* (and not a list with an empty string).
|
||||||
*/
|
*/
|
||||||
std::forward_list<std::string>
|
std::forward_list<std::string>
|
||||||
SplitString(const char *s, char separator, bool strip=true) noexcept;
|
SplitString(std::string_view s, char separator, bool strip=true) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user