Simpatico
v1.10
|
A set of boolean variables represented by characters.
A FlagSet has a string of allowed characters, each of which which represents a boolean variable (i.e., a flag), and a string of actual characters containing the subset of the allowed characters that should be set on (i.e., true).
#include <FlagSet.h>
Public Member Functions | |
FlagSet () | |
Default constructor. More... | |
FlagSet (std::string allowed) | |
Constructor. More... | |
void | setAllowed (std::string allowed) |
Set or reset the string of allowed flags. More... | |
void | setActualOrdered (std::string actual) |
Set the string of actual flag characters. More... | |
bool | isActive (char c) const |
Is the flag associated with character c active? More... | |
const std::string & | allowed () const |
Return the string of allowed characters. More... | |
const std::string & | actual () const |
Return the string of character for which flags are set. More... | |
Util::FlagSet::FlagSet | ( | ) |
Default constructor.
Definition at line 17 of file FlagSet.cpp.
Util::FlagSet::FlagSet | ( | std::string | allowed | ) |
Constructor.
This function calls setAllowed(string) internally.
allowed | string of all allowed characters. |
Definition at line 23 of file FlagSet.cpp.
References setAllowed().
void Util::FlagSet::setAllowed | ( | std::string | allowed | ) |
Set or reset the string of allowed flags.
This function sets isActive false for all flags and clears the actual string.
allowed | string of all allowed characters |
Definition at line 29 of file FlagSet.cpp.
References allowed().
Referenced by FlagSet().
void Util::FlagSet::setActualOrdered | ( | std::string | actual | ) |
Set the string of actual flag characters.
This function requires that the characters in the actual string appear in the same order as they do in the allowed string, but allows some allowed characters to be absent.
An Exception is thrown if actual contains a character that is not allowed, or if it is not in order.
actual | string containing a subset of allowed characters |
Definition at line 47 of file FlagSet.cpp.
References actual(), and UTIL_THROW.
Referenced by McMd::SmpConfigIo::read().
|
inline |
Is the flag associated with character c active?
c | character to be tested. |
Definition at line 110 of file FlagSet.h.
References UTIL_THROW.
Referenced by McMd::SmpConfigIo::read().
|
inline |
Return the string of allowed characters.
Definition at line 123 of file FlagSet.h.
Referenced by setAllowed().
|
inline |
Return the string of character for which flags are set.
Definition at line 130 of file FlagSet.h.
Referenced by setActualOrdered().