Flags.h File Reference

Contains Flags and related classes, used to ensure typesafety when using bitflags. More...

#include <boost/lexical_cast.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <iosfwd>
#include <map>
#include <set>
#include <stdexcept>

Go to the source code of this file.

Namespaces

namespace  GG

Classes

struct  GG::is_flag_type< T >
 Metafunction predicate that evaluates as true iff T is a GG flag type, declared by using GG_FLAG_TYPE. More...
class  GG::FlagSpec< FlagType >
 A singleton that encapsulates the set of known flags of type FlagType. More...
class  GG::Flags< FlagType >
 A set of flags of the same type. More...

Defines

#define GG_FLAG_TYPE(name)
#define GG_FLAGSPEC_IMPL(name)

Functions

template<class FlagType>
std::ostream & GG::operator<< (std::ostream &os, Flags< FlagType > flags)
template<class FlagType>
Flags< FlagType > GG::operator| (Flags< FlagType > lhs, Flags< FlagType > rhs)
template<class FlagType>
Flags< FlagType > GG::operator| (Flags< FlagType > lhs, FlagType rhs)
template<class FlagType>
Flags< FlagType > GG::operator| (FlagType lhs, Flags< FlagType > rhs)
template<class FlagType>
boost::enable_if< is_flag_type<
FlagType >, Flags< FlagType
>>::type 
GG::operator| (FlagType lhs, FlagType rhs)
template<class FlagType>
Flags< FlagType > GG::operator & (Flags< FlagType > lhs, Flags< FlagType > rhs)
template<class FlagType>
Flags< FlagType > GG::operator & (Flags< FlagType > lhs, FlagType rhs)
template<class FlagType>
Flags< FlagType > GG::operator & (FlagType lhs, Flags< FlagType > rhs)
template<class FlagType>
boost::enable_if< is_flag_type<
FlagType >, Flags< FlagType
>>::type 
GG::operator & (FlagType lhs, FlagType rhs)
template<class FlagType>
Flags< FlagType > GG::operator^ (Flags< FlagType > lhs, Flags< FlagType > rhs)
template<class FlagType>
Flags< FlagType > GG::operator^ (Flags< FlagType > lhs, FlagType rhs)
template<class FlagType>
Flags< FlagType > GG::operator^ (FlagType lhs, Flags< FlagType > rhs)
template<class FlagType>
boost::enable_if< is_flag_type<
FlagType >, Flags< FlagType
>>::type 
GG::operator^ (FlagType lhs, FlagType rhs)
template<class FlagType>
Flags< FlagType > GG::operator~ (Flags< FlagType > flags)
template<class FlagType>
boost::enable_if< is_flag_type<
FlagType >, Flags< FlagType
>>::type 
GG::operator~ (FlagType flag)


Detailed Description

Contains Flags and related classes, used to ensure typesafety when using bitflags.

Definition in file Flags.h.


Define Documentation

#define GG_FLAG_TYPE ( name   ) 

Defines a new type name that is usable as a bit-flag type that can be used by Flags and FlagSpec.

The resulting code defines a specialization for is_flag_type, the flag class itself, streaming operators for the flag type, and the forward declaration of FlagSpec::instance() for the flag type. The user must define FlagSpec::instance().

Definition at line 67 of file Flags.h.

#define GG_FLAGSPEC_IMPL ( name   ) 

Value:

template <>                                         \
    FlagSpec<name>& FlagSpec<name>::instance()          \
    {                                                   \
        static FlagSpec retval;                         \
        return retval;                                  \
    }
Defines the implementation of FlagSpec::instance() for the flag type name.

Definition at line 119 of file Flags.h.


Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2