44#ifndef Foam_IOstreamOption_H
45#define Foam_IOstreamOption_H
58template<
class EnumType>
class Enum;
109 fixed = unsigned(std::ios_base::fixed),
111 scientific = unsigned(std::ios_base::scientific)
135 number_(10*major + (minor % 10))
141 number_(10*ver + 0.001)
157 std::string
str()
const
161 std::to_string(
int(number_ / 10))
163 + std::to_string(
int(number_ % 10))
185 return (number_ - other.number_);
257 const word& compName,
335 version_(opt.version_),
337 compression_(opt.compression_)
394 versionNumber
version(
const versionNumber ver)
noexcept
396 versionNumber old(version_);
405 versionNumber old(version_);
406 version_ = versionNumber(tok);
426inline bool operator==
436inline bool operator!=
456inline bool operator<=
472 return a.compare(
b) > 0;
476inline bool operator>=
482 return a.compare(
b) >= 0;
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Representation of a major/minor version number.
constexpr versionNumber(const float ver) noexcept
Construct from floating-point version number.
static versionNumber canonical(int verNum) noexcept
From canonical integer value to version.
constexpr versionNumber(int major, int minor) noexcept
Construct from major, number.
constexpr versionNumber() noexcept
Default construct current version. The value (2.0) corresponds to the current version.
int canonical() const noexcept
From version to canonical integer value.
int compare(const versionNumber &other) const noexcept
Compare differences in the versions.
std::string str() const
A string representation as major.minor.
streamFormat format(const streamFormat fmt) noexcept
Set the stream format.
versionNumber version() const noexcept
Get the stream version.
streamFormat format(const word &formatName)
Set the stream format from string value.
compressionType compression(const compressionType comp) noexcept
Set the stream compression.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
compressionType compression() const noexcept
Get the stream compression.
streamFormat format() const noexcept
Get the current stream format.
floatFormat
Float formats (eg, time directory name formats).
@ general
default float notation
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.
IOstreamOption(const IOstreamOption &opt, streamFormat fmt) noexcept
Copy construct with change of format.
constexpr IOstreamOption(streamFormat fmt, compressionType comp, versionNumber ver) noexcept
Construct from components (format, compression, version).
streamFormat
Data format (ascii | binary | coherent).
@ ASCII
"ascii" (normal default)
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).
atomicType
Atomic operations (output).
@ NON_ATOMIC
atomic = false
static const Enum< streamFormat > formatNames
Stream format names (ascii, binary).
versionNumber version(const token &tok)
Set the stream version from token.
versionNumber version(const versionNumber ver) noexcept
Set the stream version.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED).
@ UNCOMPRESSED
compression = false
@ COMPRESSED
compression = true
static const versionNumber currentVersion
The current version number (2.0).
appendType
File appending (NO_APPEND | APPEND_APP | APPEND_ATE).
@ NON_APPEND
old name for NO_APPEND
@ NO_APPEND
no append (truncates existing)
@ APPEND_ATE
append (seek end after open)
@ APPEND_APP
append (seek end each write)
@ APPEND
old name for APPEND_APP
compressionType compression(const word &compName)
Set the stream compression from string value.
constexpr IOstreamOption(streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Construct from components (format, version, compression).
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
General relative velocity model.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
IOstream & fixed(IOstream &io)
IOstream & scientific(IOstream &io)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).