SOIL Enum Datatype.
More...
#include <Enum.h>
C++ class to represent the SOIL Enum datatype. Internally it is based on strings.
Definition at line 13 of file Enum.h.
◆ Enum() [1/3]
Standard constructor which leaves everything uninitialized.
Definition at line 4 of file Enum.cpp.
◆ Enum() [2/3]
Enum::Enum |
( |
std::string |
value | ) |
|
Constructor that initializes the enumeration with a selected value.
- Todo:
- Check whether this constructor is still meaningful in future releases. Usage is not recommended.
- Parameters
-
[in] | value | Value for initialization |
Definition at line 8 of file Enum.cpp.
◆ Enum() [3/3]
Enum::Enum |
( |
std::string |
value, |
|
|
std::vector< std::string > |
choices |
|
) |
| |
Constructor that initializes the enumeration with choices and a value.
- Parameters
-
[in] | value | Value for initialization |
[in] | choices | Applicable set of choices for the enumeration |
Definition at line 12 of file Enum.cpp.
◆ ~Enum()
Standard destructor without special efforts.
Definition at line 17 of file Enum.cpp.
◆ choices()
std::vector< std::string > Enum::choices |
( |
void |
| ) |
|
Get the choices that are available for this enumeration.
- Returns
- Available choices as vector of strings
Definition at line 26 of file Enum.cpp.
◆ index() [1/2]
int Enum::index |
( |
| ) |
const |
Traversed the vector of choices and return the index of the current element.
- Returns
- Index of the selected element
Definition at line 31 of file Enum.cpp.
◆ index() [2/2]
int Enum::index |
( |
std::string |
value | ) |
const |
Converts a string value to its integer value. This function is useful when interacting with C++ ENUMs consisting of integers.
- Exceptions
-
std::logic_error | If the value is not found, an exception is thrown. |
- Parameters
-
- Returns
- Index of the searched value
Definition at line 43 of file Enum.cpp.
◆ selected()
std::string Enum::selected |
( |
void |
| ) |
const |
Get the value that the enum currently holds as selected.
- Returns
- Current value
Definition at line 21 of file Enum.cpp.
◆ set() [1/2]
void Enum::set |
( |
int |
value | ) |
|
Set the currently selected item the enumeration holds based on its integer index.
- Exceptions
-
std::logic_error | If the index exceeds the number of choices, an exception is thrown. |
- Parameters
-
[in] | value | Index of the value to set |
Definition at line 55 of file Enum.cpp.
◆ set() [2/2]
void Enum::set |
( |
std::string |
value | ) |
|
Set the currently selected item the enumeration holds based on a string value.
- Exceptions
-
std::logic_error | If the value is not among the choices, an exception is thrown. |
- Parameters
-
Definition at line 67 of file Enum.cpp.
The documentation for this class was generated from the following files: