ROSE 0.11.145.192
|
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 63 of file Sawyer/BitFlags.h.
#include <Sawyer/BitFlags.h>
Public Types | |
typedef E | Enum |
typedef V | Vector |
Public Member Functions | |
BitFlags () | |
Default constructor with all bits clear. | |
BitFlags (Vector v) | |
Construct bit vector from value or bit. | |
BitFlags (E e) | |
BitFlags (const BitFlags &other) | |
Copy constructor. | |
Vector | vector () const |
Current value of the bit vector. | |
bool | isSet (Enum e) const |
Test whether a bit is set. | |
bool | isAllSet (BitFlags other) const |
True if all specified bits are set. | |
bool | isAnySet (BitFlags other) const |
True if any of the specified bits are set. | |
bool | isAnySet () const |
True if any bit is set. | |
bool | isEmpty () const |
True if no bits are set. | |
bool | isClear (Enum e) const |
Test whether a bit is clear. | |
bool | isAllClear (const BitFlags other) const |
True if all specified bits are clear. | |
bool | isAnyClear (const BitFlags other) const |
True if any specified bit is clear. | |
BitFlags & | set (Enum e) |
Set the specified bit. | |
BitFlags & | set (BitFlags other) |
Set all bits that are set in other . | |
BitFlags & | clear (Enum e) |
Clear the specified bit. | |
BitFlags & | clear (BitFlags other) |
Clear all bits that are set in other . | |
BitFlags & | clear () |
Clear all bits. | |
bool | testAndClear (Enum e) |
Test whether a bit is set, then clear it. | |
bool | testAndSet (Enum e) |
Test whether a bit is set, then set it. | |
BitFlags & | operator= (Vector v) |
Set the vector to an exact value. | |
BitFlags & | operator= (BitFlags other) |
Set the vector to the same as another. | |
std::vector< Enum > | split (std::vector< int64_t > constants, Vector &leftovers) const |
Split a vector into the individual enum values. | |
std::vector< Enum > | split () const |
Split a vector into the individual bits values. | |
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. | |
typedef E Sawyer::BitFlags< E, V >::Enum |
Definition at line 65 of file Sawyer/BitFlags.h.
typedef V Sawyer::BitFlags< E, V >::Vector |
Definition at line 66 of file Sawyer/BitFlags.h.
|
inline |
Default constructor with all bits clear.
Definition at line 93 of file Sawyer/BitFlags.h.
|
inline |
Construct bit vector from value or bit.
Definition at line 97 of file Sawyer/BitFlags.h.
|
inline |
Definition at line 100 of file Sawyer/BitFlags.h.
|
inline |
Copy constructor.
Definition at line 104 of file Sawyer/BitFlags.h.
|
inline |
Current value of the bit vector.
Definition at line 108 of file Sawyer/BitFlags.h.
Referenced by Rose::BitFlags< E, V >::toString().
|
inline |
Test whether a bit is set.
Definition at line 113 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< E, V >::isClear(), Sawyer::BitFlags< E, V >::split(), Sawyer::BitFlags< E, V >::testAndClear(), Sawyer::BitFlags< E, V >::testAndSet(), and Rose::BinaryAnalysis::Debugger::Base::trace().
|
inline |
True if all specified bits are set.
Definition at line 118 of file Sawyer/BitFlags.h.
|
inline |
True if any of the specified bits are set.
Definition at line 123 of file Sawyer/BitFlags.h.
|
inline |
True if any bit is set.
Definition at line 128 of file Sawyer/BitFlags.h.
|
inline |
True if no bits are set.
Definition at line 133 of file Sawyer/BitFlags.h.
|
inline |
Test whether a bit is clear.
Definition at line 138 of file Sawyer/BitFlags.h.
References Sawyer::BitFlags< E, V >::isSet().
Referenced by Rose::BinaryAnalysis::Debugger::Base::trace().
|
inline |
True if all specified bits are clear.
Definition at line 143 of file Sawyer/BitFlags.h.
|
inline |
True if any specified bit is clear.
Definition at line 148 of file Sawyer/BitFlags.h.
|
inline |
Set the specified bit.
Definition at line 153 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< E, V >::testAndSet().
|
inline |
Set all bits that are set in other
.
Definition at line 159 of file Sawyer/BitFlags.h.
|
inline |
Clear the specified bit.
Definition at line 165 of file Sawyer/BitFlags.h.
|
inline |
Clear all bits that are set in other
.
Definition at line 171 of file Sawyer/BitFlags.h.
|
inline |
Clear all bits.
Definition at line 177 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< E, V >::testAndClear().
|
inline |
Test whether a bit is set, then clear it.
Definition at line 183 of file Sawyer/BitFlags.h.
References Sawyer::BitFlags< E, V >::clear(), and Sawyer::BitFlags< E, V >::isSet().
|
inline |
Test whether a bit is set, then set it.
Definition at line 190 of file Sawyer/BitFlags.h.
References Sawyer::BitFlags< E, V >::isSet(), and Sawyer::BitFlags< E, V >::set().
|
inline |
Set the vector to an exact value.
Definition at line 197 of file Sawyer/BitFlags.h.
|
inline |
Set the vector to the same as another.
Definition at line 203 of file Sawyer/BitFlags.h.
|
inline |
Create a new vector that's the union of two vectors.
Definition at line 211 of file Sawyer/BitFlags.h.
|
inline |
Create a new vector that's the union of two vectors.
Definition at line 214 of file Sawyer/BitFlags.h.
|
inline |
Create a new vector that's the intersection of two vectors.
Definition at line 222 of file Sawyer/BitFlags.h.
Referenced by Sawyer::BitFlags< E, V >::operator&(), and Sawyer::BitFlags< E, V >::operator&().
|
inline |
Create a new vector that's the intersection of two vectors.
Definition at line 225 of file Sawyer/BitFlags.h.
|
inline |
Create a new vector that's the intersection of two vectors.
Definition at line 228 of file Sawyer/BitFlags.h.
References Sawyer::BitFlags< E, V >::intersection().
|
inline |
Create a new vector that's the intersection of two vectors.
Definition at line 231 of file Sawyer/BitFlags.h.
References Sawyer::BitFlags< E, V >::intersection().
|
inline |
Compare two vectors.
Definition at line 239 of file Sawyer/BitFlags.h.
|
inline |
Compare two vectors.
Definition at line 242 of file Sawyer/BitFlags.h.
|
inline |
Compare two vectors.
Definition at line 245 of file Sawyer/BitFlags.h.
|
inline |
Compare two vectors.
Definition at line 248 of file Sawyer/BitFlags.h.
|
inline |
Compare two vectors.
Definition at line 251 of file Sawyer/BitFlags.h.
|
inline |
Compare two vectors.
Definition at line 254 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 264 of file Sawyer/BitFlags.h.
|
inline |
Split a vector into the individual bits values.
Definition at line 287 of file Sawyer/BitFlags.h.
References Sawyer::BitFlags< E, V >::isSet().
Referenced by Rose::BitFlags< E, V >::toString().