10namespace Arp {
namespace Base {
namespace Core
19 static_assert(std::is_enum_v<T>);
20 static_assert(std::is_integral_v<std::underlying_type_t<T>>);
23 using Fields = std::map<T, const char*>;
25 using U =
typename std::underlying_type<T>::type;
45 static const T zeroValue =
static_cast<T
>(0);
65 , invalidValueString(invalidValueString)
96 auto it = this->fields.find(value);
97 if (it == this->fields.end())
103 pResult = it->second;
114 auto it = std::find_if(this->fields.begin(), this->fields.end(), [fieldName](
const auto & each)
116 return ::strcmp(each.second, fieldName) == 0;
118 if (it == this->fields.end())
This class implements an adapter for enums to define the string literals of the enum entries.
Definition: EnumDictionaryBase.hxx:18
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:94
~EnumDictionaryBase(void)
Destructor.
EnumDictionaryBase & operator=(EnumDictionaryBase &&arg) noexcept
Move-assignment operator.
EnumDictionaryBase & operator=(const EnumDictionaryBase &arg)
Copy-assignment operator.
EnumDictionaryBase(const EnumDictionaryBase &arg)
Copy constructor.
std::map< T, const char * > Fields
The container type containing the value/name pairs of all enum fields.
Definition: EnumDictionaryBase.hxx:23
bool TryGetEnumValueInternal(const char *fieldName, T &value) const
Tries to get the enum value of the specified string.
Definition: EnumDictionaryBase.hxx:112
std::initializer_list< typename Fields::value_type > InitializerList
The initializer list type of the Fields container.
Definition: EnumDictionaryBase.hxx:24
typename std::underlying_type< T >::type U
The underlying integral type of the enum.
Definition: EnumDictionaryBase.hxx:25
EnumDictionaryBase(EnumDictionaryBase &&arg) noexcept
Move constructor.
EnumDictionaryBase(const InitializerList &fields)
Constructor passing the enum fields as initializer list.
Definition: EnumDictionaryBase.hxx:54
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
Root namespace for the PLCnext API