GG: GG::Flags< FlagType > Class Template Reference

GG

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Friends | List of all members
GG::Flags< FlagType > Class Template Reference

`#include <Flags.h>`

## Friends
std::ostream & | operator<< (std::ostream &os, Flags< FlagType > flags)

## Exceptions
| GG_ABSTRACT_EXCEPTION (Exception)
| GG_CONCRETE_EXCEPTION (UnknownFlag, GG::Flags, Exception)

## Structors
| Flags ()
| Flags (FlagType flag)

## Accessors
| operator int ConvertibleToBoolDummy::* () const
bool | operator== (Flags< FlagType > rhs) const
bool | operator!= (Flags< FlagType > rhs) const
bool | operator< (Flags< FlagType > rhs) const

## Mutators
Flags< FlagType > & | operator|= (Flags< FlagType > rhs)
Flags< FlagType > & | operator&= (Flags< FlagType > rhs)
Flags< FlagType > & | operator^= (Flags< FlagType > rhs)

## Detailed Description

### template<class FlagType>
class GG::Flags< FlagType >

A set of flags of the same type.

Individual flags and sets of flags can be passed as parameters and/or be stored as member variables in Flags objects.

Definition at line 275 of file Flags.h.

## Constructor & Destructor Documentation

template<class FlagType>

GG::Flags< FlagType >::Flags | ( |  | ) |
| inline

Default ctor.

Definition at line 297 of file Flags.h.

template<class FlagType>

GG::Flags< FlagType >::Flags | ( | FlagType | flag | ) |
| inline

Ctor. Note that this ctor allows implicit conversions from FlagType to Flags.

Exceptions

  Throws | GG::Flags::UnknownFlag if flag is not found in FlagSpec<FlagType>::instance().

Definition at line 301 of file Flags.h.

## Member Function Documentation

template<class FlagType>

GG::Flags< FlagType >::GG_ABSTRACT_EXCEPTION | ( | Exception |  | ) |

The base class for Flags exceptions.

template<class FlagType>

GG::Flags< FlagType >::GG_CONCRETE_EXCEPTION | ( | UnknownFlag | ,
|  | GG::Flags< FlagType > | ,
|  | Exception |
| ) |  |

Thrown when an unknown flag is used to construct a Flags.

template<class FlagType>

GG::Flags< FlagType >::operator int ConvertibleToBoolDummy::* | ( |  | ) | const
| inline

Conversion to bool, so that a Flags object can be used as a boolean test. It is convertible to true when it contains one or more flags, and convertible to false otherwise.

Definition at line 313 of file Flags.h.

template<class FlagType>

bool GG::Flags< FlagType >::operator== | ( | Flags< FlagType > | rhs | ) | const
| inline

Returns true iff *this contains the same flags as rhs.

Definition at line 316 of file Flags.h.

template<class FlagType>

bool GG::Flags< FlagType >::operator!= | ( | Flags< FlagType > | rhs | ) | const
| inline

Returns true iff *this does not contain the same flags as rhs.

Definition at line 319 of file Flags.h.

template<class FlagType>

bool GG::Flags< FlagType >::operator< | ( | Flags< FlagType > | rhs | ) | const
| inline

Returns true iff the underlying storage of *this is less than the underlying storage of rhs. Note that this is here for use in associative containers only; it is otherwise meaningless.

Definition at line 324 of file Flags.h.

template<class FlagType>

Flags<FlagType>& GG::Flags< FlagType >::operator|= | ( | Flags< FlagType > | rhs | ) |
| inline

Performs a bitwise-or of *this and rhs, placing the result in *this.

Definition at line 331 of file Flags.h.

template<class FlagType>

Flags<FlagType>& GG::Flags< FlagType >::operator&= | ( | Flags< FlagType > | rhs | ) |
| inline

Performs a bitwise-and of *this and rhs, placing the result in *this.

Definition at line 338 of file Flags.h.

template<class FlagType>

Flags<FlagType>& GG::Flags< FlagType >::operator^= | ( | Flags< FlagType > | rhs | ) |
| inline

Performs a bitwise-xor of *this and rhs, placing the result in *this.

Definition at line 345 of file Flags.h.

## Friends And Related Function Documentation

template<class FlagType>

std::ostream& operator<< | ( | std::ostream & | os,
|  | Flags< FlagType > | flags
| ) |  |
| friend

Writes flags to os in the format "flag1 | flag2 | ... flagn".

The documentation for this class was generated from the following file:

- Flags.h