// SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project #pragma once #include "config.h" // for USING_PUPNP #include // for UpnpClient_Handle #include // for std::pair #ifdef USING_PUPNP #include class UpnpActionResponse { IXML_Document *document; public: explicit UpnpActionResponse(IXML_Document *_document) noexcept :document(_document) {} ~UpnpActionResponse() noexcept { ixmlDocument_free(document); } UpnpActionResponse(const UpnpActionResponse &) = delete; UpnpActionResponse &operator=(const UpnpActionResponse &) = delete; [[gnu::pure]] const char *GetValue(const char *name) const noexcept; }; UpnpActionResponse UpnpSendAction(UpnpClient_Handle handle, const char *url, const char *action_name, const char *service_type, std::initializer_list> args); #else // USING_PUPNP #include #include class UpnpActionResponse { std::vector> data; public: explicit UpnpActionResponse(std::vector> &&_data) noexcept :data(_data) {} UpnpActionResponse(const UpnpActionResponse &) = delete; UpnpActionResponse &operator=(const UpnpActionResponse &) = delete; [[gnu::pure]] const char *GetValue(std::string_view name) const noexcept { for (const auto &i : data) if (i.first == name) return i.second.c_str(); return nullptr; } }; UpnpActionResponse UpnpSendAction(UpnpClient_Handle handle, const char *url, const char *action_name, const char *service_type, const std::vector> &args); #endif // !USING_PUPNP