stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::VariantSet Class Reference

Smallish set of variants. More...

Public Member Functions

 VariantSet () noexcept
 Constructs empty variant set. More...
 
 VariantSet (const Variant &oValue) noexcept
 Constructs variant set with one value. More...
 
 VariantSet (const Variant &oFromValue, const Variant &oToValue) noexcept
 Constructs variant set with ordered value range. More...
 
 VariantSet (const std::vector< Variant > &aValues) noexcept
 Constructs variant set with array of unsorted values. More...
 
 VariantSet (const std::vector< Variant > &aValues, bool bIsSorted) noexcept
 Constructs variant set with array of values. More...
 
 VariantSet (std::vector< Variant > &&aValues) noexcept
 Constructs variant set with array of unsorted values. More...
 
 VariantSet (std::vector< Variant > &&aValues, bool bIsSorted) noexcept
 Constructs variant set with array of values. More...
 
 VariantSet (const VariantSet &oSource) noexcept
 
 VariantSet (VariantSet &&oSource) noexcept
 
VariantSetoperator= (const VariantSet &oSource) noexcept
 
VariantSetoperator= (VariantSet &&oSource) noexcept
 
int32_t size () const noexcept
 The number of elements. More...
 
bool contains (const Variant &oValue) const noexcept
 The value is part of the set. More...
 
void dump (int32_t nIndentSpaces, bool bHeader) const noexcept
 

Detailed Description

Smallish set of variants.

Constructor & Destructor Documentation

◆ VariantSet() [1/9]

stmg::VariantSet::VariantSet ( )
inlinenoexcept

Constructs empty variant set.

◆ VariantSet() [2/9]

stmg::VariantSet::VariantSet ( const Variant oValue)
explicitnoexcept

Constructs variant set with one value.

Parameters
oValueThe value. Cannot be null.

◆ VariantSet() [3/9]

stmg::VariantSet::VariantSet ( const Variant oFromValue,
const Variant oToValue 
)
noexcept

Constructs variant set with ordered value range.

The two values must have same type and not be null. Parameter oFromValue can be > oToValue.

Parameters
oFromValueThe start value.
oToValueThe end value.

◆ VariantSet() [4/9]

stmg::VariantSet::VariantSet ( const std::vector< Variant > &  aValues)
explicitnoexcept

Constructs variant set with array of unsorted values.

If values are repeated they are ignored. All the values must have same type and not be null.

Parameters
aValuesThe values.

◆ VariantSet() [5/9]

stmg::VariantSet::VariantSet ( const std::vector< Variant > &  aValues,
bool  bIsSorted 
)
explicitnoexcept

Constructs variant set with array of values.

If values are repeated they are ignored. All the values must have same type and not be null.

Parameters
aValuesThe values.
bIsSortedWhether the values are already sorted.

◆ VariantSet() [6/9]

stmg::VariantSet::VariantSet ( std::vector< Variant > &&  aValues)
explicitnoexcept

Constructs variant set with array of unsorted values.

If values are repeated they are ignored. All the values must have same type and not be null.

Parameters
aValuesThe values.

◆ VariantSet() [7/9]

stmg::VariantSet::VariantSet ( std::vector< Variant > &&  aValues,
bool  bIsSorted 
)
explicitnoexcept

Constructs variant set with array of values.

If values are repeated they are ignored. All the values must have same type and not be null.

Parameters
aValuesThe values.
bIsSortedWhether the values are already sorted.

◆ VariantSet() [8/9]

stmg::VariantSet::VariantSet ( const VariantSet oSource)
inlinenoexcept

◆ VariantSet() [9/9]

stmg::VariantSet::VariantSet ( VariantSet &&  oSource)
inlinenoexcept

Member Function Documentation

◆ contains()

bool stmg::VariantSet::contains ( const Variant oValue) const
noexcept

The value is part of the set.

Parameters
oValueThe index. Must be >= 0 and < size().
Returns
Whether set contains the value.

◆ dump()

void stmg::VariantSet::dump ( int32_t  nIndentSpaces,
bool  bHeader 
) const
noexcept

◆ operator=() [1/2]

VariantSet& stmg::VariantSet::operator= ( const VariantSet oSource)
inlinenoexcept

◆ operator=() [2/2]

VariantSet& stmg::VariantSet::operator= ( VariantSet &&  oSource)
inlinenoexcept

◆ size()

int32_t stmg::VariantSet::size ( ) const
noexcept

The number of elements.

Returns
The size. Is non negative.