A library for working with phylogenetic and population genetic data.
v0.32.0
JsonWriter Class Reference

#include <genesis/utils/formats/json/writer.hpp>

Detailed Description

Write Json data from a JsonDocument.

Definition at line 55 of file utils/formats/json/writer.hpp.

Public Member Functions

 JsonWriter ()=default
 
 JsonWriter (JsonWriter &&)=default
 
 JsonWriter (JsonWriter const &)=default
 
 ~JsonWriter ()=default
 
size_t indent () const
 Get the indent used for printing the elements of Json arrays and objects. More...
 
JsonWriterindent (size_t value)
 Set the indent used for printing the elements of Json arrays and objects. More...
 
JsonWriteroperator= (JsonWriter &&)=default
 
JsonWriteroperator= (JsonWriter const &)=default
 
size_t precision () const
 Get the precision used for printing floating point numbers. More...
 
JsonWriterprecision (size_t value)
 Set the precision used for printing floating point numbers. More...
 
std::string to_string (JsonDocument const &document) const
 Return the Json representation of a JsonDocument. More...
 
void write (JsonDocument const &document, std::shared_ptr< utils::BaseOutputTarget > target) const
 Write a JsonDocument to an output target, using the JSON format. More...
 

Constructor & Destructor Documentation

◆ JsonWriter() [1/3]

JsonWriter ( )
default

◆ ~JsonWriter()

~JsonWriter ( )
default

◆ JsonWriter() [2/3]

JsonWriter ( JsonWriter const &  )
default

◆ JsonWriter() [3/3]

JsonWriter ( JsonWriter &&  )
default

Member Function Documentation

◆ indent() [1/2]

size_t indent ( ) const
inline

Get the indent used for printing the elements of Json arrays and objects.

Definition at line 140 of file utils/formats/json/writer.hpp.

◆ indent() [2/2]

JsonWriter& indent ( size_t  value)
inline

Set the indent used for printing the elements of Json arrays and objects.

The function returns a reference to the JsoNWriter to allow for fluent interfaces.

Definition at line 150 of file utils/formats/json/writer.hpp.

◆ operator=() [1/2]

JsonWriter& operator= ( JsonWriter &&  )
default

◆ operator=() [2/2]

JsonWriter& operator= ( JsonWriter const &  )
default

◆ precision() [1/2]

size_t precision ( ) const
inline

Get the precision used for printing floating point numbers.

Definition at line 121 of file utils/formats/json/writer.hpp.

◆ precision() [2/2]

JsonWriter& precision ( size_t  value)
inline

Set the precision used for printing floating point numbers.

The function returns a reference to the JsoNWriter to allow for fluent interfaces.

Definition at line 131 of file utils/formats/json/writer.hpp.

◆ to_string()

std::string to_string ( JsonDocument const &  document) const

Return the Json representation of a JsonDocument.

Definition at line 57 of file utils/formats/json/writer.cpp.

◆ write()

void write ( JsonDocument const &  document,
std::shared_ptr< utils::BaseOutputTarget target 
) const

Write a JsonDocument to an output target, using the JSON format.

See the output target convenience functions utils::to_file(), utils::to_stream(), and utils::to_string() for examples of how to obtain a suitable output target.

Definition at line 51 of file utils/formats/json/writer.cpp.


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