WPILibC++
unspecified
|
wrapper around the serialization functions More...
#include <json_serializer.h>
Public Member Functions | |
serializer (const serializer &)=delete | |
serializer & | operator= (const serializer &)=delete |
serializer (llvm::raw_ostream &s) | |
void | dump (const json &val, const bool pretty_print, const unsigned int indent_step, const unsigned int current_indent=0) |
internal implementation of the serialization function More... | |
void | dump_escaped (llvm::StringRef s) const |
dump escaped string More... | |
void | dump_float (double x) |
dump a floating-point number More... | |
wrapper around the serialization functions
|
inlineexplicit |
[in] | s | output stream to serialize to |
[in] | ichar | indentation character to use |
void json::serializer::dump | ( | const json & | val, |
const bool | pretty_print, | ||
const unsigned int | indent_step, | ||
const unsigned int | current_indent = 0 |
||
) |
internal implementation of the serialization function
This function is called by the public member function dump and organizes the serialization internally. The indentation level is propagated as additional parameter. In case of arrays and objects, the function is called recursively.
escape_string()
operator<<
"%g"
format[in] | val | value to serialize |
[in] | pretty_print | whether the output shall be pretty-printed |
[in] | indent_step | the indent level |
[in] | current_indent | the current indent level (only used internally) |
void json::serializer::dump_escaped | ( | llvm::StringRef | s | ) | const |
dump escaped string
Escape a string by replacing certain special characters by a sequence of an escape character (backslash) and another character and other control characters by a sequence of "\u" followed by a four-digit hex representation. The escaped string is written to output stream o.
[in] | s | the string to escape |
Linear in the length of string s.
void json::serializer::dump_float | ( | double | x | ) |
dump a floating-point number
Dump a given floating-point number to output stream o. Works internally with number_buffer.
[in] | x | floating-point number to dump |