72Ostream&
operator<<(Ostream& is,
const Switch& sw);
104 unsigned char value_;
111 static switchType parse(
const std::string&
str,
const bool failOnError);
161 explicit Switch(
const float val,
const float tol=0.5);
165 explicit Switch(
const double val,
const double tol=0.5);
188 const bool failsafe =
false
210 static const char*
name(
const bool b)
noexcept;
217 static bool found(
const std::string&
str);
239 std::
string str() const;
254 return (value_ & 0x1);
277 Switch(const std::
string&
str,
bool allowBad);
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
constexpr Switch(const bool b) noexcept
Construct from bool.
switchType
Switch enumerations corresponding to common text representations.
Switch & operator=(const bool b) noexcept
Assignment from bool.
Switch & operator=(const switchType sw) noexcept
Assignment from enumerated value.
void negate() noexcept
Flip the type, so OFF becomes ON, etc.
static Switch lookupOrAddToDict(const word &name, dictionary &dict, const Switch deflt=switchType::FALSE)
Same as getOrAddToDict()
bool readIfPresent(const word &key, const dictionary &dict)
Update the value of the Switch if it is found in the dictionary.
constexpr Switch(const switchType sw) noexcept
Construct from enumerated value.
constexpr Switch() noexcept
Default construct as false.
bool good() const noexcept
True if the Switch represents a valid enumeration.
bool bad() const noexcept
True if the Switch does not represent a valid enumeration.
switchType type() const noexcept
The underlying enumeration value.
static Switch getOrAddToDict(const word &key, dictionary &dict, const Switch deflt=switchType::FALSE)
constexpr Switch(const int i) noexcept
Construct from int (treat integer as bool value)
static const char * name(const bool b) noexcept
A string representation of bool as "false" / "true".
static Switch find(const std::string &str)
Switch & operator=(const Switch &) noexcept=default
Copy assignment.
const char * c_str() const noexcept
A C-string representation of the Switch value.
std::string str() const
A string representation of the Switch value.
Switch(const Switch &) noexcept=default
Copy construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Istream & operator>>(Istream &, directionInfo &)
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
#define FOAM_DEPRECATED_FOR(since, replacement)