Uranus  1.0.1.0
Uranus is a GameEngine written in C++
Loading...
Searching...
No Matches
tson::EnumValue Class Reference
Collaboration diagram for tson::EnumValue:
[legend]

Public Member Functions

 EnumValue (const std::string &value, EnumDefinition *definition)
 
 EnumValue (uint32_t value, EnumDefinition *definition)
 
bool containsValueName (const std::string &value) const
 
EnumDefinitiongetDefinition () const
 
uint32_t getValue () const
 
std::string getValueName () const
 
std::vector< std::string > getValueNames () const
 
template<typename T >
bool hasAnyFlag (T flags) const
 
bool hasAnyFlagValue (uint32_t flags) const
 
template<typename T >
bool hasFlag (T flags) const
 
bool hasFlagValue (uint32_t flag) const
 

Private Attributes

EnumDefinitionm_definition = nullptr
 
uint32_t m_value {0}
 

Member Function Documentation

◆ containsValueName()

bool tson::EnumValue::containsValueName ( const std::string &  value) const
inline
Parameters
value
Returns

◆ getValueName()

std::string tson::EnumValue::getValueName ( ) const
inline

Gets the single name of a value. This function is intended for enums that can only have one value (non-flag). If you want to get several value names (flags), use getValueNames() instead.

Returns
A single name for a value

◆ hasAnyFlag()

template<typename T >
bool tson::EnumValue::hasAnyFlag ( flags) const
inline

Checks if T value contains one of several possible flags. If 'valuesAsFlags' is not a part of the EnumDefinition, a simple equality comparison will be done instead.

Template Parameters
TA uint32_t compatible type
Parameters
flagsOne or more flags you want to verify is included.
Returns
true is all flags presented are set. false otherwise.

◆ hasAnyFlagValue()

bool tson::EnumValue::hasAnyFlagValue ( uint32_t  flags) const
inline

Checks if uint32 value contains one of several possible flags. If 'valuesAsFlags' is not a part of the EnumDefinition, a simple equality comparison will be done instead.

Parameters
flagsThe uint32 values of the flags you want to check
Returns
'true' if EnumValue has the requested bits activated. 'false' otherwise.

◆ hasFlag()

template<typename T >
bool tson::EnumValue::hasFlag ( flags) const
inline

Checks if T value contains a single flag. If 'valuesAsFlags' is not a part of the EnumDefinition, a simple equality comparison will be done instead.

Template Parameters
TA uint32_t compatible type
Parameters
flagsOne or more flags you want to verify is included.
Returns
true is all flags presented are set. false otherwise.

◆ hasFlagValue()

bool tson::EnumValue::hasFlagValue ( uint32_t  flags) const
inline

Checks if uint32 value contains a single flag. If 'valuesAsFlags' is not a part of the EnumDefinition, a simple equality comparison will be done instead.

Parameters
flagsThe uint32 value of the flag you want to check
Returns
'true' if EnumValue has the requested bit activated. 'false' otherwise.

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