lib/upnp/Discovery: forward-declare inner class ContentDirectoryDescriptor

This commit is contained in:
Max Kellermann 2024-01-04 13:18:57 +01:00
parent f40eb963fd
commit 714dbc9294
2 changed files with 26 additions and 24 deletions

View File

@ -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 <stdlib.h>
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
{

View File

@ -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;