A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JsonWriter Class Reference

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

Detailed Description

Write Json data from a JsonDocument.

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

Public Member Functions

 JsonWriter ()=default
 
 JsonWriter (JsonWriter const &)=default
 
 JsonWriter (JsonWriter &&)=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 const &)=default
 
JsonWriteroperator= (JsonWriter &&)=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...
 
void to_file (JsonDocument const &document, std::string const &filename) const
 Write a JsonDocument to a file. More...
 
void to_stream (JsonDocument const &document, std::ostream &out) const
 Write a JsonDocument to a stream. More...
 
void to_string (JsonDocument const &document, std::string &output) const
 Give the Json string representation of a JsonDocument. More...
 
std::string to_string (JsonDocument const &document) const
 Return the Json representation of a JsonDocument. More...
 

Constructor & Destructor Documentation

JsonWriter ( )
default
~JsonWriter ( )
default
JsonWriter ( JsonWriter const &  )
default
JsonWriter ( JsonWriter &&  )
default

Member Function Documentation

size_t indent ( ) const
inline

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

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

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 160 of file utils/formats/json/writer.hpp.

JsonWriter& operator= ( JsonWriter const &  )
default
JsonWriter& operator= ( JsonWriter &&  )
default
size_t precision ( ) const
inline

Get the precision used for printing floating point numbers.

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

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 141 of file utils/formats/json/writer.hpp.

void to_file ( JsonDocument const &  document,
std::string const &  filename 
) const

Write a JsonDocument to a file.

If the file cannot be written to, the function throws an exception. Also, by default, if the file already exists, an exception is thrown. See Options::allow_file_overwriting() to change this behaviour.

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

void to_stream ( JsonDocument const &  document,
std::ostream &  out 
) const

Write a JsonDocument to a stream.

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

void to_string ( JsonDocument const &  document,
std::string &  output 
) const

Give the Json string representation of a JsonDocument.

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

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

Return the Json representation of a JsonDocument.

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


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