23 using Fields = std::map<T, const char*>;
24 using InitializerList = std::initializer_list<typename Fields::value_type>;
25 using U =
typename std::underlying_type<T>::type;
49 static const T zeroValue =
static_cast<T
>(0);
61EnumDictionaryBase<T>::EnumDictionaryBase(
const char* invalidValueString,
const InitializerList& fields)
63 , invalidValueString(invalidValueString)
71 typename Fields::const_iterator i = this->fields.find(value);
72 if (i == this->fields.end())
84 for (
const auto& item : this->fields)
86 if (::strcmp(item.second, fieldName) == 0)
The class implements an adapter for enums to define the string literals of the enum entries.
Definition: EnumDictionaryBase.hxx:21
bool TryGetEnumValueInternal(const char *fieldName, T &value) const
Tries to get the enum value of the specified string.
Definition: EnumDictionaryBase.hxx:82
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.
Definition: EnumDictionaryBase.hxx:68
Root namespace for the PLCnext API