39 #ifndef Foam_Ostream_H 40 #define Foam_Ostream_H 54 constexpr
char tab =
'\t';
55 constexpr
char nl =
'\n';
127 const bool quoted=
true 133 const std::string& str,
134 const bool quoted=
true 170 std::streamsize
count 182 virtual void indent() = 0;
265 if (value1 != value2)
277 virtual void flush() = 0;
280 virtual void endl() = 0;
283 virtual char fill()
const = 0;
286 virtual char fill(
const char fillch) = 0;
289 virtual int width()
const = 0;
292 virtual int width(
const int w) = 0;
308 return const_cast<Ostream&
>(*this);
330 #if __cplusplus >= 201703L 335 os.
check(
"Foam::operator<<(Ostream&, std::string_view)");
341 inline Ostream& operator<<(Ostream& os, stdFoam::span<char>
s)
344 os.
check(
"Foam::operator<<(Ostream&, stdFoam::span<char>)");
349 inline Ostream& operator<<(Ostream& os, stdFoam::span<const char>
s)
352 os.
check(
"Foam::operator<<(Ostream&, stdFoam::span<const char>)");
362 typedef Ostream& (*OstreamManip)(Ostream&);
401 inline Ostream&
flush(Ostream&
os)
A class for handling keywords in dictionaries.
unsigned short indentLevel_
Current indent level.
Ostream & indent(Ostream &os)
Indent stream.
virtual void flush()=0
Flush stream.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
virtual Ostream & writeRaw(const char *data, std::streamsize count)=0
Low-level raw binary output.
constexpr char nl
The newline '\n' character (0x0a)
virtual Ostream & beginBlock()
Write begin block group without a name.
A token holds an item read from Istream.
virtual void endl() override
Add newline and flush stream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream &(* OstreamManip)(Ostream &)
An Ostream manipulator.
virtual bool endRawWrite()=0
Emit end marker for low-level raw binary output.
constexpr char tab
The tab '\t' character(0x09)
Ostream & operator()() const
Return a non-const reference to const Ostream.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Ostream & endEntry(Ostream &os)
Write end entry (';') followed by newline.
A simple container for options an IOstream can normally have.
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true)=0
Write character/string content, with/without surrounding quotes.
void decrIndent()
Decrement the indent level.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
A class for handling words, derived from Foam::string.
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true) override
Write character/string content, with/without surrounding quotes.
virtual Ostream & endBlock()
Write end block group.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual ~Ostream()=default
Destructor.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
virtual void endl()=0
Add newline and flush stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual int width() const =0
Get width of output field.
Ostream(IOstreamOption streamOpt=IOstreamOption())
Default construct (ASCII, uncompressed), construct with specified stream option.
virtual bool beginRawWrite(std::streamsize count)=0
Emit begin marker for low-level raw binary output.
OBJstream os(runTime.globalPath()/outputName)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual char fill() const =0
Get padding character.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
virtual void indent() override
Add indentation characters.
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
Ostream & flush(Ostream &os)
Flush stream.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
const dimensionedScalar c
Speed of light in a vacuum.
Ostream & endBlock(Ostream &os)
Write end block group.
streamFormat
Data format (ascii | binary)
unsigned short indentSize() const noexcept
Return indent size (spaces per level)
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
virtual void flush() override
Flush stream.
unsigned short indentLevel() const noexcept
Return the indent level.
Ostream & beginBlock(Ostream &os)
Write begin block group without a name.
unsigned short indentSize_
Number of spaces per indent level.
virtual Ostream & endEntry()
Write end entry (';') followed by newline.
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 & incrIndent(Ostream &os)
Increment the indent level.
Ostream(const Ostream &)=default
Copy construct.
static constexpr const unsigned short entryIndentation_
Indentation of the entry from the start of the keyword.
IOstream &(* IOstreamManip)(IOstream &)
An IOstream manipulator.
virtual void indent()=0
Add indentation characters.
void incrIndent() noexcept
Increment the indent level.
virtual int precision() const =0
Get precision of output field.
virtual Ostream & writeKeyword(const keyType &kw)
Write the keyword followed by an appropriate indentation.