RedFlame v0.1.1
A high intensity flame eminating from software
Loading...
Searching...
No Matches
EnumChannelDirection Namespace Reference

Functions that operate on ChannelDirection enum. More...

Functions

ChannelDirection fromString (const std::string &s)
 
ChannelDirection fromUnsigned (unsigned v) noexcept
 
std::string toString (ChannelDirection d) noexcept
 
bool isConvertibleFrom (const std::string &s) noexcept
 
std::string listAsString ()
 

Variables

constexpr const std::array< ChannelDirection, 3 > enumerators
 

Detailed Description

Functions that operate on ChannelDirection enum.

This is a small namespace holding functions that only operate on ChannelDirection enum.

This is part of lib Codec.

Function Documentation

◆ fromString()

ChannelDirection EnumChannelDirection::fromString ( const std::string & s)

Convert ChannelDirection string to enum.

Parameters
[in]sThe channel's direction as a string. Matches against these strings "Forward", "Return", or "notapplicable". Matching is not sensitive to case.
Returns
Enum value.
Exceptions
std::invalid_argumentThrows for unrecognized strings. isConvertibleFrom() can be used if throw is not needed.

◆ fromUnsigned()

ChannelDirection EnumChannelDirection::fromUnsigned ( unsigned v)
noexcept

Convert to enum from unsigned integer.

Parameters
[in]vThe enum as an unsigned integer.
Returns
Enum value. Returns Invalid for an unrecognized conversion.

◆ isConvertibleFrom()

bool EnumChannelDirection::isConvertibleFrom ( const std::string & s)
noexcept

Determines if given string can convert to enum.

Parameters
[in]sThe string of interest.
Returns
True if convertible; false otherwise.

◆ listAsString()

std::string EnumChannelDirection::listAsString ( )

Returns a std::string of the enums separated by a space.

Returns
Returns a std::string of the enums separated by a space.

◆ toString()

std::string EnumChannelDirection::toString ( ChannelDirection d)
noexcept

Convert enum to string.

Parameters
[in]dThe enum of interest.
Returns
Enum as a string.

Variable Documentation

◆ enumerators

const std::array<ChannelDirection, 3> EnumChannelDirection::enumerators
constexpr
Initial value:
{
}
@ Forward
Traffic channel flows forward.
Definition EnumChannelDirection.h:24
@ NotApplicable
Direction doesn't apply, note this is valid.
Definition EnumChannelDirection.h:23
@ Return
Traffic channel flows return.
Definition EnumChannelDirection.h:25

Initialized array of enums for iterating.