Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Static Public Member Functions | Friends | List of all members
castor::LengthT< TypeT > Class Template Reference

Length helper class. More...

#include <Length.hpp>

Public Member Functions

 LengthT (LengthUnit unit=LengthUnit::eMetre) noexcept
 Default constructor.
 
TypeT unit (LengthUnit u) const noexcept
 
TypeT kilometres () const noexcept
 
TypeT metres () const noexcept
 
TypeT centimetres () const noexcept
 
TypeT millimetres () const noexcept
 
TypeT yards () const noexcept
 
TypeT feet () const noexcept
 
TypeT inches () const noexcept
 
void kilometres (double value) noexcept
 
void metres (double value) noexcept
 
void centimetres (double value) noexcept
 
void millimetres (double value) noexcept
 
void yards (double value) noexcept
 
void feet (double value) noexcept
 
void inches (double value) noexcept
 
 operator TypeT const & () const noexcept
 
TypeT const & value () const noexcept
 
TypeT & operator* () noexcept
 
LengthUnit lengthUnit () const noexcept
 
Arithmetic operators.
LengthT< TypeT > & operator= (TypeT const &rhs) noexcept
 
LengthT< TypeT > & operator- () noexcept
 
LengthT< TypeT > & operator+= (LengthT< TypeT > const &rhs) noexcept
 
LengthT< TypeT > & operator-= (LengthT< TypeT > const &rhs) noexcept
 
LengthT< TypeT > & operator+= (TypeT const &rhs) noexcept
 
LengthT< TypeT > & operator-= (TypeT const &rhs) noexcept
 
LengthT< TypeT > & operator*= (double rhs) noexcept
 
LengthT< TypeT > & operator/= (double rhs) noexcept
 

Static Public Member Functions

template<typename TypeU >
static LengthT< TypeT > fromUnit (TypeU value, LengthUnit unit) noexcept
 Named constructor, expressed in the specified unit.
 
template<typename TypeU >
static LengthT< TypeT > fromKilometres (TypeU value) noexcept
 Named constructor, from kilometres.
 
template<typename TypeU >
static LengthT< TypeT > fromMetres (TypeU value) noexcept
 Named constructor, from metres.
 
template<typename TypeU >
static LengthT< TypeT > fromCentimetres (TypeU value) noexcept
 Named constructor, from centimetres.
 
template<typename TypeU >
static LengthT< TypeT > fromMillimetres (TypeU value) noexcept
 Named constructor, from millimetres.
 
template<typename TypeU >
static LengthT< TypeT > fromYards (TypeU value) noexcept
 Named constructor, from yards.
 
template<typename TypeU >
static LengthT< TypeT > fromFeet (TypeU value) noexcept
 Named constructor, from feet.
 
template<typename TypeU >
static LengthT< TypeT > fromInches (TypeU value) noexcept
 Named constructor, from inches.
 

Friends

template<typename TypeU >
bool operator== (LengthT< TypeU > const &lhs, LengthT< TypeU > const &rhs) noexcept
 
template<typename TypeU >
bool operator< (LengthT< TypeU > const &lhs, LengthT< TypeU > const &rhs) noexcept
 
template<typename TypeU >
bool operator> (LengthT< TypeU > const &lhs, LengthT< TypeU > const &rhs) noexcept
 

Detailed Description

template<typename TypeT>
class castor::LengthT< TypeT >

Length helper class.

Remarks
Handles length units conversions.

Constructor & Destructor Documentation

◆ LengthT()

template<typename TypeT >
castor::LengthT< TypeT >::LengthT ( LengthUnit unit = LengthUnit::eMetre)
explicitnoexcept

Default constructor.

Member Function Documentation

◆ centimetres() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::centimetres ( ) const
noexcept
Returns
The value converted to centimetres.

◆ centimetres() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::centimetres ( double value)
noexcept
Parameters
[in]valueLength expressed in centimetres.

◆ feet() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::feet ( ) const
noexcept
Returns
The value converted to feet.

◆ feet() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::feet ( double value)
noexcept
Parameters
[in]valueLength expressed in feet.

◆ fromCentimetres()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromCentimetres ( TypeU value)
inlinestaticnoexcept

Named constructor, from centimetres.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eCentimetre, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromFeet()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromFeet ( TypeU value)
inlinestaticnoexcept

Named constructor, from feet.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eFoot, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromInches()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromInches ( TypeU value)
inlinestaticnoexcept

Named constructor, from inches.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eInch, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromKilometres()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromKilometres ( TypeU value)
inlinestaticnoexcept

Named constructor, from kilometres.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eKilometre, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromMetres()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromMetres ( TypeU value)
inlinestaticnoexcept

Named constructor, from metres.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eMetre, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromMillimetres()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromMillimetres ( TypeU value)
inlinestaticnoexcept

Named constructor, from millimetres.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eMillimetre, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromUnit()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromUnit ( TypeU value,
LengthUnit unit )
inlinestaticnoexcept

Named constructor, expressed in the specified unit.

Parameters
[in]valueThe value.
[in]unitThe length unit.
Returns
The length.

References castor::LengthT< TypeT >::unit(), and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ fromYards()

template<typename TypeT >
template<typename TypeU >
static LengthT< TypeT > castor::LengthT< TypeT >::fromYards ( TypeU value)
inlinestaticnoexcept

Named constructor, from yards.

Parameters
[in]valueThe value.
Returns
The length.

References castor::eYard, and castor::LengthT< TypeT >::value().

Here is the call graph for this function:

◆ inches() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::inches ( ) const
noexcept
Returns
The value converted to inches.

◆ inches() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::inches ( double value)
noexcept
Parameters
[in]valueLength expressed in inches.

◆ kilometres() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::kilometres ( ) const
noexcept
Returns
The value converted to kilometres.

◆ kilometres() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::kilometres ( double value)
noexcept
Parameters
[in]valueLength expressed in kilometres.

◆ lengthUnit()

template<typename TypeT >
LengthUnit castor::LengthT< TypeT >::lengthUnit ( ) const
inlinenoexcept

◆ metres() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::metres ( ) const
noexcept
Returns
The value converted to metres.

◆ metres() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::metres ( double value)
noexcept
Parameters
[in]valueLength expressed in metres.

◆ millimetres() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::millimetres ( ) const
noexcept
Returns
The value converted to millimetres.

◆ millimetres() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::millimetres ( double value)
noexcept
Parameters
[in]valueLength expressed in millimetres.

◆ operator TypeT const &()

template<typename TypeT >
castor::LengthT< TypeT >::operator TypeT const & ( ) const
inlineexplicitnoexcept
Returns
The length value, in its own unit.

◆ operator*()

template<typename TypeT >
TypeT & castor::LengthT< TypeT >::operator* ( )
inlinenoexcept

◆ operator*=()

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator*= ( double rhs)
noexcept

◆ operator+=() [1/2]

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator+= ( LengthT< TypeT > const & rhs)
noexcept

◆ operator+=() [2/2]

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator+= ( TypeT const & rhs)
noexcept

◆ operator-()

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator- ( )
noexcept

◆ operator-=() [1/2]

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator-= ( LengthT< TypeT > const & rhs)
noexcept

◆ operator-=() [2/2]

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator-= ( TypeT const & rhs)
noexcept

◆ operator/=()

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator/= ( double rhs)
noexcept

◆ operator=()

template<typename TypeT >
LengthT< TypeT > & castor::LengthT< TypeT >::operator= ( TypeT const & rhs)
noexcept

◆ unit()

template<typename TypeT >
TypeT castor::LengthT< TypeT >::unit ( LengthUnit u) const
noexcept
Returns
The value converted to given unit.

Referenced by castor::LengthT< TypeT >::fromUnit().

Here is the caller graph for this function:

◆ value()

template<typename TypeT >
TypeT const & castor::LengthT< TypeT >::value ( ) const
inlinenoexcept

◆ yards() [1/2]

template<typename TypeT >
TypeT castor::LengthT< TypeT >::yards ( ) const
noexcept
Returns
The value converted to yards.

◆ yards() [2/2]

template<typename TypeT >
void castor::LengthT< TypeT >::yards ( double value)
noexcept
Parameters
[in]valueLength expressed in yards.

Friends And Related Symbol Documentation

◆ operator<

template<typename TypeT >
template<typename TypeU >
bool operator< ( LengthT< TypeU > const & lhs,
LengthT< TypeU > const & rhs )
friend

◆ operator==

template<typename TypeT >
template<typename TypeU >
bool operator== ( LengthT< TypeU > const & lhs,
LengthT< TypeU > const & rhs )
friend

◆ operator>

template<typename TypeT >
template<typename TypeU >
bool operator> ( LengthT< TypeU > const & lhs,
LengthT< TypeU > const & rhs )
friend

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