Bitwise
Bitwise
#include <icy/bitwise.h>struct BitwiseDefined in src/base/include/icy/bitwise.h:22
Container for smart management of bitwise integer flags.
List of all members
| Name | Kind | Owner |
|---|---|---|
data | variable | Declared here |
Bitwise | function | Declared here |
reset | function | Declared here |
set | function | Declared here |
add | function | Declared here |
remove | function | Declared here |
toggle | function | Declared here |
has | function | Declared here |
Public Attributes
| Return | Name | Description |
|---|---|---|
unsigned | data | Backing storage for the flag bits. |
data
unsigned dataDefined in src/base/include/icy/bitwise.h:24
Backing storage for the flag bits.
Public Methods
| Return | Name | Description |
|---|---|---|
Bitwise inline | Constructs a Bitwise with optional initial flags. | |
void | reset virtual inline | Clears all flags (sets data to 0). |
void | set virtual inline | Sets the given flag only if it is not already set. |
void | add virtual inline | Unconditionally sets (OR) the given flag bits. |
void | remove virtual inline | Clears the given flag bits. |
void | toggle virtual inline | Toggles (XOR) the given flag bits. |
bool | has virtual const inline | Returns true if all bits in flag are set. |
Bitwise
inline
inline Bitwise(unsigned flags = 0)Defined in src/base/include/icy/bitwise.h:28
Constructs a Bitwise with optional initial flags.
Parameters
flagsInitial flag value (default: 0).
reset
virtual inline
virtual inline void reset()Defined in src/base/include/icy/bitwise.h:34
Clears all flags (sets data to 0).
set
virtual inline
virtual inline void set(unsigned flag)Defined in src/base/include/icy/bitwise.h:38
Sets the given flag only if it is not already set.
Parameters
flagThe flag bit(s) to set.
add
virtual inline
virtual inline void add(unsigned flag)Defined in src/base/include/icy/bitwise.h:46
Unconditionally sets (OR) the given flag bits.
Parameters
flagThe flag bit(s) to add.
remove
virtual inline
virtual inline void remove(unsigned flag)Defined in src/base/include/icy/bitwise.h:50
Clears the given flag bits.
Parameters
flagThe flag bit(s) to remove.
toggle
virtual inline
virtual inline void toggle(unsigned flag)Defined in src/base/include/icy/bitwise.h:54
Toggles (XOR) the given flag bits.
Parameters
flagThe flag bit(s) to toggle.
has
virtual const inline
virtual inline bool has(unsigned flag) constDefined in src/base/include/icy/bitwise.h:59
Returns true if all bits in flag are set.
Parameters
flagThe flag bit(s) to test.
Returns
true if every bit in flag is present in data.
