Tag Parser  6.3.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
size.h
Go to the documentation of this file.
1 #ifndef SIZE_H
2 #define SIZE_H
3 
4 #include "./global.h"
5 
6 #include <c++utilities/conversion/types.h>
7 #include <c++utilities/conversion/stringbuilder.h>
8 
9 #include <string>
10 
11 namespace Media {
12 
17 {
18 public:
19  constexpr Size();
20  constexpr Size(uint32 width, uint32 height);
21 
22  constexpr uint32 width() const;
23  constexpr uint32 height() const;
24  void setWidth(uint32 value);
25  void setHeight(uint32 value);
26 
27  bool constexpr isNull() const;
28  bool constexpr operator==(const Size &other) const;
29  std::string toString() const;
30 
31 private:
32  uint32 m_width;
33  uint32 m_height;
34 };
35 
39 constexpr Size::Size() :
40  m_width(0),
41  m_height(0)
42 {}
43 
47 constexpr Size::Size(uint32 width, uint32 height) :
48  m_width(width),
49  m_height(height)
50 {}
51 
55 inline constexpr uint32 Size::width() const
56 {
57  return m_width;
58 }
59 
63 inline constexpr uint32 Size::height() const
64 {
65  return m_height;
66 }
67 
71 inline void Size::setWidth(uint32 value)
72 {
73  m_width = value;
74 }
75 
79 inline void Size::setHeight(uint32 value)
80 {
81  m_height = value;
82 }
83 
87 inline constexpr bool Size::isNull() const
88 {
89  return (m_width == 0) && (m_height == 0);
90 }
91 
95 inline constexpr bool Size::operator==(const Size &other) const
96 {
97  return (m_width == other.m_width) && (m_height == other.m_height);
98 }
99 
103 inline std::string Size::toString() const
104 {
105  return ConversionUtilities::argsToString("width: ", m_width, ", height: ", m_height);
106 }
107 
108 }
109 
110 #endif // SIZE_H
constexpr uint32 width() const
Returns the width.
Definition: size.h:55
The Size class defines the size of a two-dimensional object using integer point precision.
Definition: size.h:16
void setWidth(uint32 value)
Sets the width.
Definition: size.h:71
constexpr uint32 height() const
Returns the height.
Definition: size.h:63
bool constexpr operator==(const Size &other) const
Returns whether this instance equals other.
Definition: size.h:95
bool constexpr isNull() const
Returns an indication whether both the width and height is 0.
Definition: size.h:87
constexpr Size()
Constructs a new Size.
Definition: size.h:39
void setHeight(uint32 value)
Sets the height.
Definition: size.h:79
constexpr bool operator==(byte lhs, FlacMetaDataBlockType type)
Definition: flacmetadata.h:28
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
std::string toString() const
Returns the string representation of the current size.
Definition: size.h:103
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.