28namespace utility::graphic
35 template<
typename Type>
37 std::is_floating_point_v<Type> || std::is_integral_v<Type>;
48 template<CanBeSizeComponent SizeComponentType>
class Size
51 SizeComponentType _width;
52 SizeComponentType _height;
53 SizeComponentType _depth;
60 : _width(SizeComponentType { 0 })
61 , _height(SizeComponentType { 0 })
62 , _depth(SizeComponentType { 0 })
71 Size(SizeComponentType width, SizeComponentType height,
72 SizeComponentType depth = SizeComponentType { 0 })
125 const SizeComponentType &
getWidth(
void)
const noexcept
165 const SizeComponentType &
getDepth(
void)
const noexcept
177 return _width == other._width && _height == other._height
178 && _depth == other._depth;
188 return !(*
this == other);
198 if (_width != other._width) {
199 return _width < other._width;
201 if (_height != other._height) {
202 return _height < other._height;
211 using SizeF = Size<float>;
216 using SizeD = Size<double>;
221 using SizeI = Size<int>;
226 using SizeUI = Size<unsigned int>;
234 std::ostream &operator<<(std::ostream &stream,
const SizeF &size);
242 std::ostream &operator<<(std::ostream &stream,
const SizeD &size);
250 std::ostream &operator<<(std::ostream &stream,
const SizeI &size);
258 std::ostream &operator<<(std::ostream &stream,
const SizeUI &size);
Template class representing a size (width, height).
Size & setWidth(SizeComponentType width) noexcept
Set the width component.
Size & setHeight(SizeComponentType height) noexcept
Set the height component.
Size & operator=(const Size &other)=default
Copy assignment operator.
Size()
Default constructor (zero position, identity orientation).
Size(const Size &other)=default
Copy constructor.
bool operator<(const Size &other) const noexcept
Less-than comparison for ordering.
bool operator!=(const Size &other) const noexcept
Inequality comparison.
Size(Size &&other) noexcept=default
Move constructor.
const SizeComponentType & getWidth(void) const noexcept
Get the position component.
bool operator==(const Size &other) const noexcept
Equality comparison.
const SizeComponentType & getDepth(void) const noexcept
Get the depth component.
Size & operator=(Size &&other) noexcept=default
Move assignment operator.
Size & setDepth(SizeComponentType depth) noexcept
Set the depth component.
const SizeComponentType & getHeight(void) const noexcept
Get the height component.
Size(SizeComponentType width, SizeComponentType height, SizeComponentType depth=SizeComponentType { 0 })
Construct a size from width and height.
~Size(void)=default
Default destructor for Size.
Concept to constrain size component type.