PLCnext API Documentation 23.6.0.37
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.
 
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...
 
T GetValue (void) const
 
U 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...
 
Enum & operator= (const Enum &rhs)=default
 The default assignment operator. More...
 
Enum & operator= (Value rhs)
 The assignment operator for a value of the adapted type. More...
 
Enum & operator&= (Enum rhs)
 The assignment AND operator. More...
 
Enum & operator|= (Enum rhs)
 The assignment OR operator. More...
 
 operator T (void) const
 Converts this instance implicitely to the value of its adapted type
 

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 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: