liblcf
EnumTags< E, N > Class Template Reference

#include <enum_tags.h>

+ Collaboration diagram for EnumTags< E, N >:

Public Types

using int_type = typename std::make_signed< typename std::underlying_type< E >::type >::type
 
using iterator = char const *const *
 
using reverse_iterator = std::reverse_iterator< iterator >
 

Public Member Functions

template<size_t... LN>
constexpr EnumTags (const char(&...literals)[LN])
 
constexpr const char * tag (E etag) const
 
constexpr const char * tag (int_type idx) const
 
constexpr const char * operator[] (E etag) const
 
constexpr const char * operator[] (int_type idx) const
 
bool etag (const char *tag, E &result) const
 
etagOr (const char *tag, E other) const
 
int_type idx (const char *tag) const
 
const std::array< const char *, num_tags > & tags () const
 
constexpr iterator begin () const
 
constexpr iterator end () const
 
constexpr iterator cbegin () const
 
constexpr iterator cend () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 

Static Public Member Functions

static constexpr size_t size ()
 

Static Public Attributes

static constexpr size_t num_tags = N
 

Private Attributes

const std::array< const char *, num_tags_tags
 

Detailed Description

template<typename E, size_t N>
class EnumTags< E, N >

Definition at line 20 of file enum_tags.h.

Member Typedef Documentation

◆ int_type

template<typename E , size_t N>
using EnumTags< E, N >::int_type = typename std::make_signed<typename std::underlying_type<E>::type>::type

Definition at line 23 of file enum_tags.h.

◆ iterator

template<typename E , size_t N>
using EnumTags< E, N >::iterator = char const * const *

Definition at line 24 of file enum_tags.h.

◆ reverse_iterator

template<typename E , size_t N>
using EnumTags< E, N >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 25 of file enum_tags.h.

Constructor & Destructor Documentation

◆ EnumTags()

template<typename E , size_t N>
template<size_t... LN>
constexpr EnumTags< E, N >::EnumTags ( const   char(&...literals)[LN])
inlineexplicitconstexpr

Definition at line 28 of file enum_tags.h.

Member Function Documentation

◆ begin()

template<typename E , size_t N>
constexpr iterator EnumTags< E, N >::begin ( ) const
inlineconstexpr

Definition at line 42 of file enum_tags.h.

References EnumTags< E, N >::_tags.

Referenced by EnumTags< E, N >::cbegin(), and EnumTags< E, N >::rend().

+ Here is the caller graph for this function:

◆ cbegin()

template<typename E , size_t N>
constexpr iterator EnumTags< E, N >::cbegin ( ) const
inlineconstexpr

Definition at line 45 of file enum_tags.h.

References EnumTags< E, N >::begin().

+ Here is the call graph for this function:

◆ cend()

template<typename E , size_t N>
constexpr iterator EnumTags< E, N >::cend ( ) const
inlineconstexpr

Definition at line 46 of file enum_tags.h.

References EnumTags< E, N >::end().

+ Here is the call graph for this function:

◆ end()

template<typename E , size_t N>
constexpr iterator EnumTags< E, N >::end ( ) const
inlineconstexpr

Definition at line 43 of file enum_tags.h.

References EnumTags< E, N >::_tags, and EnumTags< E, N >::size().

Referenced by EnumTags< E, N >::cend(), and EnumTags< E, N >::rbegin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ etag()

template<typename E , size_t N>
bool EnumTags< E, N >::etag ( const char *  tag,
E &  result 
) const
inline

Definition at line 73 of file enum_tags.h.

Referenced by EnumTags< E, N >::operator[](), and EnumTags< E, N >::tag().

+ Here is the caller graph for this function:

◆ etagOr()

template<typename E , size_t N>
E EnumTags< E, N >::etagOr ( const char *  tag,
other 
) const
inline

Definition at line 83 of file enum_tags.h.

◆ idx()

template<typename E , size_t N>
EnumTags< E, N >::int_type EnumTags< E, N >::idx ( const char *  tag) const
inline

Definition at line 63 of file enum_tags.h.

Referenced by EnumTags< E, N >::operator[](), and EnumTags< E, N >::tag().

+ Here is the caller graph for this function:

◆ operator[]() [1/2]

template<typename E , size_t N>
constexpr const char* EnumTags< E, N >::operator[] ( etag) const
inlineconstexpr

Definition at line 33 of file enum_tags.h.

References EnumTags< E, N >::etag(), and EnumTags< E, N >::tag().

+ Here is the call graph for this function:

◆ operator[]() [2/2]

template<typename E , size_t N>
constexpr const char* EnumTags< E, N >::operator[] ( int_type  idx) const
inlineconstexpr

Definition at line 34 of file enum_tags.h.

References EnumTags< E, N >::idx(), and EnumTags< E, N >::tag().

+ Here is the call graph for this function:

◆ rbegin()

template<typename E , size_t N>
reverse_iterator EnumTags< E, N >::rbegin ( ) const
inline

Definition at line 48 of file enum_tags.h.

References EnumTags< E, N >::end().

+ Here is the call graph for this function:

◆ rend()

template<typename E , size_t N>
reverse_iterator EnumTags< E, N >::rend ( ) const
inline

Definition at line 49 of file enum_tags.h.

References EnumTags< E, N >::begin().

+ Here is the call graph for this function:

◆ size()

template<typename E , size_t N>
static constexpr size_t EnumTags< E, N >::size ( )
inlinestaticconstexpr

Definition at line 51 of file enum_tags.h.

References EnumTags< E, N >::num_tags.

Referenced by EnumTags< E, N >::end().

+ Here is the caller graph for this function:

◆ tag() [1/2]

template<typename E , size_t N>
constexpr const char* EnumTags< E, N >::tag ( etag) const
inlineconstexpr

Definition at line 30 of file enum_tags.h.

References EnumTags< E, N >::etag(), and EnumTags< E, N >::tag().

Referenced by EnumTags< E, N >::operator[](), and EnumTags< E, N >::tag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tag() [2/2]

template<typename E , size_t N>
constexpr const char* EnumTags< E, N >::tag ( int_type  idx) const
inlineconstexpr

Definition at line 31 of file enum_tags.h.

References EnumTags< E, N >::_tags, and EnumTags< E, N >::idx().

+ Here is the call graph for this function:

◆ tags()

template<typename E , size_t N>
const std::array<const char*, num_tags>& EnumTags< E, N >::tags ( ) const
inline

Definition at line 40 of file enum_tags.h.

References EnumTags< E, N >::_tags.

Member Data Documentation

◆ _tags

template<typename E , size_t N>
const std::array<const char*, num_tags> EnumTags< E, N >::_tags
private

◆ num_tags

template<typename E , size_t N>
constexpr size_t EnumTags< E, N >::num_tags = N
staticconstexpr

Definition at line 22 of file enum_tags.h.

Referenced by EnumTags< E, N >::size().


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