ecl::Flags< Enum > Class Template Reference
Convenience class for organising boolean flags.
More...
#include <flags.hpp>
List of all members.
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:
- Define an appropriate bit-arithmetic enum.
enum Settings {
Fast 0x0001,
Medium 0x0002,
Slow 0x0004,
Red 0x0010,
Blue 0x0020
}
settings = settings|Fast|Slow;
- Set up a friend operator on the enum type for more convenient piping (see the dox).
- Use one of the variety of mask/compliment/access operators for handling (see method documentation).
Definition at line 65 of file flags.hpp.
Constructor & Destructor Documentation
Default constructor.
Definition at line 72 of file flags.hpp.
Copy constructor.
Definition at line 73 of file flags.hpp.
Raw constructor.
Definition at line 74 of file flags.hpp.
Member Function Documentation
Clear all flags.
Definition at line 80 of file flags.hpp.
template<typename Enum>
ecl::Flags< Enum >::operator int |
( |
|
) |
const [inline] |
Single flag masking operator.
- Returns:
- Flags<Enum> : new instance of the flag set.
Definition at line 128 of file flags.hpp.
Type compatibility with ints. Mask operator.
- Returns:
- Flags<Enum> : new instance of the flag set.
Definition at line 117 of file flags.hpp.
Self operating mask.
- Returns:
- Flags<Enum> : updated instance of the masked flag set.
Definition at line 218 of file flags.hpp.
Assignment operator.
- Returns:
- Flags<Enum> : updated instance of the flag set.
Definition at line 208 of file flags.hpp.
Assignment operator.
- Returns:
- Flags<Enum> : updated instance of the flag set.
Definition at line 198 of file flags.hpp.
Single flag XOR operator.
- Returns:
- Flags<Enum> : new instance of the flag set.
Definition at line 172 of file flags.hpp.
XOR operator.
- Returns:
- Flags<Enum> : new instance of the flag set.
Definition at line 161 of file flags.hpp.
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.
Self operating XOR operation.
- Returns:
- Flags<Enum> : updated instance of the masked flag set.
Definition at line 248 of file flags.hpp.
Single flag OR operator.
- Returns:
- Flags<Enum> : new instance of the flag set.
Definition at line 150 of file flags.hpp.
OR operator.
- Returns:
- Flags<Enum> : new instance of the flag set.
Definition at line 139 of file flags.hpp.
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.
Self operating OR operation.
- Returns:
- Flags<Enum> : updated instance of the masked flag set.
Definition at line 228 of file flags.hpp.
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
The documentation for this class was generated from the following file: