PIP 1.7.1 Platform-Independent Primitives

Public Member Functions | List of all members
PIFlags< Enum > Class Template Reference

This class used as container for bit flags. More...

## Public Member Functions
| PIFlags ()
| Constructor with flags = 0.
| PIFlags (Enum e)
| Constructor with flags = Enum "e".
| PIFlags (const PIFlags &f)
| Constructor with flags = PIFlags "f".
| PIFlags (const int i)
| Constructor with flags = int "i".
PIFlags & | setFlag (const PIFlags &f, bool on=true)
| Set flags "f" to value "on".
PIFlags & | setFlag (const Enum &e, bool on=true)
| Set flag "e" to value "on".
PIFlags & | setFlag (const int &i, bool on=true)
| Set flag "i" to value "on".
void | operator= (const PIFlags &f)
| copy operator
void | operator= (const Enum &e)
| copy operator
void | operator= (const int &i)
| copy operator
bool | operator== (const PIFlags &f)
| compare operator
bool | operator== (const Enum &e)
| compare operator
bool | operator== (const int i)
| compare operator
bool | operator!= (const PIFlags &f)
| compare operator
bool | operator!= (const Enum &e)
| compare operator
bool | operator!= (const int i)
| compare operator
bool | operator> (const PIFlags &f)
| compare operator
bool | operator> (const Enum &e)
| compare operator
bool | operator> (const int i)
| compare operator
bool | operator< (const PIFlags &f)
| compare operator
bool | operator< (const Enum &e)
| compare operator
bool | operator< (const int i)
| compare operator
bool | operator>= (const PIFlags &f)
| compare operator
bool | operator>= (const Enum &e)
| compare operator
bool | operator>= (const int i)
| compare operator
bool | operator<= (const PIFlags &f)
| compare operator
bool | operator<= (const Enum &e)
| compare operator
bool | operator<= (const int i)
| compare operator
void | operator&= (const PIFlags &f)
| Bit-wise AND operator.
void | operator&= (const Enum &e)
| Bit-wise AND operator.
void | operator&= (const int i)
| Bit-wise AND operator.
void | operator|= (const PIFlags &f)
| Bit-wise OR operator.
void | operator|= (const Enum &e)
| Bit-wise OR operator.
void | operator|= (const int i)
| Bit-wise OR operator.
void | operator^= (const PIFlags &f)
| Bit-wise XOR operator.
void | operator^= (const Enum &e)
| Bit-wise XOR operator.
void | operator^= (const int i)
| Bit-wise XOR operator.
PIFlags | operator& (PIFlags f) const
| Bit-wise AND operator.
PIFlags | operator& (Enum e) const
| Bit-wise AND operator.
PIFlags | operator& (int i) const
| Bit-wise AND operator.
PIFlags | operator| (PIFlags f) const
| Bit-wise OR operator.
PIFlags | operator| (Enum e) const
| Bit-wise OR operator.
PIFlags | operator| (int i) const
| Bit-wise OR operator.
PIFlags | operator^ (PIFlags f) const
| Bit-wise XOR operator.
PIFlags | operator^ (Enum e) const
| Bit-wise XOR operator.
PIFlags | operator^ (int i) const
| Bit-wise XOR operator.
bool | operator[] (Enum e) const
| Test flag operator.
| operator int () const
| Implicity conversion to `int`.

## Detailed Description

### template<typename Enum>
class PIFlags< Enum >

This class used as container for bit flags.

PIFlags is wrapper around `"int"`. There are many bit-wise operators, native conversion to int and function to test flag.
Example:

enum TestEnum {First = 0x1, Second = 0x2, Third = 0x4};
PIFlags<TestEnum> testFlags(First);
testFlags |= Third;
piCout << testFlags[First] << testFlags[Second] << testFlags[Third]; // 1 0 1
piCout << (int)testFlags; // 5