Loading...
Searching...
No Matches
JSONformatter Class Reference

An wrapper for Ostream that outputs content in JSON format. More...

#include <JSONformatter.H>

Public Member Functions

 TypeName ("JSONformatter")
 Declare type-name.
 JSONformatter (Ostream &os)
 Construct from Ostream.
virtual ~JSONformatter ()=default
 Destructor.
virtual Ostreamwrite (const bool val)
virtual Ostreamwrite (const int32_t val)
virtual Ostreamwrite (const int64_t val)
virtual Ostreamwrite (const float val)
virtual Ostreamwrite (const double val)
virtual Ostreamwrite (const word &str)
virtual Ostreamwrite (const std::string &str)
virtual Ostreamwrite (const char *str)
virtual OstreamwriteKeyword (const keyType &keyword)
 Write JSON keyword.
virtual OstreamwriteDict (const dictionary &dict)
 Write OpenFOAM dictionary to JSON dictionary.
template<class Type>
OstreamwriteEntry (const word &keyword, const Type &val)
 Write JSON keyword-value pair (for primitive types).

Detailed Description

An wrapper for Ostream that outputs content in JSON format.

Source files

Definition at line 47 of file JSONformatter.H.

Constructor & Destructor Documentation

◆ JSONformatter()

JSONformatter ( Ostream & os)
explicit

Construct from Ostream.

Definition at line 85 of file JSONformatter.C.

References os().

Here is the call graph for this function:

◆ ~JSONformatter()

virtual ~JSONformatter ( )
virtualdefault

Destructor.

References dict.

Member Function Documentation

◆ TypeName()

TypeName ( "JSONformatter" )

Declare type-name.

References os().

Here is the call graph for this function:

◆ write() [1/8]

Foam::Ostream & write ( const bool val)
virtual

Definition at line 213 of file JSONformatter.C.

◆ write() [2/8]

Foam::Ostream & write ( const int32_t val)
virtual

Definition at line 220 of file JSONformatter.C.

◆ write() [3/8]

Foam::Ostream & write ( const int64_t val)
virtual

Definition at line 227 of file JSONformatter.C.

◆ write() [4/8]

Foam::Ostream & write ( const float val)
virtual

Definition at line 234 of file JSONformatter.C.

◆ write() [5/8]

Foam::Ostream & write ( const double val)
virtual

Definition at line 241 of file JSONformatter.C.

◆ write() [6/8]

Foam::Ostream & write ( const word & str)
virtual

Definition at line 248 of file JSONformatter.C.

References Ostream::writeQuoted().

Here is the call graph for this function:

◆ write() [7/8]

Foam::Ostream & write ( const std::string & str)
virtual

Definition at line 254 of file JSONformatter.C.

References Ostream::writeQuoted().

Here is the call graph for this function:

◆ write() [8/8]

Foam::Ostream & write ( const char * str)
virtual

Definition at line 260 of file JSONformatter.C.

◆ writeKeyword()

Foam::Ostream & writeKeyword ( const keyType & keyword)
virtual

Write JSON keyword.

Definition at line 93 of file JSONformatter.C.

References Ostream::writeQuoted().

Here is the call graph for this function:

◆ writeDict()

Foam::Ostream & writeDict ( const dictionary & dict)
virtual

Write OpenFOAM dictionary to JSON dictionary.

Definition at line 102 of file JSONformatter.C.

References token::BEGIN_LIST, token::BEGIN_SQR, Foam::decrIndent(), dict, e, token::END_LIST, token::END_SQR, Foam::endl(), forAll, Foam::incrIndent(), Foam::indent(), Foam::nl, WarningInFunction, and writeDict().

Referenced by caseInfo::write(), and writeDict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeEntry()

template<class Type>
Ostream & writeEntry ( const word & keyword,
const Type & val )
inline

Write JSON keyword-value pair (for primitive types).

Definition at line 110 of file JSONformatter.H.

References write(), and Ostream::writeQuoted().

Here is the call graph for this function:

The documentation for this class was generated from the following files: