PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
Arp::Base::Core::Enum< T > Class Template Reference

Adapter class for enums to make them loggable and parsable from e.g. XML files. More...

#include <Enum.hxx>

Inheritance diagram for Arp::Base::Core::Enum< T >:
Inheritance graph

Public Types

using Value = T
 The adapted enum class type.
 
using U = typename std::underlying_type< T >::type
 The underlying integral type of the adapted enum class type.
 

Public Member Functions

 Enum (Value initialValue=Zero)
 Constructs an instance of Enum with the given value. More...
 
 operator T (void) const
 Converts this instance implicitly to the value of its adapted type
 
Enumoperator= (Value arg)
 The assignment operator for a value of the adapted type. More...
 
Enumoperator&= (Enum rhs)
 The assignment AND operator. More...
 
Enumoperator|= (Enum rhs)
 The assignment OR operator. More...
 
GetValue (void) const
 Gets the adapted enum value. More...
 
bool HasFlag (Value flag)
 Determines if this enum value has the supplied flag set. More...
 
bool HasAnyFlag (Value flags)
 Determines if this enum value has any of the the supplied flags set. More...
 
bool HasAllFlags (Value flags)
 Determines if this enum value has all of the supplied flag set. More...
 
U ToUnderlyingType (void) const
 Converts this instance to the underlying integral type of its adapted enum type More...
 
String ToString (bool throwIfInvalid=true) const
 Converts this instance to its string representation. More...
 

Static Public Member Functions

static bool TryParse (const String &input, Enum &result)
 Tries to parse the given input string. More...
 
static bool TryParse (const String &input, T &result)
 Tries to parse the given input string. More...
 
static bool TryParse (const char *input, Enum &result)
 Tries to parse the given input string. More...
 
static bool TryParse (const char *input, T &result)
 Tries to parse the given input string. More...
 
static Enum Parse (const String &input)
 Parses the given input string. More...
 
static Enum Parse (const char *input)
 Parses the given input string. More...
 

Static Public Attributes

static constexpr T Zero = static_cast<T>(0)
 Zero initialized Enum value.
 

Friends

std::ostream & operator<< (std::ostream &os, Enum arg)
 Makes the Enum class loggable and streamable. More...
 
std::istream & operator>> (std::istream &is, Enum &arg)
 Makes the Enum class parsable. More...
 
Enum operator| (Enum lhs, Enum rhs)
 Bitwise Or operator for class Enum. More...
 
Enum operator& (Enum lhs, Enum rhs)
 Bitwise And operator for class Enum. More...
 
bool operator== (Enum lhs, Enum rhs)
 Equality operator of class Enum. More...
 
bool operator< (Enum lhs, Enum rhs)
 Less operator for class Enum. More...
 
bool operator> (Enum lhs, Enum rhs)
 Greater operator for class Enum. More...
 
bool operator<= (Enum lhs, Enum rhs)
 Less or equal operator for class Enum. More...
 
bool operator>= (Enum lhs, Enum rhs)
 Greater or equal operator for class Enum. More...
 
bool operator== (Enum lhs, T rhs)
 Equality operator of class Enum. More...
 
bool operator< (Enum lhs, T rhs)
 Less operator for class Enum. More...
 
bool operator> (Enum lhs, T rhs)
 Greater operator for class Enum. More...
 
bool operator<= (Enum lhs, T rhs)
 Less or equal operator for class Enum. More...
 
bool operator>= (Enum lhs, T rhs)
 Greater or equal operator for class Enum. More...
 
bool operator== (T lhs, Enum rhs)
 Equality operator of class Enum. More...
 
bool operator< (T lhs, Enum rhs)
 Less operator for class Enum. More...
 
bool operator> (T lhs, Enum rhs)
 Greater operator for class Enum. More...
 
bool operator<= (T lhs, Enum rhs)
 Less or equal operator for class Enum. More...
 
bool operator>= (T lhs, Enum rhs)
 Greater or equal operator for class Enum. More...
 

Detailed Description

template<class T>
class Arp::Base::Core::Enum< T >

Adapter class for enums to make them loggable and parsable from e.g. XML files.

Template Parameters
TThe type of the enum.

Friends And Related Function Documentation

◆ operator&

template<class T >
Enum operator& ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Bitwise And operator for class Enum.

Parameters
lhsThe left argument to combine bitwise.
rhsThe right argument to combine bitwise.
Returns
The bitwise And combination of the arguments.

◆ operator< [1/3]

template<class T >
bool operator< ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Less operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is less than the right argument, otherwise false.

◆ operator< [2/3]

template<class T >
bool operator< ( Enum< T >  lhs,
rhs 
)
friend

Less operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is less than the right argument, otherwise false.

◆ operator< [3/3]

template<class T >
bool operator< ( lhs,
Enum< T >  rhs 
)
friend

Less operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is less than the right argument, otherwise false.

◆ operator<<

template<class T >
std::ostream & operator<< ( std::ostream &  os,
Enum< T >  arg 
)
friend

Makes the Enum class loggable and streamable.

Parameters
osThe stream to write the Enum string to.
argThe enum value to write.
Returns
The as argument passed stream.

◆ operator<= [1/3]

template<class T >
bool operator<= ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Less or equal operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is less or equal than the right argument, otherwise false.

◆ operator<= [2/3]

template<class T >
bool operator<= ( Enum< T >  lhs,
rhs 
)
friend

Less or equal operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is less or equal than the right argument, otherwise false.

◆ operator<= [3/3]

template<class T >
bool operator<= ( lhs,
Enum< T >  rhs 
)
friend

Less or equal operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is less or equal than the right argument, otherwise false.

◆ operator== [1/3]

template<class T >
bool operator== ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Equality operator of class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the arguments are equal, otherwise false.

◆ operator== [2/3]

template<class T >
bool operator== ( Enum< T >  lhs,
rhs 
)
friend

Equality operator of class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the arguments are equal, otherwise false.

◆ operator== [3/3]

template<class T >
bool operator== ( lhs,
Enum< T >  rhs 
)
friend

Equality operator of class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the arguments are equal, otherwise false.

◆ operator> [1/3]

template<class T >
bool operator> ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Greater operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is greater than the right argument, otherwise false.

◆ operator> [2/3]

template<class T >
bool operator> ( Enum< T >  lhs,
rhs 
)
friend

Greater operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is greater than the right argument, otherwise false.

◆ operator> [3/3]

template<class T >
bool operator> ( lhs,
Enum< T >  rhs 
)
friend

Greater operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is greater than the right argument, otherwise false.

◆ operator>= [1/3]

template<class T >
bool operator>= ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Greater or equal operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is greater or equal than the right argument, otherwise false.

◆ operator>= [2/3]

template<class T >
bool operator>= ( Enum< T >  lhs,
rhs 
)
friend

Greater or equal operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is greater or equal than the right argument, otherwise false.

◆ operator>= [3/3]

template<class T >
bool operator>= ( lhs,
Enum< T >  rhs 
)
friend

Greater or equal operator for class Enum.

Parameters
lhsThe left argument to compare.
rhsThe right argument to compare.
Returns
true if the left argument is greater or equal than the right argument, otherwise false.

◆ operator>>

template<class T >
std::istream & operator>> ( std::istream &  is,
Enum< T > &  arg 
)
friend

Makes the Enum class parsable.

Parameters
isThe stream to read the value from.
argThe resulting enum value.
Returns
The as argument passed stream.

◆ operator|

template<class T >
Enum operator| ( Enum< T >  lhs,
Enum< T >  rhs 
)
friend

Bitwise Or operator for class Enum.

Parameters
lhsThe left argument to combine bitwise.
rhsThe right argument to combine bitwise.
Returns
The bitwise Or combination of the arguments.

The documentation for this class was generated from the following files: