JSON Voorhees
Killer JSON for C++
|
An encoder is responsible for writing values to some form of output. More...
#include <jsonv/encode.hpp>
Public Member Functions | |
void | encode (const jsonv::value &source) |
Encode some source value into this encoder. More... | |
Protected Member Functions | |
virtual void | write_null ()=0 |
Write the null value. More... | |
virtual void | write_object_begin ()=0 |
Write the opening of an object value. More... | |
virtual void | write_object_end ()=0 |
Write the closing of an object value. More... | |
virtual void | write_object_key (string_view key)=0 |
Write the key for an object, including the separator. More... | |
virtual void | write_object_delimiter ()=0 |
Write the delimiter between two entries in an object. More... | |
virtual void | write_array_begin ()=0 |
Write the opening of an array value. More... | |
virtual void | write_array_end ()=0 |
Write the closing of an array value. More... | |
virtual void | write_array_delimiter ()=0 |
Write the delimiter between two entries in an array. More... | |
virtual void | write_string (string_view value)=0 |
Write a string value. More... | |
virtual void | write_integer (std::int64_t value)=0 |
Write an integer value. More... | |
virtual void | write_decimal (double value)=0 |
Write a decimal value. More... | |
virtual void | write_boolean (bool value)=0 |
Write a boolean value. More... | |
An encoder is responsible for writing values to some form of output.
Definition at line 25 of file encode.hpp.
void jsonv::encoder::encode | ( | const jsonv::value & | source | ) |
Encode some source value into this encoder.
This is the only useful entry point to this class.
|
protectedpure virtual |
Write the opening of an array value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the delimiter between two entries in an array.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the closing of an array value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write a boolean value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write a decimal value.
value | is the decimal to write. Keep in mind that standard JSON does not support special IEEE 754 values such as NaN and infinity. It is the implementation's choice of how to deal with such values. Two common options are to output null or to encode a string description of the special value. |
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write an integer value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the null value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the opening of an object value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the delimiter between two entries in an object.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the closing of an object value.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write the key for an object, including the separator.
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.
|
protectedpure virtual |
Write a string value.
value | is the string to write. It will hopefully be encoded as valid UTF-8. It is the implementation's choice of how to deal with malformed string values. Two common options are to replace malformed sequences with ?s or to simply output these encodings and let the receiver deal with them. |
Implemented in jsonv::ostream_pretty_encoder, and jsonv::ostream_encoder.