ROSE
0.11.22.0
|
Stores a vector of enum bit flags.
This is a more self-documenting and terse way to use bit flags. For example, consider this original code:
Now rewritten to use this class:
Definition at line 66 of file Sawyer/BitFlags.h.
#include <BitFlags.h>
Public Types | |
typedef E | Enum |
typedef V | Vector |
Public Member Functions | |
BitFlags () | |
Default constructor with all bits clear. More... | |
BitFlags (Vector v) | |
Construct bit vector from value or bit. More... | |
BitFlags (E e) | |
Vector | vector () const |
Current value of the bit vector. More... | |
bool | isSet (Enum e) const |
Test whether a bit is set. More... | |
bool | isAllSet (BitFlags other) const |
True if all specified bits are set. More... | |
bool | isAnySet (BitFlags other) const |
True if any of the specified bits are set. More... | |
bool | isAnySet () const |
True if any bit is set. More... | |
bool | isEmpty () const |
True if no bits are set. More... | |
bool | isClear (Enum e) const |
Test whether a bit is clear. More... | |
BitFlags & | set (Enum e) |
Set the specified bit. More... | |
BitFlags & | set (BitFlags other) |
Set all bits that are set in other . More... | |
BitFlags & | clear (Enum e) |
Clear the specified bit. More... | |
BitFlags & | clear (BitFlags other) |
Clear all bits that are set in other . More... | |
BitFlags & | clear () |
Clear all bits. More... | |
bool | testAndClear (Enum e) |
Test whether a bit is set, then clear it. More... | |
bool | testAndSet (Enum e) |
Test whether a bit is set, then set it. More... | |
BitFlags & | operator= (Vector v) |
Set the vector to an exact value. More... | |
BitFlags & | operator= (BitFlags other) |
Set the vector to the same as another. More... | |
std::vector< Enum > | split (std::vector< int64_t > constants, Vector &leftovers) const |
Split a vector into the individual enum values. More... | |
std::vector< Enum > | split (Vector &leftovers) const |
Split a vector into the individual bits values. More... | |
BitFlags | operator| (BitFlags other) const |
Create a new vector that's the union of two vectors. | |
BitFlags | operator| (Enum e) const |
Create a new vector that's the union of two vectors. | |
BitFlags | intersection (BitFlags other) const |
Create a new vector that's the intersection of two vectors. | |
BitFlags | intersection (Enum e) const |
Create a new vector that's the intersection of two vectors. | |
BitFlags | operator& (BitFlags other) const |
Create a new vector that's the intersection of two vectors. | |
BitFlags | operator& (Enum e) const |
Create a new vector that's the intersection of two vectors. | |
bool | operator== (BitFlags other) const |
Compare two vectors. | |
bool | operator!= (BitFlags other) const |
Compare two vectors. | |
bool | operator< (BitFlags other) const |
Compare two vectors. | |
bool | operator<= (BitFlags other) const |
Compare two vectors. | |
bool | operator> (BitFlags other) const |
Compare two vectors. | |
bool | operator>= (BitFlags other) const |
Compare two vectors. | |
|
inline |
Default constructor with all bits clear.
Definition at line 84 of file Sawyer/BitFlags.h.
|
inline |
Construct bit vector from value or bit.
Definition at line 88 of file Sawyer/BitFlags.h.
|
inline |
Current value of the bit vector.
Definition at line 95 of file Sawyer/BitFlags.h.
Referenced by Rose::BitFlags< Reason, uint32_t >::toString().
|
inline |
Test whether a bit is set.
Definition at line 100 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< Reason, uint32_t >::isClear(), Sawyer::BitFlags< Reason, uint32_t >::split(), Sawyer::BitFlags< Reason, uint32_t >::testAndClear(), Sawyer::BitFlags< Reason, uint32_t >::testAndSet(), and Rose::BinaryAnalysis::Debugger::trace().
|
inline |
True if all specified bits are set.
Definition at line 105 of file Sawyer/BitFlags.h.
|
inline |
True if any of the specified bits are set.
Definition at line 110 of file Sawyer/BitFlags.h.
|
inline |
True if any bit is set.
Definition at line 115 of file Sawyer/BitFlags.h.
|
inline |
True if no bits are set.
Definition at line 120 of file Sawyer/BitFlags.h.
|
inline |
Test whether a bit is clear.
Definition at line 125 of file Sawyer/BitFlags.h.
Referenced by Rose::BinaryAnalysis::Debugger::trace().
|
inline |
Set the specified bit.
Definition at line 130 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< Reason, uint32_t >::testAndSet().
|
inline |
Set all bits that are set in other
.
Definition at line 136 of file Sawyer/BitFlags.h.
|
inline |
Clear the specified bit.
Definition at line 142 of file Sawyer/BitFlags.h.
|
inline |
Clear all bits that are set in other
.
Definition at line 148 of file Sawyer/BitFlags.h.
|
inline |
Clear all bits.
Definition at line 154 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< Reason, uint32_t >::testAndClear().
|
inline |
Test whether a bit is set, then clear it.
Definition at line 160 of file Sawyer/BitFlags.h.
|
inline |
Test whether a bit is set, then set it.
Definition at line 167 of file Sawyer/BitFlags.h.
|
inline |
Set the vector to an exact value.
Definition at line 174 of file Sawyer/BitFlags.h.
|
inline |
Set the vector to the same as another.
Definition at line 180 of file Sawyer/BitFlags.h.
|
inline |
Split a vector into the individual enum values.
The enum constants are first sorted so that those with more set bits appear before those with fewer bits. Then each constant is searched in the bit vector and those bits are removed. This continues until either no bits remain or no matching constant is found. The leftovers
is set to those bits that could not be matched by this process.
Definition at line 241 of file Sawyer/BitFlags.h.
Referenced by Rose::BitFlags< Reason, uint32_t >::toString().
|
inline |
Split a vector into the individual bits values.
Definition at line 264 of file Sawyer/BitFlags.h.