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

Public Member Functions

 CharTraitSet () noexcept
 Constructs the char trait set containing exactly the empty value. More...
 
 CharTraitSet (std::unique_ptr< CharIndexTraitSet > &refITS) noexcept
 
 CharTraitSet (std::unique_ptr< CharUcs4TraitSet > &refUTS) noexcept
 
 CharTraitSet (std::unique_ptr< CharIndexTraitSet > &&refITS) noexcept
 
 CharTraitSet (std::unique_ptr< CharUcs4TraitSet > &&refUTS) noexcept
 
 CharTraitSet (const std::vector< TileChar > &aTileChars) noexcept
 
 CharTraitSet (std::vector< TileChar > &&aTileChars) noexcept
 
CharTraitSetoperator= (CharTraitSet &&oSource) 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

◆ CharTraitSet() [1/7]

stmg::CharTraitSet::CharTraitSet ( )
noexcept

Constructs the char trait set containing exactly the empty value.

◆ CharTraitSet() [2/7]

stmg::CharTraitSet::CharTraitSet ( std::unique_ptr< CharIndexTraitSet > &  refITS)
explicitnoexcept

◆ CharTraitSet() [3/7]

stmg::CharTraitSet::CharTraitSet ( std::unique_ptr< CharUcs4TraitSet > &  refUTS)
explicitnoexcept

◆ CharTraitSet() [4/7]

stmg::CharTraitSet::CharTraitSet ( std::unique_ptr< CharIndexTraitSet > &&  refITS)
explicitnoexcept

◆ CharTraitSet() [5/7]

stmg::CharTraitSet::CharTraitSet ( std::unique_ptr< CharUcs4TraitSet > &&  refUTS)
explicitnoexcept

◆ CharTraitSet() [6/7]

stmg::CharTraitSet::CharTraitSet ( const std::vector< TileChar > &  aTileChars)
explicitnoexcept

◆ CharTraitSet() [7/7]

stmg::CharTraitSet::CharTraitSet ( std::vector< TileChar > &&  aTileChars)
explicitnoexcept

Member Function Documentation

◆ dump()

void stmg::CharTraitSet::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::CharTraitSet::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::CharTraitSet::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::CharTraitSet::hasEmptyValue ( ) const
finaloverridevirtualnoexcept

Whether the set contains the empty value.

Returns
Whether the set contains the empty value.

Implements stmg::TraitSet.

◆ operator=()

CharTraitSet& stmg::CharTraitSet::operator= ( CharTraitSet &&  oSource)
noexcept

◆ setTileTraitValueByIndex()

bool stmg::CharTraitSet::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.