31 const char* Foam::Switch::names[nSwitchType] =
53 const std::string& str,
54 const bool allowInvalid
59 if (str == names[
toInt(sw)])
102 <<
"unknown switch word " << str <<
nl
114 const Switch& defaultValue
125 return switch_ <= switchType::none;
131 return names[toInt(switch_)];
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
switchType
The various text representations for a switch value.
bool readIfPresent(const word &, const dictionary &)
Update the value of the Switch if it is found in the dictionary.
static Switch lookupOrAddToDict(const word &, dictionary &, const Switch &defaultValue=false)
Construct from dictionary, supplying default value so that if the.
bool valid() const
Return true if the Switch has a valid value.
const char * asText() const
Return a text representation of the Switch.
static unsigned char toInt(const switchType x)
Convert switchType to integer (unsigned char)
A list of keyword definitions, which are a keyword followed by any number of values (e....
T lookupOrAddDefault(const word &, const T &, bool recursive=false, bool patternMatch=true)
Find and return a T, if not found return the given.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
word name(const bool)
Return a word representation of a bool.
errorManip< error > abort(error &err)