![]() |
|
#include <FlagBase.h>
Public Types | |
typedef E | value_t |
typedef T | storage_t |
typedef Dictionary< std::string, E > | dict_t |
typedef dict_t::key_t | key_t |
Public Member Functions | |
FlaggerBase (char separator=',') | |
FlaggerBase (storage_t &v, char separator=',') | |
Value-referencing constructor. More... | |
virtual const dict_t & | getDict () const =0 |
Returns the static dictionary created for this value_t . More... | |
virtual void | reset () |
virtual void | set (const key_t &key) |
Sets one or several flags. | |
virtual void | set (const value_t &value) |
Set a single flag. | |
virtual void | set (const FlaggerBase< E > &flagger) |
virtual bool | isSet (const storage_t &x) const =0 |
Checks if a given bit, or any of given bits, is set. More... | |
bool | isSet (const key_t &key) const |
const storage_t & | getValue () const |
operator const storage_t & () const | |
Given an integer, retrieves dictionary keys corresponding to each index of set bits. | |
operator storage_t & () | |
operator bool () const | |
virtual const key_t & | str () const =0 |
String corresponding the current value. Returns empty, if not found. | |
operator const key_t & () const | |
void | debug (std::ostream &ostr) const |
Public Attributes | |
storage_t & | value |
char | separator |
A Flag mapper designed for global use, also supporting ENUM types. @See Perhaps replacing GlobalFlagger later.
Example:
Inside a class:
E | - single-value type: enum or integer |
T | - storage type (bit vector, "state"). T should not be enum, if E is numeric. |
|
inline |
Value-referencing constructor.
An external value will be used, leaving protected ownValue
unused . Reconsider design. Should the value ever be referenced?
|
pure virtual |
Returns the static dictionary created for this value_t
.
Notice that this function is non-static but returns a reference to a static dictionary. In C++ virtual functions must be non-static. This is nevertheless handy in templated design, for example.
Implemented in MultiFlagger< E, T >, MultiFlagger< int >, MultiFlagger< group_t, group_t >, and SingleFlagger< E >.
|
pure virtual |
Checks if a given bit, or any of given bits, is set.
SingleFlagger: exact match MultiFlagger: bitwise OR > 0
Implemented in MultiFlagger< int >, MultiFlagger< group_t, group_t >, and SingleFlagger< E >.