libmpd++
DASH MPD parsing and manipulation library
 
Loading...
Searching...
No Matches
URL.hh
Go to the documentation of this file.
1#ifndef _BBC_PARSE_DASH_MPD_URL_HH_
2#define _BBC_PARSE_DASH_MPD_URL_HH_
3/*****************************************************************************
4 * DASH MPD parsing library in C++: URL class
5 *****************************************************************************
6 * Copyright: (C) 2025 British Broadcasting Corporation
7 * Author(s): David Waring <david.waring2@bbc.co.uk>
8 * License: LGPLv3
9 *
10 * For full license terms please see the LICENSE file distributed with this
11 * library or refer to: https://www.gnu.org/licenses/lgpl-3.0.txt.
12 */
13#include <iostream>
14#include <string>
15
16#include "macros.hh"
17#include "SingleRFC7233Range.hh"
18#include "URI.hh"
19
22// Forward declarations for types only used by pointer or reference
23namespace xmlpp {
24 class Element;
25 class Node;
26}
29
31
38public:
39 URL();
40 URL(const URL&);
41 URL(URL&&);
42
43 virtual ~URL() {};
44
45 URL &operator=(const URL&);
47
48 bool operator==(const URL &other) const;
49
50 // @sourceURL
51 bool hasSourceURL() const { return m_sourceURL.has_value(); };
52 const std::optional<URI> &sourceURL() const { return m_sourceURL; };
53 URL &sourceURL(const std::nullopt_t&) { m_sourceURL.reset(); return *this; };
54 URL &sourceURL(const URI &val) { m_sourceURL = val; return *this; };
55 URL &sourceURL(URI &&val) { m_sourceURL = std::move(val); return *this; };
56
57 // @range
58 bool hasRange() const { return m_range.has_value(); };
59 const std::optional<SingleRFC7233Range> &range() const { return m_range; };
60 URL &range(const std::nullopt_t&) { m_range.reset(); return *this; };
61 URL &range(const SingleRFC7233Range &val) { m_range = val; return *this; };
62 URL &range(SingleRFC7233Range &&val) { m_range = std::move(val); return *this; };
63
65protected:
66 friend class MPD;
67 friend class Period;
68 friend class AdaptationSet;
69 friend class Representation;
70 friend class BaseURL;
71 friend class SegmentBase;
72 friend class MultipleSegmentBase;
73 URL(xmlpp::Node&);
74 void setXMLElement(xmlpp::Element&) const;
76
77private:
78 // URLType from ISO 23009-1:2022 Clause 5.3.9.2.3
79 std::optional<URI> m_sourceURL;
80 std::optional<SingleRFC7233Range> m_range;
81};
82
84
85/* vim:ts=8:sts=4:sw=4:expandtab:
86 */
87#endif /*_BBC_PARSE_DASH_MPD_URL_HH_*/
AdaptationSet class.
Definition AdaptationSet.hh:60
Definition BaseURL.hh:43
Definition MPD.hh:49
Definition MultipleSegmentBase.hh:39
Definition Period.hh:53
Definition Representation.hh:55
Definition SegmentBase.hh:41
Definition SingleRFC7233Range.hh:35
Definition URI.hh:40
Definition URL.hh:37
URL & sourceURL(const std::nullopt_t &)
Definition URL.hh:53
const std::optional< URI > & sourceURL() const
Definition URL.hh:52
URL & operator=(URL &&)
const std::optional< SingleRFC7233Range > & range() const
Definition URL.hh:59
URL & operator=(const URL &)
URL & range(const SingleRFC7233Range &val)
Definition URL.hh:61
URL & sourceURL(const URI &val)
Definition URL.hh:54
bool operator==(const URL &other) const
URL & sourceURL(URI &&val)
Definition URL.hh:55
URL & range(const std::nullopt_t &)
Definition URL.hh:60
bool hasSourceURL() const
Definition URL.hh:51
bool hasRange() const
Definition URL.hh:58
virtual ~URL()
Definition URL.hh:43
URL & range(SingleRFC7233Range &&val)
Definition URL.hh:62
#define LIBMPDPP_NAMESPACE_END
Definition macros.hh:54
#define LIBMPDPP_PUBLIC_API
Used to mark something as part of the public API.
Definition macros.hh:21
#define LIBMPDPP_NAMESPACE_BEGIN
Definition macros.hh:50