cppassist  1.0.0.f4fab4f962ff
C++ sanctuary for small but powerful and frequently required, stand alone features.
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cppassist::Flags< EnumType > Class Template Reference

#include <cppassist/include/cppassist/flags/Flags.h>

Public Types

using type = EnumType
 enum type More...
 
using underlying_type = typename std::underlying_type< EnumType >::type
 Underlying enum type. More...
 

Public Member Functions

 Flags ()
 Constructor. More...
 
 Flags (EnumType value)
 Constructor. More...
 
 Flags (std::initializer_list< EnumType > values)
 Constructor. More...
 
 operator bool () const
 Conversion to bool for explicit contexts. More...
 
 operator underlying_type () const
 Conversion to underlying type. More...
 

Protected Member Functions

 Flags (underlying_type value)
 Constructor. More...
 

Protected Attributes

underlying_type m_value
 The current value (a bit combination) More...
 

Member Typedef Documentation

◆ type

template<typename EnumType>
using cppassist::Flags< EnumType >::type = EnumType

enum type

◆ underlying_type

template<typename EnumType>
using cppassist::Flags< EnumType >::underlying_type = typename std::underlying_type<EnumType>::type

Underlying enum type.

Constructor & Destructor Documentation

◆ Flags() [1/4]

template<typename EnumType >
cppassist::Flags< EnumType >::Flags ( )

Constructor.

Creates an empty flag object

◆ Flags() [2/4]

template<typename EnumType >
cppassist::Flags< EnumType >::Flags ( EnumType  value)

Constructor.

Parameters
[in]valueThe initial value of the flags object

◆ Flags() [3/4]

template<typename EnumType >
cppassist::Flags< EnumType >::Flags ( std::initializer_list< EnumType >  values)

Constructor.

Parameters
[in]valuesThe initial values of the flags object

All values are 'or'-ed for the resulting value of the flags object

◆ Flags() [4/4]

template<typename EnumType >
cppassist::Flags< EnumType >::Flags ( underlying_type  value)
protected

Constructor.

Parameters
[in]valueThe value of the flags object

Member Function Documentation

◆ operator bool()

template<typename EnumType >
cppassist::Flags< EnumType >::operator bool ( ) const
explicit

Conversion to bool for explicit contexts.

Returns
true if at least one bit is set, else false

References cppassist::Flags< EnumType >::m_value.

◆ operator underlying_type()

template<typename EnumType >
cppassist::Flags< EnumType >::operator underlying_type ( ) const

Conversion to underlying type.

Returns
The internal value as underlying type

References cppassist::Flags< EnumType >::m_value.

Member Data Documentation

◆ m_value

template<typename EnumType>
underlying_type cppassist::Flags< EnumType >::m_value
protected

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