PLCnext API Documentation  21.0.0.35466
Static Public Member Functions | Friends | List of all members
Arp::EnumStrings< T > Class Template Reference

The class implements an adapter for enums to define the string literals of the enum entries. More...

#include <EnumStrings.hxx>

Static Public Member Functions

static const char * GetEntry (T key)
 Returns the string of the specified enum entry. More...
 
static bool TryGetEntryValue (const char *name, T &value)
 Tries to return the enum entry of the specified string. More...
 

Friends

class Enum< T >
 
const char * GetEnumString (T key)
 This helper function returns the string of the specified enum entry. More...
 
bool TryGetEnumValue (const char *name, T &value)
 This helper function tries to return the enum entry of the specified string. More...
 

Detailed Description

template<class T>
class Arp::EnumStrings< T >

The class implements an adapter for enums to define the string literals of the enum entries.

Template Parameters
TThe type of the enum.

This is a helper class to make enums parsable and loggable/formattable. This helper class is specialied for any enum T defining its string literals using EnumStrings<Tgt;.

Member Function Documentation

◆ GetEntry()

template<class T >
const char * Arp::EnumStrings< T >::GetEntry ( key)
inlinestatic

Returns the string of the specified enum entry.

Parameters
keyThe enum entry of enmum T to get the associated string from.
Returns
The string literal of the as argument passed enum entry.

◆ TryGetEntryValue()

template<class T >
bool Arp::EnumStrings< T >::TryGetEntryValue ( const char *  name,
T &  value 
)
inlinestatic

Tries to return the enum entry of the specified string.

Parameters
nameThe string to get the associated enum entry of enum T from.
valueThe enum entry of enum T associated to the argument passed name .
Returns
true on success, otherwise false.

Friends And Related Function Documentation

◆ GetEnumString

template<class T >
const char* GetEnumString ( key)
friend

This helper function returns the string of the specified enum entry.

Template Parameters
TThe type of the enum.
Parameters
keyThe enum entry of enmum T to get the associated string from.
Returns
The string literal of the as argument passed enum entry.

◆ TryGetEnumValue

template<class T >
bool TryGetEnumValue ( const char *  name,
T &  value 
)
friend

This helper function tries to return the enum entry of the specified string.

Template Parameters
TThe type of the enum.
Parameters
nameThe string to get the associated enum entry of enum T from.
valueThe enum entry of enum T associated to the argument passed name .
Returns
true on success, otherwise false.

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