Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
12namespace TagParser {
13
18public:
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
34private:
35 std::uint32_t m_width;
36 std::uint32_t m_height;
37};
38
42constexpr Size::Size()
43 : m_width(0)
44 , m_height(0)
45{
46}
47
51constexpr Size::Size(std::uint32_t width, std::uint32_t height)
52 : m_width(width)
53 , m_height(height)
54{
55}
56
60constexpr std::uint32_t Size::width() const
61{
62 return m_width;
63}
64
68constexpr std::uint32_t Size::height() const
69{
70 return m_height;
71}
72
76inline void Size::setWidth(std::uint32_t value)
77{
78 m_width = value;
79}
80
84inline void Size::setHeight(std::uint32_t value)
85{
86 m_height = value;
87}
88
92constexpr std::uint32_t Size::resolution() const
93{
94 return m_width * m_height;
95}
96
100constexpr bool Size::isNull() const
101{
102 return (m_width == 0) && (m_height == 0);
103}
104
108constexpr bool Size::operator==(const Size &other) const
109{
110 return (m_width == other.m_width) && (m_height == other.m_height);
111}
112
117constexpr bool Size::operator>=(const Size &other) const
118{
119 return (m_width >= other.m_width) && (m_height >= other.m_height);
120}
121
125inline 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
The Size class defines the size of a two-dimensional object using integer point precision.
Definition size.h:17
constexpr std::uint32_t height() const
Returns the height.
Definition size.h:68
void setWidth(std::uint32_t value)
Sets the width.
Definition size.h:76
constexpr std::uint32_t width() const
Returns the width.
Definition size.h:60
bool constexpr isNull() const
Returns an indication whether both the width and height is 0.
Definition size.h:100
std::string toString() const
Returns the string representation of the current size.
Definition size.h:125
constexpr std::uint32_t resolution() const
Returns the resolution of the current instance (product of with and height).
Definition size.h:92
bool constexpr operator>=(const Size &other) const
Returns whether this instance is greater than other.
Definition size.h:117
void setHeight(std::uint32_t value)
Sets the height.
Definition size.h:84
constexpr Size()
Constructs a new Size.
Definition size.h:42
bool constexpr operator==(const Size &other) const
Returns whether this instance equals other.
Definition size.h:108
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
constexpr bool operator>=(MatroskaElementLevel lhs, MatroskaElementLevel rhs)
Definition matroskaid.h:447
constexpr bool operator==(std::uint8_t lhs, FlacMetaDataBlockType type)