Public Member Functions | Private Attributes | Friends | List of all members
ecl::Flags< Enum > Class Template Reference

Convenience class for organising boolean flags. More...

#include <flags.hpp>

Public Member Functions

void clear ()
 
 Flags ()
 
 Flags (const Flags< Enum > &other)
 
 Flags (Enum flag)
 
 operator int () const
 
Flags< Enum > operator& (int mask) const
 
Flags< Enum > operator& (Enum flag) const
 
Flags< Enum > & operator&= (int mask)
 
Flags< Enum > & operator= (const Flags< Enum > &other)
 
Flags< Enum > & operator= (const Enum &flag)
 
Flags< Enum > operator^ (Flags< Enum > other) const
 
Flags< Enum > operator^ (Enum flag) const
 
Flags< Enum > & operator^= (Flags< Enum > other)
 
Flags< Enum > & operator^= (Enum flag)
 
Flags< Enum > operator| (Flags< Enum > other) const
 
Flags< Enum > operator| (Enum flag) const
 
Flags< Enum > & operator|= (Flags< Enum > other)
 
Flags< Enum > & operator|= (Enum flag)
 
Flags< Enum > operator~ () const
 
bool testFlag (Enum flag) const
 
 ~Flags ()
 

Private Attributes

int value
 

Friends

Flags< Enum > operator| (Enum flag, Flags< Enum > flags)
 

Detailed Description

template<typename Enum>
class ecl::Flags< Enum >

Convenience class for organising boolean flags.

This class organises a group of flags (via enums) in a convenient and typesafe manner. It is essentially a container for flags (in the form of enums) with a convenient interface on top.

Usage:

enum Settings {
Fast 0x0001,
Medium 0x0002,
Slow 0x0004,
Red 0x0010,
Blue 0x0020
}
settings = settings|Fast|Slow;

Definition at line 65 of file flags.hpp.

Constructor & Destructor Documentation

template<typename Enum>
ecl::Flags< Enum >::Flags ( )
inline

Definition at line 71 of file flags.hpp.

template<typename Enum>
ecl::Flags< Enum >::Flags ( const Flags< Enum > &  other)
inline

Default constructor.

Definition at line 72 of file flags.hpp.

template<typename Enum>
ecl::Flags< Enum >::Flags ( Enum  flag)
inline

Copy constructor.

Definition at line 73 of file flags.hpp.

template<typename Enum>
ecl::Flags< Enum >::~Flags ( )
inline

Raw constructor.

Definition at line 74 of file flags.hpp.

Member Function Documentation

template<typename Enum>
void ecl::Flags< Enum >::clear ( )
inline

Clear all flags.

Definition at line 80 of file flags.hpp.

template<typename Enum>
ecl::Flags< Enum >::operator int ( ) const
inline

Definition at line 104 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator& ( int  mask) const
inline

Type compatibility with ints. Mask operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 117 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator& ( Enum  flag) const
inline

Single flag masking operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 128 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator&= ( int  mask)
inline

Self operating mask.

Returns
Flags<Enum> : updated instance of the masked flag set.

Definition at line 218 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator= ( const Flags< Enum > &  other)
inline

Assignment operator.

Returns
Flags<Enum> : updated instance of the flag set.

Definition at line 198 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator= ( const Enum &  flag)
inline

Assignment operator.

Returns
Flags<Enum> : updated instance of the flag set.

Definition at line 208 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator^ ( Flags< Enum >  other) const
inline

XOR operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 161 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator^ ( Enum  flag) const
inline

Single flag XOR operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 172 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator^= ( Flags< Enum >  other)
inline

Self operating XOR operation.

Returns
Flags<Enum> : updated instance of the masked flag set.

Definition at line 248 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator^= ( Enum  flag)
inline

Self operating XOR operation with a single flag.

Returns
Flags<Enum> : updated instance of the masked flag set.

Definition at line 258 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator| ( Flags< Enum >  other) const
inline

OR operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 139 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator| ( Enum  flag) const
inline

Single flag OR operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 150 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator|= ( Flags< Enum >  other)
inline

Self operating OR operation.

Returns
Flags<Enum> : updated instance of the masked flag set.

Definition at line 228 of file flags.hpp.

template<typename Enum>
Flags<Enum>& ecl::Flags< Enum >::operator|= ( Enum  flag)
inline

Self operating OR operation with a single flag.

Returns
Flags<Enum> : updated instance of the masked flag set.

Definition at line 238 of file flags.hpp.

template<typename Enum>
Flags<Enum> ecl::Flags< Enum >::operator~ ( ) const
inline

Complement operator.

Returns
Flags<Enum> : new instance of the flag set.

Definition at line 183 of file flags.hpp.

template<typename Enum>
bool ecl::Flags< Enum >::testFlag ( Enum  flag) const
inline

Test current status of a flag.

Definition at line 84 of file flags.hpp.

Friends And Related Function Documentation

template<typename Enum>
Flags<Enum> operator| ( Enum  flag,
Flags< Enum >  flags 
)
friend

Adding a flag (OR operation) to an existing flag set.

Returns
Flags<Enum> : resulting instance of the flag combination.

Definition at line 272 of file flags.hpp.

Member Data Documentation

template<typename Enum>
int ecl::Flags< Enum >::value
private

Definition at line 277 of file flags.hpp.


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


ecl_utilities
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:28