GG
Classes | Namespaces | Macros | Functions
Flags.h File Reference
#include <GG/Exception.h>
#include <boost/utility/enable_if.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/mpl/assert.hpp>
#include <cassert>
#include <iosfwd>
#include <map>
#include <set>

Go to the source code of this file.

Classes

struct  GG::is_flag_type< T >
 
class  GG::FlagSpec< FlagType >
 
class  GG::Flags< FlagType >
 

Namespaces

namespace  GG
 

Macros

#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.

Macro Definition 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 74 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 122 of file Flags.h.