Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tson::EnumValue Class Reference

#include <TiledEnum.hpp>

Public Member Functions

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

Constructor & Destructor Documentation

◆ EnumValue() [1/3]

tson::EnumValue::EnumValue ( )
inlinedefault

◆ EnumValue() [2/3]

tson::EnumValue::EnumValue ( uint32_t  value,
EnumDefinition definition 
)
inline

◆ EnumValue() [3/3]

tson::EnumValue::EnumValue ( const std::string &  value,
EnumDefinition definition 
)
inline

Member Function Documentation

◆ containsValueName()

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

◆ getDefinition()

EnumDefinition * tson::EnumValue::getDefinition ( ) const
inline

◆ getValue()

uint32_t tson::EnumValue::getValue ( ) const
inline

◆ 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

◆ getValueNames()

std::vector< std::string > tson::EnumValue::getValueNames ( ) const
inline

◆ 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: