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

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

#include <Enum.hxx>

Public Types

using Value = T
 The adapted enum class type. More...
 
using U = typename std::underlying_type< T >::type
 

Public Member Functions

 Enum (Value val=Zero)
 Constructs an instace of Enum with the given value. More...
 
GetValue (void) const
 
ToUnderlyingType (void) const
 Converts this instance to the underlying type of its adapted enum type More...
 
String ToString (bool throwIfInvalid=true) const
 Converts this instance to its string representation. More...
 
Enumoperator= (const Enum &rhs)=default
 The default assignment operator. More...
 
Enumoperator= (Value rhs)
 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...
 
 operator T (void) const
 Converts this instance implicitely to the value of its adapted type 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 const T Zero = static_cast<T>(0)
 

Detailed Description

template<class T = void>
class Arp::Enum< T >

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

Template Parameters
TThe type of the enum.

Member Typedef Documentation

◆ Value

template<class T = void>
using Arp::Enum< T >::Value = T

The adapted enum class type.

Member Function Documentation

◆ operator=()

template<class T = void>
Enum& Arp::Enum< T >::operator= ( const Enum< T > &  rhs)
default

The default assignment operator.

Parameters
rhsThe value to assign to this instance.
Returns
This instance as reference.

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