Tag Parser  9.1.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 TAG_PARSER_MARGIN_H
2 #define TAG_PARSER_MARGIN_H
3 
4 #include "./global.h"
5 
6 #include <c++utilities/conversion/stringbuilder.h>
7 
8 #include <cstdint>
9 #include <string>
10 
11 namespace TagParser {
12 
17 public:
18  constexpr Margin(std::uint32_t top = 0, std::uint32_t left = 0, std::uint32_t bottom = 0, std::uint32_t right = 0);
19  constexpr std::uint32_t top() const;
20  void setTop(std::uint32_t top);
21  constexpr std::uint32_t left() const;
22  void setLeft(std::uint32_t left);
23  constexpr std::uint32_t bottom() const;
24  void setBottom(std::uint32_t bottom);
25  constexpr std::uint32_t right() const;
26  void setRight(std::uint32_t right);
27  constexpr bool isNull() const;
28  std::string toString() const;
29 
30 private:
31  std::uint32_t m_top;
32  std::uint32_t m_left;
33  std::uint32_t m_bottom;
34  std::uint32_t m_right;
35 };
36 
40 constexpr Margin::Margin(std::uint32_t top, std::uint32_t left, std::uint32_t bottom, std::uint32_t right)
41  : m_top(top)
42  , m_left(left)
43  , m_bottom(bottom)
44  , m_right(right)
45 {
46 }
47 
51 constexpr std::uint32_t Margin::top() const
52 {
53  return m_top;
54 }
55 
59 inline void Margin::setTop(std::uint32_t top)
60 {
61  m_top = top;
62 }
63 
67 constexpr std::uint32_t Margin::left() const
68 {
69  return m_left;
70 }
71 
75 inline void Margin::setLeft(std::uint32_t left)
76 {
77  m_left = left;
78 }
79 
83 constexpr std::uint32_t Margin::bottom() const
84 {
85  return m_bottom;
86 }
87 
91 inline void Margin::setBottom(std::uint32_t bottom)
92 {
93  m_bottom = bottom;
94 }
95 
99 constexpr std::uint32_t Margin::right() const
100 {
101  return m_right;
102 }
103 
107 inline void Margin::setRight(std::uint32_t 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 CppUtilities::argsToString("top: ", m_top, "; left: ", m_left, "; bottom: ", m_bottom, "; right: ", m_right);
126 }
127 
128 } // namespace TagParser
129 
130 #endif // TAG_PARSER_MARGIN_H
global.h
TagParser::Margin::setLeft
void setLeft(std::uint32_t left)
Sets the left margin to left.
Definition: margin.h:75
TagParser::Margin::bottom
constexpr std::uint32_t bottom() const
Returns the bottom margin.
Definition: margin.h:83
TagParser::Margin
The Margin class defines the four margins of a rectangle.
Definition: margin.h:16
TagParser::Margin::setBottom
void setBottom(std::uint32_t bottom)
Sets the bottom margin to bottom.
Definition: margin.h:91
TagParser
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
TagParser::Margin::setTop
void setTop(std::uint32_t top)
Sets the top margin to top.
Definition: margin.h:59
TagParser::Margin::left
constexpr std::uint32_t left() const
Returns the left margin.
Definition: margin.h:67
TagParser::Margin::isNull
constexpr bool isNull() const
Returns true if all margins are is 0; otherwise returns false;.
Definition: margin.h:115
TagParser::Margin::right
constexpr std::uint32_t right() const
Returns the right margin.
Definition: margin.h:99
TagParser::Margin::setRight
void setRight(std::uint32_t right)
Sets the right margin to right.
Definition: margin.h:107
TagParser::Margin::toString
std::string toString() const
Returns a string representation of the margin.
Definition: margin.h:123
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
TagParser::Margin::top
constexpr std::uint32_t top() const
Returns the top margin.
Definition: margin.h:51
TagParser::Margin::Margin
constexpr Margin(std::uint32_t top=0, std::uint32_t left=0, std::uint32_t bottom=0, std::uint32_t right=0)
Constructs a Margin.
Definition: margin.h:40