93 return static_cast<unsigned char>(
x);
121 static switchType asEnum(
const std::string&,
const bool allowInvalid);
154 Switch(
const std::string& str,
const bool allowInvalid=
false)
156 switch_(asEnum(str, allowInvalid))
161 Switch(
const char* str,
const bool allowInvalid=
false)
163 switch_(asEnum(
std::
string(str), allowInvalid))
175 const Switch& defaultValue =
false 185 const char*
asText()
const;
194 operator bool()
const 196 return (
toInt(switch_) & 0x1);
bool valid() const
Return true if the Switch has a valid value.
switchType
The various text representations for a switch value.
A list of keyword definitions, which are a keyword followed by any number of values (e...
bool readIfPresent(const word &, const dictionary &)
Update the value of the Switch if it is found in the dictionary.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
static unsigned char toInt(const switchType x)
Convert switchType to integer (unsigned char)
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
static Switch lookupOrAddToDict(const word &, dictionary &, const Switch &defaultValue=false)
Construct from dictionary, supplying default value so that if the.
friend Ostream & operator<<(Ostream &, const Switch &)
A class for handling words, derived from string.
friend switchType operator++(switchType &x)
Increment the switchType counter.
Istream & operator>>(Istream &, directionInfo &)
friend Istream & operator>>(Istream &, Switch &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static const unsigned char nSwitchType
Number of switchTypes.
const char * asText() const
Return a text representation of the Switch.
Switch()
Construct null as false.
void operator=(const switchType sw)
Assignment to enumerated value.
Ostream & operator<<(Ostream &, const ensightPart &)
A class for handling character strings derived from std::string.