Tag Parser  6.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
margin.h
Go to the documentation of this file.
1 #ifndef MARGIN_H
2 #define MARGIN_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 Margin(uint32 top = 0, uint32 left = 0, uint32 bottom = 0, uint32 right = 0);
20  constexpr uint32 top() const;
21  void setTop(uint32 top);
22  constexpr uint32 left() const;
23  void setLeft(uint32 left);
24  constexpr uint32 bottom() const;
25  void setBottom(uint32 bottom);
26  constexpr uint32 right() const;
27  void setRight(uint32 right);
28  constexpr bool isNull() const;
29  std::string toString() const;
30 
31 private:
32  uint32 m_top;
33  uint32 m_left;
34  uint32 m_bottom;
35  uint32 m_right;
36 };
37 
41 constexpr Margin::Margin(uint32 top, uint32 left, uint32 bottom, uint32 right) :
42  m_top(top),
43  m_left(left),
44  m_bottom(bottom),
45  m_right(right)
46 {}
47 
51 constexpr uint32 Margin::top() const
52 {
53  return m_top;
54 }
55 
59 inline void Margin::setTop(uint32 top)
60 {
61  m_top = top;
62 }
63 
67 constexpr uint32 Margin::left() const
68 {
69  return m_left;
70 }
71 
75 inline void Margin::setLeft(uint32 left)
76 {
77  m_left = left;
78 }
79 
83 constexpr uint32 Margin::bottom() const
84 {
85  return m_bottom;
86 }
87 
91 inline void Margin::setBottom(uint32 bottom)
92 {
93  m_bottom = bottom;
94 }
95 
99 constexpr uint32 Margin::right() const
100 {
101  return m_right;
102 }
103 
107 inline void Margin::setRight(uint32 right)
108 {
109  m_right = right;
110 }
111 
115 constexpr bool Margin::isNull() const
116 {
117  return m_top == 0 && m_left == 0 && m_bottom == 0 && m_right == 0;
118 }
119 
123 inline std::string Margin::toString() const
124 {
125  return ConversionUtilities::argsToString("top: ", m_top, "; left: ", m_left, "; bottom: ", m_bottom, "; right: ", m_right);
126 }
127 
128 }
129 
130 #endif // MARGIN_H
void setBottom(uint32 bottom)
Sets the bottom margin to bottom.
Definition: margin.h:91
constexpr uint32 left() const
Returns the left margin.
Definition: margin.h:67
void setRight(uint32 right)
Sets the right margin to right.
Definition: margin.h:107
constexpr uint32 right() const
Returns the right margin.
Definition: margin.h:99
constexpr bool isNull() const
Returns true if all margins are is 0; otherwise returns false;.
Definition: margin.h:115
constexpr Margin(uint32 top=0, uint32 left=0, uint32 bottom=0, uint32 right=0)
Constructs a Margin.
Definition: margin.h:41
void setTop(uint32 top)
Sets the top margin to top.
Definition: margin.h:59
void setLeft(uint32 left)
Sets the left margin to left.
Definition: margin.h:75
constexpr uint32 top() const
Returns the top margin.
Definition: margin.h:51
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
std::string toString() const
Returns a string representation of the margin.
Definition: margin.h:123
constexpr uint32 bottom() const
Returns the bottom margin.
Definition: margin.h:83
The Margin class defines the four margins of a rectangle.
Definition: margin.h:16