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

Public Member Functions

 IntOption (OwnerType eOwnerType, const std::string &sName, int32_t nDefaultValue, const std::string &sDesc, int32_t nMin, int32_t nMax) noexcept
 
 IntOption (OwnerType eOwnerType, const std::string &sName, int32_t nDefaultValue, const std::string &sDesc, bool bReadOnly, bool bVisible, const shared_ptr< Option > &refMaster, const std::vector< Variant > &aMasterValues, int32_t nMin, int32_t nMax) noexcept
 
 IntOption (OwnerType eOwnerType, const std::string &sName, int32_t nDefaultValue, const std::string &sDesc, bool bReadOnly, bool bVisible, const std::vector< std::pair< shared_ptr< Option >, std::vector< Variant >>> &aMastersValues, int32_t nMin, int32_t nMax) noexcept
 
bool isValidValue (const Variant &oValue) const noexcept override
 Whether the value is valid for this option. More...
 
std::string getValueAsCode (const Variant &oValue) const noexcept override
 Return a value as code. More...
 
std::pair< Variant, std::string > getValueFromCode (const std::string &sCode) const noexcept override
 Convert code to value. More...
 
std::string getValueAsDescriptive (const Variant &oValue) const noexcept override
 Return the value as a human readable string. More...
 
std::pair< Variant, std::string > getValueFromString (const std::string &sValue) const noexcept override
 Convert string to value. More...
 
bool allowsRange () const noexcept override
 Whether range of values is supported. More...
 
int32_t getMin () const noexcept
 
int32_t getMax () const noexcept
 
- Public Member Functions inherited from stmg::Option
OwnerType getOwnerType () const noexcept
 
const std::string & getName () const noexcept
 
Variant getDefaultValue () const noexcept
 
const std::string & getDesc () const noexcept
 
bool isReadonly () const noexcept
 
bool isVisible () const noexcept
 
const std::vector< std::pair< shared_ptr< Option >, std::vector< Variant > > > & getMastersValues () const noexcept
 Get the masters and their corresonding values for which this option is enabled. More...
 
bool isSlave () const noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from stmg::Option
virtual ~Option ()=default
 
 Option (OwnerType eOwnerType, const std::string &sName, const Variant &oDefaultValue, const std::string &sDesc) noexcept
 Constructor. More...
 
 Option (OwnerType eOwnerType, const std::string &sName, const Variant &oDefaultValue, const std::string &sDesc, bool bReadOnly, bool bVisible, const shared_ptr< Option > &refMaster, const std::vector< Variant > &aMasterValues) noexcept
 One master constructor. More...
 
 Option (OwnerType eOwnerType, const std::string &sName, const Variant &oDefaultValue, const std::string &sDesc, bool bReadOnly, bool bVisible, const std::vector< std::pair< shared_ptr< Option >, std::vector< Variant >>> &aMastersValues) noexcept
 Generic constructor. More...
 

Constructor & Destructor Documentation

◆ IntOption() [1/3]

stmg::IntOption::IntOption ( OwnerType  eOwnerType,
const std::string &  sName,
int32_t  nDefaultValue,
const std::string &  sDesc,
int32_t  nMin,
int32_t  nMax 
)
noexcept

◆ IntOption() [2/3]

stmg::IntOption::IntOption ( OwnerType  eOwnerType,
const std::string &  sName,
int32_t  nDefaultValue,
const std::string &  sDesc,
bool  bReadOnly,
bool  bVisible,
const shared_ptr< Option > &  refMaster,
const std::vector< Variant > &  aMasterValues,
int32_t  nMin,
int32_t  nMax 
)
noexcept

◆ IntOption() [3/3]

stmg::IntOption::IntOption ( OwnerType  eOwnerType,
const std::string &  sName,
int32_t  nDefaultValue,
const std::string &  sDesc,
bool  bReadOnly,
bool  bVisible,
const std::vector< std::pair< shared_ptr< Option >, std::vector< Variant >>> &  aMastersValues,
int32_t  nMin,
int32_t  nMax 
)
noexcept

Member Function Documentation

◆ allowsRange()

bool stmg::IntOption::allowsRange ( ) const
inlineoverridevirtualnoexcept

Whether range of values is supported.

The default implementation returns false.

Returns
Whether it makes sense to take a range of the values.

Reimplemented from stmg::Option.

◆ getMax()

int32_t stmg::IntOption::getMax ( ) const
inlinenoexcept

◆ getMin()

int32_t stmg::IntOption::getMin ( ) const
inlinenoexcept

◆ getValueAsCode()

std::string stmg::IntOption::getValueAsCode ( const Variant oValue) const
overridevirtualnoexcept

Return a value as code.

Parameters
oValueThe value.
Returns
The code or empty string if invalid.

Implements stmg::Option.

◆ getValueAsDescriptive()

std::string stmg::IntOption::getValueAsDescriptive ( const Variant oValue) const
overridevirtualnoexcept

Return the value as a human readable string.

Parameters
oValueThe value.
Returns
The descriptive string or empty string if invalid.

Implements stmg::Option.

◆ getValueFromCode()

std::pair<Variant, std::string> stmg::IntOption::getValueFromCode ( const std::string &  sCode) const
overridevirtualnoexcept

Convert code to value.

Parameters
sCodeThe code.
Returns
The value and empty string or null and the error.

Implements stmg::Option.

◆ getValueFromString()

std::pair<Variant, std::string> stmg::IntOption::getValueFromString ( const std::string &  sValue) const
overridevirtualnoexcept

Convert string to value.

Parameters
sValueThe string representation. Cannot be empty.
Returns
The value and an empty string ot null and the error string.

Implements stmg::Option.

◆ isValidValue()

bool stmg::IntOption::isValidValue ( const Variant oValue) const
overridevirtualnoexcept

Whether the value is valid for this option.

Parameters
oValueThe value.
Returns
Whether valid.

Implements stmg::Option.