CVB++ 15.1
Loading...
Searching...
No Matches
Size2D< T, ENABLE > Class Template Referencefinal

Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle. More...

#include <cvb/size_2d.hpp>

Public Member Functions

 Size2D () noexcept=default
 Creates a default, empty size.
 
 Size2D (T width, T height) noexcept
 Creates a size with a given width and height.
 
T Width () const noexcept
 Gets the horizontal component of the size.
 
void SetWidth (T width) noexcept
 Sets the horizontal component of the size.
 
T Height () const noexcept
 Gets the vertical component of the size.
 
void SetHeight (T height) noexcept
 Sets the vertical component of the size.
 
bool operator== (const Size2D< T > &size) const noexcept
 Compares to an other size.
 
bool operator!= (const Size2D< T > &size) const noexcept
 Compares to an other size.
 
template<class C>
 operator Size2D< C > () const noexcept
 Enable casting.
 

Detailed Description

template<class T, class ENABLE = void>
class Cvb::Size2D< T, ENABLE >

Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle.

Template Parameters
TThe type of the numbers which is an integer or a floating-point number.

Constructor & Destructor Documentation

◆ Size2D() [1/2]

template<class T, class ENABLE = void>
Size2D ( )
defaultnoexcept

Creates a default, empty size.

Exceptions
Doesnot throw any exception.

◆ Size2D() [2/2]

template<class T, class ENABLE = void>
Size2D ( T width,
T height )
inlinenoexcept

Creates a size with a given width and height.

Parameters
[in]widthHorizontal component of the size.
[in]heightVertical component of the size.
Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ Height()

template<class T, class ENABLE = void>
T Height ( ) const
inlinenoexcept

Gets the vertical component of the size.

Returns
The vertical component.
Exceptions
Doesnot throw any exception.

◆ operator!=()

template<class T, class ENABLE = void>
bool operator!= ( const Size2D< T > & size) const
inlinenoexcept

Compares to an other size.

Parameters
[in]sizeOther size.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator==()

template<class T, class ENABLE = void>
bool operator== ( const Size2D< T > & size) const
inlinenoexcept

Compares to an other size.

Parameters
[in]sizeOther size.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ SetHeight()

template<class T, class ENABLE = void>
void SetHeight ( T height)
inlinenoexcept

Sets the vertical component of the size.

Parameters
[in]heightThe vertical component.
Exceptions
Doesnot throw any exception.

◆ SetWidth()

template<class T, class ENABLE = void>
void SetWidth ( T width)
inlinenoexcept

Sets the horizontal component of the size.

Parameters
[in]widthThe horizontal component.
Exceptions
Doesnot throw any exception.

◆ Width()

template<class T, class ENABLE = void>
T Width ( ) const
inlinenoexcept

Gets the horizontal component of the size.

Returns
The horizontal component.
Exceptions
Doesnot throw any exception.