44 { streamFormat::ASCII,
"ascii" },
45 { streamFormat::BINARY,
"binary" },
54 const word& formatName,
55 const streamFormat deflt
60 if (!formatName.empty())
70 <<
"Unknown format specifier '" << formatName
83 const streamFormat deflt
86 return formatNames.getOrDefault(
key,
dict, deflt,
true);
94 const compressionType deflt
99 if (!compName.empty())
108 ? compressionType::COMPRESSED
109 : compressionType::UNCOMPRESSED
116 <<
"Unknown compression specifier '" << compName
117 <<
"', using compression " 118 << (deflt ?
"on" :
"off" ) <<
nl;
130 const compressionType deflt
136 ? compressionType::COMPRESSED
137 : compressionType::UNCOMPRESSED
167 <<
"Wrong token for version - expected word/number, found " 206 const IOstreamOption::versionNumber& ver
212 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.
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
constexpr char nl
The newline '\n' character (0x0a)
static const Enum< streamFormat > formatNames
Stream format names (ascii, binary)
A token holds an item read from Istream.
bool found(const word &enumName) const
True if there is an enumeration corresponding to the given 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.
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
The stream format enum corresponding to the string (ascii | binary).
bool isStringType() const noexcept
Token is word-variant or string-variant (WORD, DIRECTIVE, STRING, EXPRESSION, VARIABLE, VERBATIM)
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...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
constexpr versionNumber() noexcept
Default construct current version. The value (2.0) corresponds to the current version.
streamFormat
Data format (ascii | binary)
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()...