JSONformatter Class Reference

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

Public Member Functions

 TypeName ("JSONformatter")
 Declare type-name. More...
 
 JSONformatter (Ostream &os)
 Construct from Ostream. More...
 
virtual ~JSONformatter ()=default
 Destructor. More...
 
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. More...
 
virtual OstreamwriteDict (const dictionary &dict)
 Write OpenFOAM dictionary to JSON dictionary. More...
 
template<class Type >
OstreamwriteEntry (const word &keyword, const Type &val)
 Write JSON keyword-value pair (for primitive types) More...
 

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 81 of file JSONformatter.C.

◆ ~JSONformatter()

virtual ~JSONformatter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ TypeName()

TypeName ( "JSONformatter"  )

Declare type-name.

◆ write() [1/8]

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

Definition at line 203 of file JSONformatter.C.

Referenced by JSONformatter::writeEntry().

Here is the caller graph for this function:

◆ write() [2/8]

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

Definition at line 210 of file JSONformatter.C.

◆ write() [3/8]

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

Definition at line 217 of file JSONformatter.C.

◆ write() [4/8]

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

Definition at line 224 of file JSONformatter.C.

◆ write() [5/8]

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

Definition at line 231 of file JSONformatter.C.

◆ write() [6/8]

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

Definition at line 238 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 244 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 250 of file JSONformatter.C.

References Foam::constant::universal::c.

◆ writeKeyword()

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

Write JSON keyword.

Definition at line 90 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 98 of file JSONformatter.C.

References token::BEGIN_LIST, token::BEGIN_SQR, Foam::decrIndent(), dict, Foam::constant::electromagnetic::e, token::END_LIST, token::END_SQR, forAll, Foam::incrIndent(), Foam::indent(), Foam::nl, and Ostream::writeQuoted().

Referenced by caseInfo::write().

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

◆ writeEntry()

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 JSONformatter::write(), and Ostream::writeQuoted().

Here is the call graph for this function:

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