This class is used to manage flags. Don't forget to add OT_ADD_FLAG_FUNCTIONS and the bottom of your header. The type should be an enumeration where every value represents a single bit in a 32/64 bit value. e.g: enum enumName { enumValue1 = 0x01, // 0001 enumValue2 = 0x02, // 0010 enumValue3 = 0x04, // 0100 ... };. More...
#include "Flags.h"
Public Member Functions | |
| Flags () | |
| Data. | |
| Flags (T _initialData) | |
| Assignment constructor. | |
| Flags (const Flags< T > &_other) | |
| Copy constructor. | |
| T | data (void) const |
| Returns a copy of the data. | |
| void | set (T _data) |
| Replace the current data. | |
| void | setFlag (T _flag) |
| Set the provided flag. | |
| void | setFlag (T _flag, bool _flagIsSet) |
| Set or remove the provided flag. | |
| void | removeFlag (T _flag) |
| Remove the provided flag. | |
| bool | flagIsSet (T _flag) const |
| Returns true if the provided flag is set. | |
| operator T (void) const | |
| Operator T is used to assign the Flags to a enum variable with the same type that is managed by Flags. | |
| operator bool (void) const | |
| Returns true if at least one flag is set (assuming 0 = no flags). | |
| Flags< T > & | operator= (T _flag) |
| Flags< T > & | operator= (const Flags< T > &_other) |
| Flags< T > | operator| (T _flag) const |
| Flags< T > | operator| (const Flags< T > &_other) const |
| Flags< T > | operator& (T _flag) const |
| Flags< T > | operator& (const Flags< T > &_other) const |
| Flags< T > & | operator|= (T _flag) |
| Flags< T > & | operator|= (const Flags< T > &_other) |
| Flags< T > & | operator&= (T _flag) |
| Flags< T > & | operator&= (const Flags< T > &_other) |
| Flags< T > | operator~ (void) const |
| bool | operator== (T _flag) const |
| bool | operator== (const Flags< T > &_other) const |
| bool | operator!= (T _flag) const |
| bool | operator!= (const Flags< T > &_other) const |
This class is used to manage flags. Don't forget to add OT_ADD_FLAG_FUNCTIONS and the bottom of your header. The type should be an enumeration where every value represents a single bit in a 32/64 bit value. e.g: enum enumName { enumValue1 = 0x01, // 0001 enumValue2 = 0x02, // 0010 enumValue3 = 0x04, // 0100 ... };.
|
inline |
Data.
Default constructor. Initializes the data with 0.
|
inline |
Assignment constructor.
| _initialData | Initial data. |
Copy constructor.
| _other | Other flags. |
|
inline |
Returns a copy of the data.
|
inline |
Returns true if the provided flag is set.
| _flag | the flag that should be checked |
|
inline |
Returns true if at least one flag is set (assuming 0 = no flags).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Remove the provided flag.
| _flag | The flag to remove |
|
inline |
Replace the current data.
| _data | The data that should be replaced with |
|
inline |
Set the provided flag.
| _flag | The flag to set |
|
inline |
Set or remove the provided flag.
| _flag | The flag to set |
| _flagIsSet | If true the flag will be set, otherwise removed |