libmpd++
DASH MPD parsing and manipulation library
 
Loading...
Searching...
No Matches
Ratio.hh
Go to the documentation of this file.
1#ifndef _BBC_PARSE_DASH_MPD_RATIO_TYPE_HH_
2#define _BBC_PARSE_DASH_MPD_RATIO_TYPE_HH_
3/*****************************************************************************
4 * DASH MPD parsing library in C++: Ratio class
5 *****************************************************************************
6 * Copyright: (C) 2025 British Broadcasting Corporation
7 * Author(s): Dev Audsin <dev.audsin@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 <optional>
14#include <string>
15#include <sstream>
16
17#include "macros.hh"
18
21// Forward declarations for types only used by pointer or reference
22namespace xmlpp {
23 class Element;
24 class Node;
25}
28
30
37public:
38 using size_type = size_t;
39
41 : m_numerator(0)
42 , m_denominator(0)
43 {};
44
45 Ratio(const std::string &ratio_str);
46
48 : m_numerator(numerator)
49 , m_denominator(denominator)
50 {};
51
52 virtual ~Ratio() {};
53
54 bool operator==(const Ratio &other) const;
55
56 operator std::string() const;
57
58 size_type numerator() const { return m_numerator; }
59 Ratio &numerator(size_type num) { m_numerator = num; return *this; }
60 size_type denominator() const { return m_denominator; }
61 Ratio &denominator(size_type den) { m_denominator = den; return *this; }
62
64protected:
65 friend class AdaptationSet;
66 Ratio(xmlpp::Node &node);
67 void setXMLElement(xmlpp::Element &elem) const;
69
70private:
71 void convertString(const std::string &ratio_str);
72
73 size_type m_numerator;
74 size_type m_denominator;
75};
76
78
79/* vim:ts=8:sts=4:sw=4:expandtab:
80 */
81#endif /*_BBC_PARSE_DASH_MPD_RATIO_TYPE_HH_*/
AdaptationSet class.
Definition AdaptationSet.hh:60
Definition Ratio.hh:36
size_type denominator() const
Definition Ratio.hh:60
Ratio(const std::string &ratio_str)
Ratio()
Definition Ratio.hh:40
Ratio(size_type numerator, size_type denominator)
Definition Ratio.hh:47
Ratio & numerator(size_type num)
Definition Ratio.hh:59
Ratio & denominator(size_type den)
Definition Ratio.hh:61
size_type numerator() const
Definition Ratio.hh:58
size_t size_type
Definition Ratio.hh:38
bool operator==(const Ratio &other) const
virtual ~Ratio()
Definition Ratio.hh:52
#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