lib/upnp/ContentDirectoryService: use SplitString() instead of csvToStrings()
This commit is contained in:
@@ -22,10 +22,10 @@
|
|||||||
#include "UniqueIxml.hxx"
|
#include "UniqueIxml.hxx"
|
||||||
#include "Device.hxx"
|
#include "Device.hxx"
|
||||||
#include "ixmlwrap.hxx"
|
#include "ixmlwrap.hxx"
|
||||||
#include "Util.hxx"
|
|
||||||
#include "Action.hxx"
|
#include "Action.hxx"
|
||||||
#include "util/UriUtil.hxx"
|
#include "util/UriUtil.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
#include "util/SplitString.hxx"
|
||||||
|
|
||||||
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
|
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
|
||||||
const UPnPService &service) noexcept
|
const UPnPService &service) noexcept
|
||||||
@@ -49,7 +49,7 @@ ContentDirectoryService::~ContentDirectoryService() noexcept
|
|||||||
/* this destructor exists here just so it won't get inlined */
|
/* this destructor exists here just so it won't get inlined */
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string>
|
std::forward_list<std::string>
|
||||||
ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const
|
ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const
|
||||||
{
|
{
|
||||||
UniqueIxmlDocument request(UpnpMakeAction("GetSearchCapabilities", m_serviceType.c_str(),
|
UniqueIxmlDocument request(UpnpMakeAction("GetSearchCapabilities", m_serviceType.c_str(),
|
||||||
@@ -68,15 +68,10 @@ ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const
|
|||||||
|
|
||||||
UniqueIxmlDocument response(_response);
|
UniqueIxmlDocument response(_response);
|
||||||
|
|
||||||
std::list<std::string> result;
|
|
||||||
|
|
||||||
const char *s = ixmlwrap::getFirstElementValue(response.get(),
|
const char *s = ixmlwrap::getFirstElementValue(response.get(),
|
||||||
"SearchCaps");
|
"SearchCaps");
|
||||||
if (s == nullptr || *s == 0)
|
if (s == nullptr || *s == 0)
|
||||||
return result;
|
return {};
|
||||||
|
|
||||||
if (!csvToStrings(s, result))
|
return SplitString(s, ',', false);
|
||||||
throw std::runtime_error("Bad response");
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
#include <upnp.h>
|
#include <upnp.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <forward_list>
|
||||||
|
|
||||||
class UPnPDevice;
|
class UPnPDevice;
|
||||||
struct UPnPService;
|
struct UPnPService;
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
* @param[out] result an empty vector: no search, or a single '*' element:
|
* @param[out] result an empty vector: no search, or a single '*' element:
|
||||||
* any tag can be used in a search, or a list of usable tag names.
|
* any tag can be used in a search, or a list of usable tag names.
|
||||||
*/
|
*/
|
||||||
std::list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
|
std::forward_list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
std::string GetURI() const noexcept {
|
std::string GetURI() const noexcept {
|
||||||
|
Reference in New Issue
Block a user