#include <genesis/utils/formats/json/writer.hpp>
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... | |
| JsonWriter & | indent (size_t value) |
| Set the indent used for printing the elements of Json arrays and objects. More... | |
| JsonWriter & | operator= (JsonWriter &&)=default |
| JsonWriter & | operator= (JsonWriter const &)=default |
| size_t | precision () const |
| Get the precision used for printing floating point numbers. More... | |
| JsonWriter & | precision (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... | |
|
default |
|
default |
|
default |
|
default |
|
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.
|
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.
|
default |
|
default |
|
inline |
Get the precision used for printing floating point numbers.
Definition at line 121 of file utils/formats/json/writer.hpp.
|
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.
| 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.
| 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.