54constexpr char tab =
'\t';
55constexpr char nl =
'\n';
127 const bool quoted=
true
133 const std::string& str,
134 const bool quoted=
true
170 virtual Ostream&
write(
const char* data, std::streamsize count) = 0;
176 std::streamsize count
188 virtual void indent() = 0;
197 unsigned short indentSize(
unsigned short val)
noexcept
271 if (value1 != value2)
283 virtual void flush() = 0;
286 virtual void endl() = 0;
289 virtual char fill()
const = 0;
292 virtual char fill(
const char fillch) = 0;
295 virtual int width()
const = 0;
298 virtual int width(
const int w) = 0;
314 return const_cast<Ostream&
>(*this);
339 os.writeQuoted(
s.data(),
s.size(),
true);
340 os.check(
"Foam::operator<<(Ostream&, std::string_view)");
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
IOstream(const IOstream &)=default
Copy construct.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static constexpr const unsigned short entryIndentation_
Indentation of the entry from the start of the keyword.
virtual Ostream & endBlock()
Write end block group.
virtual char fill(const char fillch)=0
Set padding character for formatted field up to field width.
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true)=0
Write character/string content, with/without surrounding quotes.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Ostream(IOstreamOption streamOpt=IOstreamOption())
Default construct (ASCII, uncompressed), construct with specified stream option.
virtual Ostream & writeKeyword(const keyType &kw)
Write the keyword followed by an appropriate indentation.
unsigned short indentSize_
Number of spaces per indent level.
virtual char fill() const =0
Get padding character.
virtual Ostream & write(const double val)=0
Write double.
virtual void flush()=0
Flush stream.
unsigned short & indentSize() noexcept
Access to indent size.
virtual Ostream & write(const char c)=0
Write character.
virtual bool endRawWrite()=0
Emit end marker for low-level raw binary output.
virtual Ostream & write(const uint32_t val)=0
Write uint32_t.
virtual void indent()=0
Add indentation characters.
Ostream(const Ostream &)=default
Copy construct.
virtual int precision() const =0
Get precision of output field.
Ostream(IOstreamOption::streamFormat fmt, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
Construct with format (uncompressed).
virtual Ostream & beginBlock()
Write begin block group without a name.
virtual void endl()=0
Add newline and flush stream.
virtual Ostream & writeRaw(const char *data, std::streamsize count)=0
Low-level raw binary output.
virtual bool beginRawWrite(std::streamsize count)=0
Emit begin marker for low-level raw binary output.
virtual Ostream & write(const float val)=0
Write float.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
virtual Ostream & write(const int64_t val)=0
Write int64_t.
unsigned short & indentLevel() noexcept
Access to indent level.
virtual int width() const =0
Get width of output field.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Ostream & operator()() const
Return a non-const reference to const Ostream.
virtual int width(const int w)=0
Set width of output field (and return old width).
unsigned short indentLevel(unsigned short val) noexcept
Change the indent level, return old value.
virtual Ostream & write(const word &str)=0
Write word (unquoted).
virtual Ostream & write(const int32_t val)=0
Write int32_t.
unsigned short indentLevel() const noexcept
Return the indent level.
virtual ~Ostream()=default
Destructor.
unsigned short indentSize(unsigned short val) noexcept
Change indent size (spaces per level), return old value.
unsigned short indentSize() const noexcept
Return indent size (spaces per level).
virtual Ostream & write(const char *str)=0
Write character string.
void decrIndent()
Decrement the indent level.
virtual int precision(const int p)=0
Set precision of output field (and return old precision).
void incrIndent() noexcept
Increment the indent level.
virtual Ostream & write(const std::string &str)=0
Write string content (usually quoted).
virtual Ostream & write(const char *data, std::streamsize count)=0
Write binary block.
virtual Ostream & write(const uint64_t val)=0
Write uint64_t.
unsigned short indentLevel_
Current indent level.
virtual Ostream & endEntry()
Write end entry (';') followed by newline.
A class for handling keywords in dictionaries.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Ostream & beginBlock(Ostream &os)
Write begin block group without a name.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
IOstream &(* IOstreamManip)(IOstream &)
An IOstream manipulator.
Ostream & endEntry(Ostream &os)
Write end entry (';') followed by newline.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Ostream &(* OstreamManip)(Ostream &)
An Ostream manipulator.
Ostream & flush(Ostream &os)
Flush stream.
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
Ostream & endBlock(Ostream &os)
Write end block group.
Includes some common C++ headers, defines global macros and templates used in multiple places by Open...