libmpd++
DASH MPD parsing and manipulation library
 
Loading...
Searching...
No Matches
ContentProtection.hh
Go to the documentation of this file.
1#ifndef _BBC_PARSE_DASH_MPD_CONTENT_PROTECTION_HH_
2#define _BBC_PARSE_DASH_MPD_CONTENT_PROTECTION_HH_
3/*****************************************************************************
4 * DASH MPD parsing library in C++: ContentProtection 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 "Descriptor.hh"
18
21// Forward declarations for types only used by pointer or reference
22namespace xmlpp {
23 class Element;
24 class Node;
25}
28
30
38public:
39
45
58 ContentProtection(const URI &scheme_id,
59 const std::optional<std::string> &value = std::nullopt,
60 const std::optional<std::string> &id = std::nullopt,
61 const std::optional<std::string> &robustness = std::nullopt,
62 const std::optional<std::string> &ref_id = std::nullopt,
63 const std::optional<std::string> &ref = std::nullopt);
65 const std::optional<std::string> &value = std::nullopt,
66 const std::optional<std::string> &id = std::nullopt,
67 const std::optional<std::string> &robustness = std::nullopt,
68 const std::optional<std::string> &ref_id = std::nullopt,
69 const std::optional<std::string> &ref = std::nullopt);
71
77
83
86 virtual ~ContentProtection() {};
87
90
100 bool operator==(const ContentProtection &other) const;
101
102 // @robustness
103 bool hasRobustness() const { return m_robustness.has_value(); };
104 const std::optional<std::string> &robustness() const { return m_robustness; };
105 ContentProtection &robustness(const std::nullopt_t&) { m_robustness.reset(); return *this; };
106 ContentProtection &robustness(const std::string &val) { m_robustness = val; return *this; };
107 ContentProtection &robustness(std::string &&val) { m_robustness = std::move(val); return *this; };
108 ContentProtection &robustness(const std::optional<std::string> &val) { m_robustness = val; return *this; };
109 ContentProtection &robustness(std::optional<std::string> &&val) { m_robustness = std::move(val); return *this; };
110
111 // @refId
112 bool hasRefId() const { return m_refId.has_value(); };
113 const std::optional<std::string> &refId() const { return m_refId; };
114 ContentProtection &refId(const std::nullopt_t&) { m_refId.reset(); return *this; };
115 ContentProtection &refId(const std::string &val) { m_refId = val; return *this; };
116 ContentProtection &refId(std::string &&val) { m_refId = std::move(val); return *this; };
117 ContentProtection &refId(const std::optional<std::string> &val) { m_refId = val; return *this; };
118 ContentProtection &refId(std::optional<std::string> &&val) { m_refId = std::move(val); return *this; };
119
120 // @ref
121 bool hasRef() const { return m_ref.has_value(); };
122 const std::optional<std::string> &ref() const { return m_ref; };
123 ContentProtection &ref(const std::nullopt_t&) { m_ref.reset(); return *this; };
124 ContentProtection &ref(const std::string &val) { m_ref = val; return *this; };
125 ContentProtection &ref(std::string &&val) { m_ref = std::move(val); return *this; };
126 ContentProtection &ref(const std::optional<std::string> &val) { m_ref = val; return *this; };
127 ContentProtection &ref(std::optional<std::string> &&val) { m_ref = std::move(val); return *this; };
128
130protected:
131 friend class MPD;
132 friend class Period;
133 friend class RepresentationBase;
134
142 ContentProtection(xmlpp::Node &node);
143
151 void setXMLElement(xmlpp::Element &element) const;
153
154private:
155 std::optional<std::string> m_robustness; // string with no whitespace
156 std::optional<std::string> m_refId; // xs:ID type
157 std::optional<std::string> m_ref; // xs:IDREF type
158};
159
161
162/* vim:ts=8:sts=4:sw=4:expandtab:
163 */
164#endif /*_BBC_PARSE_DASH_MPD_CONTENT_PROTECTION_HH_*/
Definition ContentProtection.hh:37
virtual ~ContentProtection()
Definition ContentProtection.hh:86
ContentProtection(ContentProtection &&to_move)
bool hasRobustness() const
Definition ContentProtection.hh:103
ContentProtection & operator=(const ContentProtection &to_copy)
ContentProtection & refId(const std::optional< std::string > &val)
Definition ContentProtection.hh:117
bool hasRef() const
Definition ContentProtection.hh:121
ContentProtection & operator=(ContentProtection &&to_move)
const std::optional< std::string > & refId() const
Definition ContentProtection.hh:113
ContentProtection & robustness(const std::optional< std::string > &val)
Definition ContentProtection.hh:108
ContentProtection & robustness(const std::nullopt_t &)
Definition ContentProtection.hh:105
ContentProtection & refId(const std::string &val)
Definition ContentProtection.hh:115
ContentProtection & refId(std::string &&val)
Definition ContentProtection.hh:116
ContentProtection & robustness(std::optional< std::string > &&val)
Definition ContentProtection.hh:109
ContentProtection & ref(const std::nullopt_t &)
Definition ContentProtection.hh:123
ContentProtection & ref(const std::string &val)
Definition ContentProtection.hh:124
ContentProtection & ref(std::optional< std::string > &&val)
Definition ContentProtection.hh:127
ContentProtection(URI &&scheme_id, const std::optional< std::string > &value=std::nullopt, const std::optional< std::string > &id=std::nullopt, const std::optional< std::string > &robustness=std::nullopt, const std::optional< std::string > &ref_id=std::nullopt, const std::optional< std::string > &ref=std::nullopt)
ContentProtection(const ContentProtection &to_copy)
const std::optional< std::string > & robustness() const
Definition ContentProtection.hh:104
ContentProtection & robustness(const std::string &val)
Definition ContentProtection.hh:106
ContentProtection & ref(std::string &&val)
Definition ContentProtection.hh:125
bool operator==(const ContentProtection &other) const
Compares this ContentProtection with another for equality. This operator overload allows checking if ...
bool hasRefId() const
Definition ContentProtection.hh:112
ContentProtection(const URI &scheme_id, const std::optional< std::string > &value=std::nullopt, const std::optional< std::string > &id=std::nullopt, const std::optional< std::string > &robustness=std::nullopt, const std::optional< std::string > &ref_id=std::nullopt, const std::optional< std::string > &ref=std::nullopt)
ContentProtection & ref(const std::optional< std::string > &val)
Definition ContentProtection.hh:126
ContentProtection & robustness(std::string &&val)
Definition ContentProtection.hh:107
const std::optional< std::string > & ref() const
Definition ContentProtection.hh:122
ContentProtection & refId(const std::nullopt_t &)
Definition ContentProtection.hh:114
ContentProtection & refId(std::optional< std::string > &&val)
Definition ContentProtection.hh:118
const std::optional< std::string > & value() const
Definition Descriptor.hh:180
Definition MPD.hh:49
Definition Period.hh:53
Definition RepresentationBase.hh:54
Definition URI.hh:40
#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