39#ifndef Foam_OSstream_H
40#define Foam_OSstream_H
86 const string& streamName,
94 const string& streamName,
106 const string& streamName,
122 virtual const fileName&
name()
const override {
return name_; }
127 virtual fileName&
name() {
return name_; }
133 virtual const std::ostream&
stdStream()
const {
return os_; }
136 virtual std::ostream&
stdStream() {
return os_; }
142 virtual std::ios_base::fmtflags
flags()
const override
148 virtual std::ios_base::fmtflags
flags
150 std::ios_base::fmtflags
f
170 virtual bool write(
const token& tok)
override;
180 const bool quoted=
true
193 virtual Ostream&
write(
const std::string& str)
override;
217 std::streamsize count
224 std::streamsize count
236 virtual void indent()
override;
242 virtual void flush()
override;
245 virtual void endl()
override;
248 virtual char fill()
const override;
252 virtual char fill(
const char fillch)
override;
255 virtual int width()
const override;
259 virtual int width(
const int w)
override;
Representation of a major/minor version number.
A simple container for options an IOstream can normally have.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
streamFormat
Data format (ascii | binary | coherent).
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED).
@ UNCOMPRESSED
compression = false
void setState(std::ios_base::iostate state) noexcept
Set stream state.
Generic output stream using a standard (STL) stream.
virtual void flush() override
Flush stream.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name).
OSstream(std::ostream &os, const string &streamName, IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
Construct wrapper around std::ostream, set stream status.
virtual std::ios_base::fmtflags flags() const override
Get current stream flags.
virtual fileName & name()
The name of the output serial stream, for modification.
virtual std::ios_base::fmtflags flags(std::ios_base::fmtflags f) override
Set stream flags, return old stream flags.
OSstream(const OSstream &)=default
Copy construct.
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true) override
Write character/string content, with/without surrounding quotes.
virtual const std::ostream & stdStream() const
Const access to underlying std::ostream.
virtual void print(Ostream &os) const override
Print stream description to Ostream.
virtual void indent() override
Add indentation characters.
virtual char fill() const override
Get the current padding character.
virtual int precision() const override
Get precision of output field.
virtual Ostream & writeRaw(const char *data, std::streamsize count) override
Low-level raw binary output.
virtual bool beginRawWrite(std::streamsize count) override
Begin marker for low-level raw binary output.
void syncState()
Set stream state to match that of the std::ostream.
virtual bool endRawWrite() override
End marker for low-level raw binary output.
void operator=(const OSstream &)=delete
No copy assignment.
virtual void endl() override
Add newline and flush stream.
virtual std::ostream & stdStream()
Access to underlying std::ostream.
OSstream(std::ostream &os, const string &streamName, IOstreamOption::streamFormat fmt, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
Construct wrapper around std::ostream, set stream status.
virtual int width() const override
Get width of output field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true)=0
Write character/string content, with/without surrounding quotes.
Ostream(const Ostream &)=default
Copy construct.
A class for handling file names.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)