Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
graphics::SizeType< DataType > Struct Template Referencefinal

A class that represents size in 2D space. More...

#include <Size.h>

Public Member Functions

SizeTypeoperator+= (SizeType rhs) noexcept
 
SizeTypeoperator-= (SizeType rhs) noexcept
 
SizeTypeoperator*= (SizeType rhs) noexcept
 
SizeTypeoperator/= (SizeType rhs) noexcept
 
template<typename ScaleType >
SizeTypeoperator*= (ScaleType scale) noexcept
 
template<typename ScaleType >
SizeTypeoperator/= (ScaleType scale) noexcept
 
SizeTypeoperator- () noexcept
 
bool IsZero () const noexcept
 Return true if both width and height are zero. More...
 

Public Attributes

DataType width {}
 Width. More...
 
DataType height {}
 Height. More...
 

Detailed Description

template<typename DataType>
struct graphics::SizeType< DataType >

A class that represents size in 2D space.

Definition at line 32 of file Size.h.

Member Function Documentation

◆ IsZero()

template<typename DataType >
bool graphics::SizeType< DataType >::IsZero ( ) const
inlinenoexcept

Return true if both width and height are zero.

Definition at line 98 of file Size.h.

99 {
100 return std::abs(width) <= std::numeric_limits<DataType>::epsilon() &&
101 std::abs(height) <= std::numeric_limits<DataType>::epsilon();
102 }
DataType height
Height.
Definition: Size.h:37
DataType width
Width.
Definition: Size.h:35

References graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

◆ operator*=() [1/2]

template<typename DataType >
template<typename ScaleType >
SizeType & graphics::SizeType< DataType >::operator*= ( ScaleType  scale)
inlinenoexcept

Definition at line 71 of file Size.h.

72 {
73 width = static_cast<DataType>(GetPositiveSizeValue(width * scale));
74 height = static_cast<DataType>(GetPositiveSizeValue(height * scale));
75
76 return *this;
77 }
constexpr DataType GetPositiveSizeValue(DataType value) noexcept
Definition: Size.h:21

References graphics::details::GetPositiveSizeValue(), graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

Here is the call graph for this function:

◆ operator*=() [2/2]

template<typename DataType >
SizeType & graphics::SizeType< DataType >::operator*= ( SizeType< DataType >  rhs)
inlinenoexcept

Definition at line 55 of file Size.h.

56 {
57 width = GetPositiveSizeValue(width * rhs.width);
58 height = GetPositiveSizeValue(height * rhs.height);
59
60 return *this;
61 }

References graphics::details::GetPositiveSizeValue(), graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

Here is the call graph for this function:

◆ operator+=()

template<typename DataType >
SizeType & graphics::SizeType< DataType >::operator+= ( SizeType< DataType >  rhs)
inlinenoexcept

Definition at line 39 of file Size.h.

40 {
41 width = GetPositiveSizeValue(width + rhs.width);
42 height = GetPositiveSizeValue(height + rhs.height);
43
44 return *this;
45 }

References graphics::details::GetPositiveSizeValue(), graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

Here is the call graph for this function:

◆ operator-()

template<typename DataType >
SizeType & graphics::SizeType< DataType >::operator- ( )
inlinenoexcept

Definition at line 87 of file Size.h.

88 {
89 static_assert(std::is_signed_v<DataType>);
90
91 width = -width;
92 height = -height;
93
94 return *this;
95 }

References graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

◆ operator-=()

template<typename DataType >
SizeType & graphics::SizeType< DataType >::operator-= ( SizeType< DataType >  rhs)
inlinenoexcept

Definition at line 47 of file Size.h.

48 {
49 width = GetPositiveSizeValue(width - rhs.width);
50 height = GetPositiveSizeValue(height - rhs.height);
51
52 return *this;
53 }

References graphics::details::GetPositiveSizeValue(), graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

Here is the call graph for this function:

◆ operator/=() [1/2]

template<typename DataType >
template<typename ScaleType >
SizeType & graphics::SizeType< DataType >::operator/= ( ScaleType  scale)
inlinenoexcept

Definition at line 79 of file Size.h.

80 {
81 width = static_cast<DataType>(GetPositiveSizeValue(width / scale));
82 height = static_cast<DataType>(GetPositiveSizeValue(height / scale));
83
84 return *this;
85 }

References graphics::details::GetPositiveSizeValue(), graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

Here is the call graph for this function:

◆ operator/=() [2/2]

template<typename DataType >
SizeType & graphics::SizeType< DataType >::operator/= ( SizeType< DataType >  rhs)
inlinenoexcept

Definition at line 63 of file Size.h.

64 {
65 width = GetPositiveSizeValue(width / rhs.width);
66 height = GetPositiveSizeValue(height / rhs.height);
67
68 return *this;
69 }

References graphics::details::GetPositiveSizeValue(), graphics::SizeType< DataType >::height, and graphics::SizeType< DataType >::width.

Here is the call graph for this function:

Member Data Documentation

◆ height

template<typename DataType >
DataType graphics::SizeType< DataType >::height {}

◆ width

template<typename DataType >
DataType graphics::SizeType< DataType >::width {}

The documentation for this struct was generated from the following file: