From 714dbc92946b370787f923677dc961ec64ee3b50 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2024 13:18:57 +0100 Subject: [PATCH] lib/upnp/Discovery: forward-declare inner class ContentDirectoryDescriptor --- src/lib/upnp/Discovery.cxx | 25 +++++++++++++++++++++++++ src/lib/upnp/Discovery.hxx | 25 +------------------------ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx index 341f710a4..bd27c30de 100644 --- a/src/lib/upnp/Discovery.cxx +++ b/src/lib/upnp/Discovery.cxx @@ -3,6 +3,7 @@ #include "Discovery.hxx" #include "ContentDirectoryService.hxx" +#include "Device.hxx" #include "Log.hxx" #include "Error.hxx" #include "lib/curl/Global.hxx" @@ -18,6 +19,30 @@ #include +class UPnPDeviceDirectory::ContentDirectoryDescriptor { +public: + std::string id; + + UPnPDevice device; + + /** + * The time stamp when this device expires. + */ + std::chrono::steady_clock::time_point expires; + + ContentDirectoryDescriptor() = default; + + ContentDirectoryDescriptor(std::string &&_id, + std::chrono::steady_clock::time_point last, + std::chrono::steady_clock::duration exp) noexcept + :id(std::move(_id)), + expires(last + exp + std::chrono::seconds(20)) {} + + void Parse(std::string_view url, std::string_view description) { + device.Parse(url, description); + } +}; + class UPnPDeviceDirectory::Downloader final : public IntrusiveListHook<>, CurlResponseHandler { diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx index 433481368..be250d8a3 100644 --- a/src/lib/upnp/Discovery.hxx +++ b/src/lib/upnp/Discovery.hxx @@ -2,7 +2,6 @@ // Copyright The Music Player Daemon Project #include "Callback.hxx" -#include "Device.hxx" #include "lib/curl/Init.hxx" #include "thread/Mutex.hxx" #include "util/IntrusiveList.hxx" @@ -31,29 +30,7 @@ class UPnPDeviceDirectory final : UpnpCallback { * Descriptor for one device having a Content Directory * service found on the network. */ - class ContentDirectoryDescriptor { - public: - std::string id; - - UPnPDevice device; - - /** - * The time stamp when this device expires. - */ - std::chrono::steady_clock::time_point expires; - - ContentDirectoryDescriptor() = default; - - ContentDirectoryDescriptor(std::string &&_id, - std::chrono::steady_clock::time_point last, - std::chrono::steady_clock::duration exp) noexcept - :id(std::move(_id)), - expires(last + exp + std::chrono::seconds(20)) {} - - void Parse(std::string_view url, std::string_view description) { - device.Parse(url, description); - } - }; + class ContentDirectoryDescriptor; class Downloader;