Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MultiFlagger< E, T > Class Template Reference

#include <Flags.h>

Inheritance diagram for MultiFlagger< E, T >:
Inheritance graph
[legend]
Collaboration diagram for MultiFlagger< E, T >:
Collaboration graph
[legend]

Public Types

typedef E value_t
 
typedef T storage_t
 
typedef FlaggerBase< E, T > flagger_t
 
typedef flagger_t::dict_t dict_t
 
typedef dict_t::key_t key_t
 
- Public Types inherited from FlaggerBase< E, T >
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

 MultiFlagger (const dict_t &dict)
 
template<typename ... V>
 MultiFlagger (const dict_t &dict, const V &... args)
 
 MultiFlagger (const dict_t &dict, storage_t &target, char sep=',')
 
virtual const dict_tgetDict () const override
 Returns the static dictionary created for this value_t .
 
virtual bool isSet (const storage_t &x) const override
 Return true, all the bits of argument x are set.
 
bool isAnySet (const storage_t &x) const
 Return true, all the bits of argument x are set.
 
void unset (const storage_t &x)
 Unset some bit(s).
 
template<typename ... V>
void set (const V &... args)
 Set bits, accepting numeric values or keys.
 
template<typename V , typename ... VV>
void add (const V &arg, const VV &... args)
 Add bit values.
 
virtual const key_t & str () const override
 For exporting values.
 
virtual std::string & str ()
 For importing values. After assignment, update() should be called. Experimental.
 
- Public Member Functions inherited from FlaggerBase< E, T >
virtual void reset ()
 
bool isSet (const key_t &key) const
 
const storage_t & getValue () const
 
 operator const storage_t & () const
 
 operator storage_t & ()
 
 operator bool () const
 
 operator const key_t & () const
 
void debug (std::ostream &ostr) const
 

Protected Member Functions

virtual void assign (const std::string &s) override
 Split a string to separate keys and/or values and set them.
 
void add ()
 
void addOne (const key_t &key)
 
void addOne (const storage_t &value)
 
template<typename T2 >
void addOne (const T2 &value)
 
- Protected Member Functions inherited from FlaggerBase< E, T >
 FlaggerBase (char separator=',')
 
 FlaggerBase (storage_t &v, char separator=',')
 Value-referencing constructor.
 

Protected Attributes

const dict_tdict
 
std::string currentStr
 

Additional Inherited Members

- Public Attributes inherited from FlaggerBase< E, T >
storage_t & value
 
char separator
 

Detailed Description

template<typename E, typename T = size_t>
class drain::MultiFlagger< E, T >

Note that if enum definition contains overlapping (combined) values, SingleFlagger may be sufficient. If arbitrary bit combinations should be supported, MultiFlagger must be used. Example {USER=1, GROUP=2, OTHER=4, ALL=USER|GROUP|OTHER}.

Abstract class, because getDict() returning Dictionary<std::string,E> still undefined.

Constructor & Destructor Documentation

◆ MultiFlagger()

template<typename E , typename T = size_t>
MultiFlagger ( const dict_t dict,
storage_t &  target,
char  sep = ',' 
)
inline
Parameters
v- linked variable

Member Function Documentation

◆ assign()

template<typename E , typename T = size_t>
virtual void assign ( const std::string &  s)
inlineoverrideprotectedvirtual

Split a string to separate keys and/or values and set them.

Implements FlaggerBase< E, T >.

◆ getDict()

template<typename E , typename T = size_t>
virtual const dict_t & getDict ( ) const
inlineoverridevirtual

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.

Implements FlaggerBase< E, T >.

◆ isSet()

template<typename E , typename T = size_t>
virtual bool isSet ( const storage_t &  x) const
inlineoverridevirtual

Return true, all the bits of argument x are set.

Implements FlaggerBase< E, T >.

◆ set()

template<typename E , typename T = size_t>
template<typename ... V>
void set ( const V &...  args)
inline

Set bits, accepting numeric values or keys.

Starts with resetting the flags.

Template Parameters
T– numeric values or strings

◆ str()

template<typename E , typename T = size_t>
virtual const key_t & str ( ) const
inlineoverridevirtual

For exporting values.

Implements FlaggerBase< E, T >.


The documentation for this class was generated from the following file: