44 { floatFormat::general,
"general" },
55 { streamFormat::ASCII,
"ascii" },
56 { streamFormat::BINARY,
"binary" },
66 const floatFormat deflt
83 <<
"Unknown float format '" << fmtName <<
"' using ";
88 err <<
'\'' << iter.key() <<
'\'';
92 err <<
"value=" << int(deflt);
106 const floatFormat deflt
109 return floatFormatNames.getOrDefault(
key,
dict, deflt,
true);
117 const streamFormat deflt
122 if (!fmtName.empty())
124 auto iter = formatNames.cfind(fmtName);
134 <<
"Unknown stream format '" << fmtName <<
"' using ";
136 iter = formatNames.cfind(deflt);
139 err <<
'\'' << iter.key() <<
'\'';
143 err <<
"value=" << int(deflt);
145 err <<
" from " << formatNames <<
nl;
157 const streamFormat deflt
160 return formatNames.getOrDefault(
key,
dict, deflt,
true);
167 const word& compName,
168 const compressionType deflt
173 if (!compName.empty())
182 ? compressionType::COMPRESSED
183 : compressionType::UNCOMPRESSED
190 <<
"Unknown compression specifier '" << compName
191 <<
"' using compression " << (deflt ?
"on" :
"off") <<
nl;
203 const compressionType deflt
209 ? compressionType::COMPRESSED
210 : compressionType::UNCOMPRESSED
240 <<
"Wrong token for version - expected word/number, found " 279 const IOstreamOption::versionNumber& ver
285 os.writeQuoted(ver.str(),
false);
bool good() const noexcept
True if the Switch represents a valid enumeration.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
scalar number() const
Return label, float or double value.
constexpr char nl
The newline '\n' character (0x0a)
static const Enum< streamFormat > formatNames
Stream format names (ascii, binary)
floatFormat
Float formats (eg, time directory name formats)
A token holds an item read from Istream.
const_iterator cfind(const word &key) const
Find key/value pair by enumeration name.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
IOstream & fixed(IOstream &io)
bool isStringType() const noexcept
Token is word-variant or string-variant (WORD, DIRECTIVE, STRING, EXPRESSION, VARIABLE, VERBATIM, CHAR_DATA)
A class for handling words, derived from Foam::string.
static const versionNumber currentVersion
The current version number (2.0)
Representation of a major/minor version number.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
const string & stringToken() const
Return const reference to the string contents.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static floatFormat floatFormatEnum(const word &fmtName, const floatFormat deflt=floatFormat::general)
Lookup floatFormat enum corresponding to the string (general | fixed | scientific).
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
static const Enum< floatFormat > floatFormatNames
Names for float formats (general, fixed, scientific)
constexpr versionNumber() noexcept
Default construct current version. The value (2.0) corresponds to the current version.
static streamFormat formatEnum(const word &fmtName, const streamFormat deflt=streamFormat::ASCII)
Lookup streamFormat enum corresponding to the string (ascii | binary).
streamFormat
Data format (ascii | binary)
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
static compressionType compressionEnum(const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
The compression enum corresponding to the string.
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
static Switch find(const std::string &str)
Find switchType for the given string, returning as a Switch that can be tested for good() or bad()...
IOstream & scientific(IOstream &io)