Tag Parser
12.5.3
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Toggle main menu visibility
Loading...
Searching...
No Matches
size.h
Go to the documentation of this file.
1
#ifndef TAG_PARSER_SIZE_H
2
#define TAG_PARSER_SIZE_H
3
4
#include "
./global.h
"
5
6
#include <c++utilities/conversion/stringbuilder.h>
7
8
#include <cstdint>
9
#include <string>
10
#include <string_view>
11
12
namespace
TagParser
{
13
17
class
TAG_PARSER_EXPORT
Size
{
18
public
:
19
constexpr
Size
();
20
constexpr
Size
(std::uint32_t
width
, std::uint32_t
height
);
21
22
constexpr
std::uint32_t
width
()
const
;
23
constexpr
std::uint32_t
height
()
const
;
24
void
setWidth
(std::uint32_t value);
25
void
setHeight
(std::uint32_t value);
26
constexpr
std::uint32_t
resolution
()
const
;
27
std::string_view
abbreviation
()
const
;
28
29
bool
constexpr
isNull
()
const
;
30
bool
constexpr
operator==
(
const
Size
&other)
const
;
31
bool
constexpr
operator>=
(
const
Size
&other)
const
;
32
std::string
toString
()
const
;
33
34
private
:
35
std::uint32_t m_width;
36
std::uint32_t m_height;
37
};
38
42
constexpr
Size::Size
()
43
: m_width(0)
44
, m_height(0)
45
{
46
}
47
51
constexpr
Size::Size
(std::uint32_t
width
, std::uint32_t
height
)
52
: m_width(
width
)
53
, m_height(
height
)
54
{
55
}
56
60
constexpr
std::uint32_t
Size::width
()
const
61
{
62
return
m_width;
63
}
64
68
constexpr
std::uint32_t
Size::height
()
const
69
{
70
return
m_height;
71
}
72
76
inline
void
Size::setWidth
(std::uint32_t value)
77
{
78
m_width = value;
79
}
80
84
inline
void
Size::setHeight
(std::uint32_t value)
85
{
86
m_height = value;
87
}
88
92
constexpr
std::uint32_t
Size::resolution
()
const
93
{
94
return
m_width * m_height;
95
}
96
100
constexpr
bool
Size::isNull
()
const
101
{
102
return
(m_width == 0) && (m_height == 0);
103
}
104
108
constexpr
bool
Size::operator==
(
const
Size
&other)
const
109
{
110
return
(m_width == other.m_width) && (m_height == other.m_height);
111
}
112
117
constexpr
bool
Size::operator>=
(
const
Size
&other)
const
118
{
119
return
(m_width >= other.m_width) && (m_height >= other.m_height);
120
}
121
125
inline
std::string
Size::toString
()
const
126
{
127
return
CppUtilities::argsToString(
"width: "
, m_width,
", height: "
, m_height);
128
}
129
130
}
// namespace TagParser
131
132
#endif
// TAG_PARSER_SIZE_H
TagParser::Size::height
constexpr std::uint32_t height() const
Returns the height.
Definition
size.h:68
TagParser::Size::setWidth
void setWidth(std::uint32_t value)
Sets the width.
Definition
size.h:76
TagParser::Size::width
constexpr std::uint32_t width() const
Returns the width.
Definition
size.h:60
TagParser::Size::isNull
bool constexpr isNull() const
Returns an indication whether both the width and height is 0.
Definition
size.h:100
TagParser::Size::toString
std::string toString() const
Returns the string representation of the current size.
Definition
size.h:125
TagParser::Size::resolution
constexpr std::uint32_t resolution() const
Returns the resolution of the current instance (product of with and height).
Definition
size.h:92
TagParser::Size::operator>=
bool constexpr operator>=(const Size &other) const
Returns whether this instance is greater than other.
Definition
size.h:117
TagParser::Size::setHeight
void setHeight(std::uint32_t value)
Sets the height.
Definition
size.h:84
TagParser::Size::Size
constexpr Size()
Constructs a new Size.
Definition
size.h:42
TagParser::Size::abbreviation
std::string_view abbreviation() const
Returns an abbreviation for the current instance, eg.
Definition
size.cpp:17
TagParser::Size::operator==
bool constexpr operator==(const Size &other) const
Returns whether this instance equals other.
Definition
size.h:108
global.h
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition
global.h:14
TagParser
Contains all classes and functions of the TagInfo library.
Definition
aaccodebook.h:10
Generated on
for Tag Parser by
1.18.0