GG::Flags< FlagType > Class Template Reference

A set of flags of the same type. More...

#include <Flags.h>

List of all members.

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)

Friends

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


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 253 of file Flags.h.


Constructor & Destructor Documentation

template<class FlagType>
GG::Flags< FlagType >::Flags (  )  [inline]

Default ctor.

Definition at line 273 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 276 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 287 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 290 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 293 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 297 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 303 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 309 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 315 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:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2