stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::ColorRgbTraitSet Class Referencefinal
Inheritance diagram for stmg::ColorRgbTraitSet:
Inheritance graph
[legend]

Public Member Functions

 ColorRgbTraitSet ()=delete
 
 ColorRgbTraitSet (const ColorRgbTraitSet &oSource)=default
 
 ColorRgbTraitSet (ColorRgbTraitSet &&oSource) noexcept=default
 
 ColorRgbTraitSet (const ColorRedTraitSet &oR, const ColorGreenTraitSet &oG, const ColorBlueTraitSet &oB) noexcept
 
 ColorRgbTraitSet (ColorRedTraitSet &&oR, ColorGreenTraitSet &&oG, ColorBlueTraitSet &&oB) noexcept
 
 ColorRgbTraitSet (const std::vector< std::tuple< uint8_t, uint8_t, uint8_t >> &aValues) noexcept
 
bool hasEmptyValue () const noexcept override final
 Whether the set contains the empty value. More...
 
int32_t getTotValues () const noexcept override final
 Get the total number of values in this tile trait indexed set. More...
 
bool setTileTraitValueByIndex (Tile &oTile, int32_t nIdx) const noexcept override final
 Sets the trait of a tile to the value identified by an index. More...
 
int32_t getIndexOfTileTraitValue (const Tile &oTile) const noexcept override final
 Gets the index of the value of the tile's trait in the set. More...
 
void dump (int32_t nIndentSpaces, bool bHeader) const noexcept override
 Dumps the trait set. More...
 
- Public Member Functions inherited from stmg::TraitSet
virtual ~TraitSet () noexcept=default
 

Constructor & Destructor Documentation

◆ ColorRgbTraitSet() [1/6]

stmg::ColorRgbTraitSet::ColorRgbTraitSet ( )
delete

◆ ColorRgbTraitSet() [2/6]

stmg::ColorRgbTraitSet::ColorRgbTraitSet ( const ColorRgbTraitSet oSource)
default

◆ ColorRgbTraitSet() [3/6]

stmg::ColorRgbTraitSet::ColorRgbTraitSet ( ColorRgbTraitSet &&  oSource)
defaultnoexcept

◆ ColorRgbTraitSet() [4/6]

stmg::ColorRgbTraitSet::ColorRgbTraitSet ( const ColorRedTraitSet oR,
const ColorGreenTraitSet oG,
const ColorBlueTraitSet oB 
)
noexcept

◆ ColorRgbTraitSet() [5/6]

stmg::ColorRgbTraitSet::ColorRgbTraitSet ( ColorRedTraitSet &&  oR,
ColorGreenTraitSet &&  oG,
ColorBlueTraitSet &&  oB 
)
noexcept

◆ ColorRgbTraitSet() [6/6]

stmg::ColorRgbTraitSet::ColorRgbTraitSet ( const std::vector< std::tuple< uint8_t, uint8_t, uint8_t >> &  aValues)
explicitnoexcept

Member Function Documentation

◆ dump()

void stmg::ColorRgbTraitSet::dump ( int32_t  nIndentSpaces,
bool  bHeader 
) const
overridevirtualnoexcept

Dumps the trait set.

This only works if NDEBUG macro is not defined.

Implements stmg::TraitSet.

◆ getIndexOfTileTraitValue()

int32_t stmg::ColorRgbTraitSet::getIndexOfTileTraitValue ( const Tile oTile) const
finaloverridevirtualnoexcept

Gets the index of the value of the tile's trait in the set.

If the tile's trait is empty and the set contains the empty value index -1 is returned.

Parameters
oTileThe tile the trait's value of which the index of is needed.
Returns
The index or -2 if trait value not in the trait set.

Implements stmg::TraitSet.

◆ getTotValues()

int32_t stmg::ColorRgbTraitSet::getTotValues ( ) const
finaloverridevirtualnoexcept

Get the total number of values in this tile trait indexed set.

The empty value, if present, is also counted.

Returns
The number of values. Is >= 0.

Implements stmg::TraitSet.

◆ hasEmptyValue()

bool stmg::ColorRgbTraitSet::hasEmptyValue ( ) const
finaloverridevirtualnoexcept

Whether the set contains the empty value.

Returns
Whether the set contains the empty value.

Implements stmg::TraitSet.

◆ setTileTraitValueByIndex()

bool stmg::ColorRgbTraitSet::setTileTraitValueByIndex ( Tile oTile,
int32_t  nIdx 
) const
finaloverridevirtualnoexcept

Sets the trait of a tile to the value identified by an index.

If the set contains the empty value the valid indexes are >=-1 and < (getTotValues()-1).

If the set doesn't contain the empty value the valid indexes are >=0 and < getTotValues().

If the -1 index is passed for a set without empty value, the tile is left untouched and false is returned, otherwise true is returned.

Parameters
oTileThe tile to modify.
nIdxThe index of the value in the set.
Returns
Whether the operation was successful.

Implements stmg::TraitSet.