GEOSX
Public Types | Static Public Member Functions | List of all members
geosx::EnumStrings< ENUM > Struct Template Reference

Provides enum <-> string conversion facilities. More...

#include <EnumStrings.hpp>

Public Types

using enum_type = ENUM
 Alias for the enumeration type.
 
using base_type = std::underlying_type_t< ENUM >
 Alias for enum's underlying fundamental type.
 

Static Public Member Functions

static auto const & get ()
 
static string concat (string const &delim=" ")
 Get a list of valid options as a delimited string. More...
 
static string toString (enum_type const &e)
 Convert enum to string. More...
 
static enum_type fromString (string const &s)
 Convert string to enum. More...
 

Detailed Description

template<typename ENUM>
struct geosx::EnumStrings< ENUM >

Provides enum <-> string conversion facilities.

Template Parameters
ENUMthe enumeration type

Definition at line 97 of file EnumStrings.hpp.

Member Function Documentation

◆ concat()

template<typename ENUM >
static string geosx::EnumStrings< ENUM >::concat ( string const &  delim = " ")
inlinestatic

Get a list of valid options as a delimited string.

Parameters
delimdelimiter (defaults to single space)
Returns
the string containing all valid strings for this type

Definition at line 118 of file EnumStrings.hpp.

◆ fromString()

template<typename ENUM >
static enum_type geosx::EnumStrings< ENUM >::fromString ( string const &  s)
inlinestatic

Convert string to enum.

Parameters
sthe string to convert
Returns
the corresponding enum value

Definition at line 146 of file EnumStrings.hpp.

◆ get()

template<typename ENUM >
static auto const& geosx::EnumStrings< ENUM >::get ( )
inlinestatic
Returns
An array of strings associated with enumeration.

Definition at line 108 of file EnumStrings.hpp.

◆ toString()

template<typename ENUM >
static string geosx::EnumStrings< ENUM >::toString ( enum_type const &  e)
inlinestatic

Convert enum to string.

Parameters
ethe enum value to convert
Returns
the corresponding string

An error is raised if enum's numerical value is greater of equal than the number of strings.

Definition at line 131 of file EnumStrings.hpp.


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