PLCnext API Documentation 25.0.2.69
|
This class implements an adapter for enums to define the string literals of the enum entries. More...
#include <EnumDictionaryBase.hxx>
Protected Member Functions | |
EnumDictionaryBase (const InitializerList &fields) | |
Constructor passing the enum fields as initializer list. More... | |
EnumDictionaryBase (const char *invalidValueString, const InitializerList &fields) | |
Constructor passing the enum fields as initializer list. More... | |
EnumDictionaryBase (const EnumDictionaryBase &arg) | |
Copy constructor. | |
EnumDictionaryBase (EnumDictionaryBase &&arg) noexcept | |
Move constructor. | |
EnumDictionaryBase & | operator= (const EnumDictionaryBase &arg) |
Copy-assignment operator. | |
EnumDictionaryBase & | operator= (EnumDictionaryBase &&arg) noexcept |
Move-assignment operator. | |
~EnumDictionaryBase (void) | |
Destructor. | |
bool | TryGetEnumStringInternal (T value, const char *&pResult) const |
Returns the string of the specified enum value or nullptr if the value could not be found. More... | |
bool | TryGetEnumValueInternal (const char *fieldName, T &value) const |
Tries to get the enum value of the specified string. More... | |
Protected Attributes | |
Fields | fields |
String | invalidValueString |
Static Protected Attributes | |
static const T | zeroValue = static_cast<T>(0) |
This class implements an adapter for enums to define the string literals of the enum entries.
T | The type of the enum. |
This is a helper class to make enums parsable and loggable or formattable, respectively.
|
inlineexplicitprotected |
Constructor passing the enum fields as initializer list.
fields | The enum fields as value string pairs. |
|
inlineprotected |
Constructor passing the enum fields as initializer list.
fields | The enum fields as value string pairs. |
invalidValueString | A string which is used for formatting an invalid enum value. |
|
inlineprotected |
Returns the string of the specified enum value or nullptr
if the value could not be found.
value | The enum value of enum T to get the associated string from. |
pResult | The string of the as argument passed enum value or nullptr if it could not be found. |
true
on success, otherwise false
.
|
inlineprotected |
Tries to get the enum value of the specified string.
fieldName | The string to get the associated enum value from. |
value | The resulting enum value or T{} if it could not be found. |
true
on success, otherwise false
.