44 { floatFormat::general,
"general" },
45 { floatFormat::fixed,
"fixed" },
46 { floatFormat::scientific,
"scientific" },
55 { streamFormat::ASCII,
"ascii" },
56 { streamFormat::BINARY,
"binary" },
67 const floatFormat deflt
83 <<
"Unknown float format '" << fmtName <<
"' using ";
87 err <<
'\'' << iter.key() <<
'\'';
91 err <<
"value=" << int(deflt);
105 const floatFormat deflt
116 const streamFormat deflt
123 else if (
auto iter = formatNames.cfind(fmtName); iter.good())
132 <<
"Unknown stream format '" << fmtName <<
"' using ";
134 if (
auto iter = formatNames.cfind(deflt); iter.good())
136 err <<
'\'' << iter.key() <<
'\'';
140 err <<
"value=" << int(deflt);
142 err <<
" from " << formatNames <<
nl;
154 const streamFormat deflt
164 const word& compName,
165 const compressionType deflt
168 if (compName.empty())
177 ? compressionType::COMPRESSED
178 : compressionType::UNCOMPRESSED
186 <<
"Unknown compression specifier '" << compName
187 <<
"' using compression " << (deflt ?
"on" :
"off") <<
nl;
199 const compressionType deflt
204 Switch(key,
dict, Switch(
bool(deflt)),
true)
205 ? compressionType::COMPRESSED
225 (*this) = versionNumber(tok.stringToken());
231 (*this) = versionNumber(float(tok.number()));
236 <<
"Wrong token for version - expected word/number, found "
254 (*this) = versionNumber(tok);
276 const IOstreamOption::versionNumber& ver
282 os.writeQuoted(ver.str(),
false);
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const_iterator cfind(const word &key) const
Find key/value pair by enumeration name.
Representation of a major/minor version number.
constexpr versionNumber() noexcept
Default construct current version. The value (2.0) corresponds to the current version.
floatFormat
Float formats (eg, time directory name formats).
static floatFormat floatFormatEnum(const word &fmtName, const floatFormat deflt=floatFormat::general)
Lookup floatFormat enum corresponding to the string (general | fixed | scientific).
static compressionType compressionEnum(const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
The compression enum corresponding to the string.
streamFormat
Data format (ascii | binary | coherent).
static const Enum< floatFormat > floatFormatNames
Names for float formats (general, fixed, scientific).
static streamFormat formatEnum(const word &fmtName, const streamFormat deflt=streamFormat::ASCII)
Lookup streamFormat enum corresponding to the string (ascii | binary).
static const Enum< streamFormat > formatNames
Stream format names (ascii, binary).
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED).
@ UNCOMPRESSED
compression = false
@ COMPRESSED
compression = true
static const versionNumber currentVersion
The current version number (2.0).
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
bool good() const noexcept
True if the Switch represents a valid enumeration.
static Switch find(const char *s)
Find switchType for the given string, returning a Switch that can be tested for good() or bad().
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A token holds an item read from Istream.
bool isNumber() const noexcept
Token is (signed/unsigned) integer type, FLOAT or DOUBLE.
bool isStringType() const noexcept
Token is word-variant or string-variant (WORD, DIRECTIVE, STRING, EXPRESSION, VARIABLE,...
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr char nl
The newline '\n' character (0x0a).