4.3.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions
fcppt::container::bitfield::object< ElementType, InternalType > Class Template Reference

Detailed Description

template<typename ElementType, typename InternalType>
class fcppt::container::bitfield::object< ElementType, InternalType >

A statically sized bitfield.

Template Parameters
ElementTypeAn enumeration type.
InternalTypeThe internal storage type. Must be unsigned. This is fcppt::container::bitfield::default_internal_type by default.

See fcppt.container.bitfield for more information.

Public Types

using element_type = ElementType
 Typedef to ElementType. More...
 
using internal_type = InternalType
 Typedef to the internal storage type (template parameter InternalType More...
 
using static_size = fcppt::enum_::size< element_type >
 The number of elements. More...
 
using array_type = fcppt::container::bitfield::array< static_size, internal_type >
 The internal array type. More...
 
using array_size = fcppt::array::size< array_type >
 The size of the underlying array. More...
 
using size_type = typename static_size::value_type
 The size type which is taken from static_size. More...
 
using value_type = fcppt::container::bitfield::value_type
 The value type, which is bool. More...
 
using reference = fcppt::container::bitfield::proxy< array_type >
 A type denoting a reference to a mask value (a reference to a boolean, basically). More...
 
using const_reference = fcppt::container::bitfield::proxy< array_type const >
 A type denoting a const reference to a mask value (a reference to a boolean, basically). More...
 
using initializer_list_type = std::initializer_list< ElementType >
 Initializer list type used to initialize a bitfield. More...
 

Public Member Functions

 object (fcppt::no_init const &)
 Constructs an uninitialized bitfield. More...
 
 object (initializer_list_type const &)
 Constructs a bitfield using an initializer list, setting every bit from the list to true. More...
 
 object (array_type const &)
 Constructs a bitfield from its internal array type. More...
 
const_reference operator[] (ElementType) const
 Returns a const reference to the specified bit. More...
 
reference operator[] (ElementType)
 Returns a reference to the specified bit. More...
 
void set (ElementType where, value_type value)
 Sets the specified bit to true/false. More...
 
value_type get (ElementType) const
 Returns if the specified bit is set. More...
 
array_typearray ()
 Accessor to the internal array. More...
 
array_type const & array () const
 Const accessor to the internal array. More...
 

Static Public Member Functions

static object null ()
 Returns the bitfield with all bits set to zero. More...
 

Member Typedef Documentation

◆ array_size

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::array_size = fcppt::array::size<array_type>

The size of the underlying array.

◆ array_type

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::array_type = fcppt::container::bitfield::array<static_size, internal_type>

The internal array type.

◆ const_reference

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::const_reference = fcppt::container::bitfield::proxy<array_type const>

A type denoting a const reference to a mask value (a reference to a boolean, basically).

Note that this is not a bool nor an internal_type, but a proxy class.

◆ element_type

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::element_type = ElementType

Typedef to ElementType.

◆ initializer_list_type

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::initializer_list_type = std::initializer_list<ElementType>

Initializer list type used to initialize a bitfield.

◆ internal_type

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::internal_type = InternalType

Typedef to the internal storage type (template parameter InternalType

◆ reference

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::reference = fcppt::container::bitfield::proxy<array_type>

A type denoting a reference to a mask value (a reference to a boolean, basically).

Note that this is not a bool nor an internal_type, but a proxy class.

◆ size_type

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::size_type = typename static_size::value_type

The size type which is taken from static_size.

◆ static_size

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::static_size = fcppt::enum_::size<element_type>

The number of elements.

◆ value_type

template<typename ElementType , typename InternalType >
using fcppt::container::bitfield::object< ElementType, InternalType >::value_type = fcppt::container::bitfield::value_type

The value type, which is bool.

Constructor & Destructor Documentation

◆ object() [1/3]

template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType >::object ( fcppt::no_init const &  )
explicit

Constructs an uninitialized bitfield.

◆ object() [2/3]

template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType >::object ( initializer_list_type const &  )

Constructs a bitfield using an initializer list, setting every bit from the list to true.

◆ object() [3/3]

template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType >::object ( array_type const &  )
explicit

Constructs a bitfield from its internal array type.

Member Function Documentation

◆ array() [1/2]

template<typename ElementType , typename InternalType >
array_type & fcppt::container::bitfield::object< ElementType, InternalType >::array ( )

Accessor to the internal array.

◆ array() [2/2]

template<typename ElementType , typename InternalType >
array_type const & fcppt::container::bitfield::object< ElementType, InternalType >::array ( ) const

Const accessor to the internal array.

◆ get()

template<typename ElementType , typename InternalType >
value_type fcppt::container::bitfield::object< ElementType, InternalType >::get ( ElementType  ) const

Returns if the specified bit is set.

◆ null()

template<typename ElementType , typename InternalType >
static object fcppt::container::bitfield::object< ElementType, InternalType >::null ( )
static

Returns the bitfield with all bits set to zero.

◆ operator[]() [1/2]

template<typename ElementType , typename InternalType >
reference fcppt::container::bitfield::object< ElementType, InternalType >::operator[] ( ElementType  )

Returns a reference to the specified bit.

◆ operator[]() [2/2]

template<typename ElementType , typename InternalType >
const_reference fcppt::container::bitfield::object< ElementType, InternalType >::operator[] ( ElementType  ) const

Returns a const reference to the specified bit.

◆ set()

template<typename ElementType , typename InternalType >
void fcppt::container::bitfield::object< ElementType, InternalType >::set ( ElementType  where,
value_type  value 
)

Sets the specified bit to true/false.

Parameters
whereWhich bit to set.
valueThe value to set the bit to.