2.10.0
Freundlich's C++ toolkit
Public Types | Public Member Functions | Static Public Member Functions
fcppt::container::bitfield::object< ElementType, NumElements, InternalType > Class Template Reference

Detailed Description

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

A statically sized bitfield.

Template Parameters
ElementTypeAn integral or enumeration type.
NumElementsAn integral constant wrapper specifying the number of bits.
InternalTypeThe internal storage type. Must be unsigned. This is fcppt::container::bitfield::default_internal_type by default.

See the module description for more information.

Public Types

typedef fcppt::container::bitfield::array< NumElements, InternalType > array_type
 The internal array type. More...
 
typedef fcppt::container::array::size< array_type >::type array_size
 The size of the underlying array. More...
 
typedef ElementType element_type
 Typedef to ElementType. More...
 
typedef NumElements::value_type size_type
 The size type which is taken from NumElements. More...
 
typedef fcppt::container::bitfield::value_type value_type
 The value type, which is bool. More...
 
typedef NumElements static_size
 Typedef to NumElements. More...
 
typedef InternalType internal_type
 Typedef to the internal storage type (template parameter InternalType More...
 
typedef fcppt::container::bitfield::proxy< array_typereference
 A type denoting a reference to a mask value (a reference to a boolean, basically). More...
 
typedef fcppt::container::bitfield::proxy< array_type const > const_reference
 A type denoting a const reference to a mask value (a reference to a boolean, basically). More...
 
typedef std::initializer_list< ElementType > initializer_list_type
 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 NumElements, typename InternalType>
typedef fcppt::container::array::size< array_type >::type fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::array_size

The size of the underlying array.

◆ array_type

template<typename ElementType, typename NumElements, typename InternalType>
typedef fcppt::container::bitfield::array< NumElements, InternalType > fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::array_type

The internal array type.

◆ const_reference

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

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 NumElements, typename InternalType>
typedef ElementType fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::element_type

Typedef to ElementType.

◆ initializer_list_type

template<typename ElementType, typename NumElements, typename InternalType>
typedef std::initializer_list< ElementType > fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::initializer_list_type

Initializer list type used to initialize a bitfield.

◆ internal_type

template<typename ElementType, typename NumElements, typename InternalType>
typedef InternalType fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::internal_type

Typedef to the internal storage type (template parameter InternalType

◆ reference

template<typename ElementType, typename NumElements, typename InternalType>
typedef fcppt::container::bitfield::proxy< array_type > fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::reference

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 NumElements, typename InternalType>
typedef NumElements::value_type fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::size_type

The size type which is taken from NumElements.

◆ static_size

template<typename ElementType, typename NumElements, typename InternalType>
typedef NumElements fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::static_size

Typedef to NumElements.

◆ value_type

template<typename ElementType, typename NumElements, typename InternalType>
typedef fcppt::container::bitfield::value_type fcppt::container::bitfield::object< ElementType, NumElements, InternalType >::value_type

The value type, which is bool.

Constructor & Destructor Documentation

◆ object() [1/3]

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

Constructs an uninitialized bitfield.

◆ object() [2/3]

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

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

◆ object() [3/3]

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

Constructs a bitfield from its internal array type.

Member Function Documentation

◆ array() [1/2]

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

Accessor to the internal array.

◆ array() [2/2]

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

Const accessor to the internal array.

◆ get()

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

Returns if the specified bit is set.

◆ null()

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

Returns the bitfield with all bits set to zero.

◆ operator[]() [1/2]

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

Returns a const reference to the specified bit.

◆ operator[]() [2/2]

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

Returns a reference to the specified bit.

◆ set()

template<typename ElementType, typename NumElements, typename InternalType>
void fcppt::container::bitfield::object< ElementType, NumElements, 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.