#include <Flags.h>
Exceptions | |
GG_ABSTRACT_EXCEPTION (Exception) | |
GG_CONCRETE_EXCEPTION (UnknownFlag, GG::FlagSpec, Exception) | |
GG_CONCRETE_EXCEPTION (UnknownString, GG::FlagSpec, Exception) | |
Accessors | |
bool | contains (FlagType flag) const |
bool | permanent (FlagType flag) const |
const_iterator | find (FlagType flag) const |
const_iterator | begin () const |
const_iterator | end () const |
const std::string & | ToString (FlagType flag) const |
FlagType | FromString (const std::string &str) const |
Mutators | |
void | insert (FlagType flag, const std::string &name, bool permanent=false) |
bool | erase (FlagType flag) |
Public Types | |
typedef std::set< FlagType >::iterator | iterator |
typedef std::set< FlagType >::const_iterator | const_iterator |
Static Public Member Functions | |
static FlagSpec & | instance () |
New user-defined flags must be registered with FlagSpec in order to be used in Flags objects for operator~ to work properly with flags of type FlagType. FlagSpec is designed to be extensible. That is, it is understood that the flags used by GG may be insufficient for all subclasses that users may write, and FlagSpec allows authors of GG-derived classes to add flags. For instance, a subclass of Wnd may want to add a MINIMIZABLE flag. Doing so is as simple as declaring it and registering it with
FlagSpec<WndFlag>::instance.insert(MINIMIZABLE, "MINIMIZABLE")
Definition at line 139 of file Flags.h.
typedef std::set<FlagType>::iterator GG::FlagSpec< FlagType >::iterator |
typedef std::set<FlagType>::const_iterator GG::FlagSpec< FlagType >::const_iterator |
GG::FlagSpec< FlagType >::GG_ABSTRACT_EXCEPTION | ( | Exception | ) |
The base class for FlagSpec exceptions.
GG::FlagSpec< FlagType >::GG_CONCRETE_EXCEPTION | ( | UnknownFlag | , | |
GG::FlagSpec< FlagType > | , | |||
Exception | ||||
) |
Thrown when a flag-to-string conversion is requested for an unknown flag.
GG::FlagSpec< FlagType >::GG_CONCRETE_EXCEPTION | ( | UnknownString | , | |
GG::FlagSpec< FlagType > | , | |||
Exception | ||||
) |
Thrown when a string-to-flag conversion is requested for an unknown string.
static FlagSpec& GG::FlagSpec< FlagType >::instance | ( | ) | [static] |
Returns the singelton instance of this class.
bool GG::FlagSpec< FlagType >::contains | ( | FlagType | flag | ) | const [inline] |
bool GG::FlagSpec< FlagType >::permanent | ( | FlagType | flag | ) | const [inline] |
const_iterator GG::FlagSpec< FlagType >::find | ( | FlagType | flag | ) | const [inline] |
const_iterator GG::FlagSpec< FlagType >::begin | ( | ) | const [inline] |
Returns an iterator to the first flag in the FlagSpec.
Definition at line 177 of file Flags.h.
Referenced by GG::operator~().
const_iterator GG::FlagSpec< FlagType >::end | ( | ) | const [inline] |
Returns an iterator to one past the last flag in the FlagSpec.
Definition at line 180 of file Flags.h.
Referenced by GG::operator~().
const std::string& GG::FlagSpec< FlagType >::ToString | ( | FlagType | flag | ) | const [inline] |
FlagType GG::FlagSpec< FlagType >::FromString | ( | const std::string & | str | ) | const [inline] |
void GG::FlagSpec< FlagType >::insert | ( | FlagType | flag, | |
const std::string & | name, | |||
bool | permanent = false | |||
) | [inline] |
bool GG::FlagSpec< FlagType >::erase | ( | FlagType | flag | ) | [inline] |
Removes flag from the FlagSpec, returning whether the flag was actually removed or not.
Permanent flags are not removed. The removal of flags will probably only be necessary in cases where flags were added for classes in a runtime-loaded DLL/shared library at DLL/shared library unload-time.