#include <Enumeration.h>
The set is represented internally with bit flags, so storage, assignment, and lookup are all extremely efficient.
This class supports all the standard bitwise operators, like &, |, ^, and ~. This allows you to manipulate sets exactly as if they were ints. It also supports the - operator, which represents the difference between two sets.
For example, if a method expects an EnumerationSet<Color> as an argument, you could pass any of the following values:
Color::Red // a set containing Red Color::Green | Color::Blue // a set containing Green and Blue EnumerationSet<Color>() // an empty set ~EnumerationSet<Color>() // the set of all possible values
Public Member Functions | |
EnumerationSet () | |
Create an empty EnumerationSet. | |
EnumerationSet (const Enumeration< T > &value) | |
Create an EnumerationSet which contains a single value. | |
EnumerationSet (const EnumerationSet< T > &set) | |
Create an EnumerationSet which contains the same values as another set. | |
~EnumerationSet () | |
int | size () const |
Get the number of elements in this set. | |
bool | empty () const |
Check whether this set is empty. | |
bool | contains (const Enumeration< T > &value) const |
Determine whether this set contains a particular value. | |
bool | containsAll (const EnumerationSet< T > &set) const |
Determine whether this set contains all of the values in another set. | |
bool | containsAny (const EnumerationSet< T > &set) const |
Determine wheter this set contains any value which is in another set. | |
bool | operator== (const EnumerationSet< T > &set) const |
Determine whether this set has identical contents to another one. | |
bool | operator!= (const EnumerationSet< T > &set) const |
Determine whether this set has identical contents to another one. | |
void | clear () |
Remove all elements from the set. | |
iterator | begin () |
Get an iterator pointing to the start of the set. | |
iterator | end () |
Get an iterator pointing to the end of the set. | |
EnumerationSet< T > & | operator= (const EnumerationSet< T > &set) |
EnumerationSet< T > & | operator-= (const Enumeration< T > &value) |
EnumerationSet< T > & | operator-= (const EnumerationSet< T > &set) |
EnumerationSet< T > | operator- (const Enumeration< T > &value) const |
EnumerationSet< T > | operator- (const EnumerationSet< T > &set) const |
EnumerationSet< T > & | operator|= (const EnumerationSet< T > &set) |
EnumerationSet< T > | operator| (const EnumerationSet< T > &set) const |
EnumerationSet< T > & | operator &= (const EnumerationSet< T > &set) |
EnumerationSet< T > | operator & (const EnumerationSet< T > &set) const |
EnumerationSet< T > & | operator^= (const EnumerationSet< T > &set) |
EnumerationSet< T > | operator^ (const EnumerationSet< T > &set) const |
EnumerationSet< T > | operator~ () const |
Classes | |
class | EnumerationSetRep |
This class is the internal implementation of EnumerationSet. More... | |
class | iterator |
This class provides an interface for iterating over the content of an EnumerationSet. More... |
EnumerationSet | ( | ) | [inline] |
Create an empty EnumerationSet.
EnumerationSet | ( | const Enumeration< T > & | value | ) | [inline] |
Create an EnumerationSet which contains a single value.
EnumerationSet | ( | const EnumerationSet< T > & | set | ) | [inline] |
Create an EnumerationSet which contains the same values as another set.
~EnumerationSet | ( | ) | [inline] |
int size | ( | ) | const [inline] |
bool empty | ( | ) | const [inline] |
bool contains | ( | const Enumeration< T > & | value | ) | const [inline] |
Determine whether this set contains a particular value.
References EnumerationSet::EnumerationSetRep::contains().
bool containsAll | ( | const EnumerationSet< T > & | set | ) | const [inline] |
Determine whether this set contains all of the values in another set.
References EnumerationSet::EnumerationSetRep::containsAll().
bool containsAny | ( | const EnumerationSet< T > & | set | ) | const [inline] |
Determine wheter this set contains any value which is in another set.
References EnumerationSet::EnumerationSetRep::containsAny().
bool operator== | ( | const EnumerationSet< T > & | set | ) | const [inline] |
Determine whether this set has identical contents to another one.
bool operator!= | ( | const EnumerationSet< T > & | set | ) | const [inline] |
Determine whether this set has identical contents to another one.
void clear | ( | ) | [inline] |
EnumerationSet<T>& operator= | ( | const EnumerationSet< T > & | set | ) | [inline] |
EnumerationSet<T>& operator-= | ( | const Enumeration< T > & | value | ) | [inline] |
EnumerationSet<T>& operator-= | ( | const EnumerationSet< T > & | set | ) | [inline] |
EnumerationSet<T> operator- | ( | const Enumeration< T > & | value | ) | const [inline] |
EnumerationSet<T> operator- | ( | const EnumerationSet< T > & | set | ) | const [inline] |
EnumerationSet<T>& operator|= | ( | const EnumerationSet< T > & | set | ) | [inline] |
EnumerationSet<T> operator| | ( | const EnumerationSet< T > & | set | ) | const [inline] |
EnumerationSet<T>& operator &= | ( | const EnumerationSet< T > & | set | ) | [inline] |
EnumerationSet<T> operator & | ( | const EnumerationSet< T > & | set | ) | const [inline] |
EnumerationSet<T>& operator^= | ( | const EnumerationSet< T > & | set | ) | [inline] |
EnumerationSet<T> operator^ | ( | const EnumerationSet< T > & | set | ) | const [inline] |
EnumerationSet<T> operator~ | ( | ) | const [inline] |
References EnumerationSet::EnumerationSetRep::invert(), and EnumerationSet::rep.