8 #include "Arp/System/Core/TypeName.hxx"
9 #include "Arp/System/Core/Exception.hpp"
11 #include <type_traits>
21 template<
class T =
void>
27 using U =
typename std::underlying_type<T>::type;
35 static const T Zero =
static_cast<T
>(0);
60 static bool TryParse(
const char* input, T& result);
75 T GetValue(
void)
const;
110 operator T(
void)
const;
147 return this->GetValue();
153 this->value =
static_cast<T
>(
static_cast<U
>(this->value) &
static_cast<U
>(rhs.value));
160 this->value =
static_cast<T
>(
static_cast<U
>(this->value) |
static_cast<U
>(rhs.value));
173 return static_cast<U
>(this->value);
179 std::ostringstream oss;
181 if (oss.fail() && throwIfInvalid)
204 std::istringstream iss(input);
263 return os << value.GetValue();
319 return lhs.GetValue() == rhs.GetValue();
329 return lhs.GetValue() < rhs.GetValue();
339 return lhs.GetValue() > rhs.GetValue();
349 return lhs.GetValue() <= rhs.GetValue();
359 return lhs.GetValue() >= rhs.GetValue();
372 return lhs.GetValue() == rhs;
382 return lhs.GetValue() < rhs;
392 return lhs.GetValue() > rhs;
402 return lhs.GetValue() <= rhs;
412 return lhs.GetValue() >= rhs;
425 return lhs == rhs.GetValue();
435 return lhs < rhs.GetValue();
445 return lhs > rhs.GetValue();
455 return lhs <= rhs.GetValue();
465 return lhs >= rhs.GetValue();
Adapter class for enums to make them loggable and parsable from e.g. XML files.
Definition: Enum.hxx:23
Enum & operator=(const Enum &rhs)=default
The default assignment operator.
T Value
The adapted enum class type.
Definition: Enum.hxx:26
This is the base class of all Arp exception classes.
Definition: Exception.hpp:16
This (meta programming) class provides the C++ typename of the as template argument passed type.
Definition: TypeName.hxx:56
U ToUnderlyingType(void) const
Converts this instance to the underlying type of its adapted enum type
Definition: Enum.hxx:171
Enum< T > operator|(Enum< T > lhs, Enum< T > rhs)
Bitwise Or operator for class Enum.
Definition: Enum.hxx:290
String ToString(bool throwIfInvalid=true) const
Converts this instance to its string representation.
Definition: Enum.hxx:177
static bool TryParse(const String &input, Enum &result)
Tries to parse the given input string.
Definition: Enum.hxx:195
Enum< T > make_enum(T value)
Global make function to adapt any enum class by class Enum.
Definition: Enum.hxx:124
Enum & operator|=(Enum rhs)
The assignment OR operator.
Definition: Enum.hxx:158
static Enum Parse(const String &input)
Parses the given input string.
Definition: Enum.hxx:228
Enum< T > operator&(Enum< T > lhs, Enum< T > rhs)
Bitwise And operator for class Enum.
Definition: Enum.hxx:302
Enum & operator&=(Enum rhs)
The assignment AND operator.
Definition: Enum.hxx:151
Enum(Value val=Zero)
Constructs an instace of Enum with the given value.
Definition: Enum.hxx:132
std::ostream & operator<<(std::ostream &os, const BasicString< CharType, Alloc > &right)
Streams the right string to the outstream os .
Definition: BasicString.hxx:1708
const CharType * CStr() const
Gets the character data of this string.
Definition: BasicString.hxx:1508
bool operator<=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2020
bool operator>(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1984
bool operator<(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1948
bool operator>=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2056
std::istream & operator>>(std::istream &is, BasicString< CharType, Alloc > &right)
Streams the instream is into the right string.
Definition: BasicString.hxx:1719
bool operator==(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on equality.
Definition: BasicString.hxx:1876
Root namespace for the PLCnext API