#include </home/runner/work/allwpilib/allwpilib/wpiutil/src/main/native/thirdparty/json/include/wpi/detail/output/serializer.h>
|
| serializer (output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict, size_t indent_init_len=512) |
|
| serializer (raw_ostream &os, const char ichar, size_t indent_init_len=512, error_handler_t error_handler_=error_handler_t::strict) |
|
| serializer (const serializer &)=delete |
|
serializer & | operator= (const serializer &)=delete |
|
| serializer (serializer &&)=delete |
|
serializer & | operator= (serializer &&)=delete |
|
| ~serializer ()=default |
|
void | dump (const BasicJsonType &val, const bool pretty_print, const bool ensure_ascii, const unsigned int indent_step, const unsigned int current_indent=0) |
| internal implementation of the serialization function More...
|
|
void | dump_escaped (std::string_view s, const bool ensure_ascii) |
| dump escaped string More...
|
|
template<typename NumberType , detail::enable_if_t< std::is_integral< NumberType >::value||std::is_same< NumberType, number_unsigned_t >::value||std::is_same< NumberType, number_integer_t >::value||std::is_same< NumberType, binary_char_t >::value, int > = 0> |
void | dump_integer (NumberType x) |
| dump an integer More...
|
|
void | dump_float (number_float_t x) |
| dump a floating-point number More...
|
|
void | dump_float (number_float_t x, std::true_type) |
|
void | dump_float (number_float_t x, std::false_type) |
|
◆ serializer() [1/4]
template<typename BasicJsonType >
- Parameters
-
[in] | s | output stream to serialize to |
[in] | ichar | indentation character to use |
[in] | error_handler_ | how to react on decoding errors |
◆ serializer() [2/4]
template<typename BasicJsonType >
◆ serializer() [3/4]
template<typename BasicJsonType >
◆ serializer() [4/4]
template<typename BasicJsonType >
◆ ~serializer()
template<typename BasicJsonType >
◆ dump()
template<typename BasicJsonType >
void detail::serializer< BasicJsonType >::dump |
( |
const BasicJsonType & |
val, |
|
|
const bool |
pretty_print, |
|
|
const bool |
ensure_ascii, |
|
|
const unsigned int |
indent_step, |
|
|
const unsigned int |
current_indent = 0 |
|
) |
| |
|
inline |
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.
- strings and object keys are escaped using
escape_string()
- integer numbers are converted implicitly via
operator<<
- floating-point numbers are converted to a string using
"%g"
format
- binary values are serialized as objects containing the subtype and the byte array
- Parameters
-
[in] | val | value to serialize |
[in] | pretty_print | whether the output shall be pretty-printed |
[in] | ensure_ascii | If ensure_ascii is true, all non-ASCII characters in the output are escaped with \uXXXX sequences, and the result consists of ASCII characters only. |
[in] | indent_step | the indent level |
[in] | current_indent | the current indent level (only used internally) |
◆ dump_escaped()
template<typename BasicJsonType >
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.
- Parameters
-
[in] | s | the string to escape |
[in] | ensure_ascii | whether to escape non-ASCII characters with \uXXXX sequences |
@complexity Linear in the length of string s.
◆ dump_float() [1/3]
template<typename BasicJsonType >
dump a floating-point number
Dump a given floating-point number to output stream o. Works internally with number_buffer.
- Parameters
-
[in] | x | floating-point number to dump |
◆ dump_float() [2/3]
template<typename BasicJsonType >
void detail::serializer< BasicJsonType >::dump_float |
( |
number_float_t |
x, |
|
|
std::false_type |
|
|
) |
| |
|
inline |
◆ dump_float() [3/3]
template<typename BasicJsonType >
◆ dump_integer()
template<typename BasicJsonType >
template<typename NumberType ,
detail::enable_if_t< std::is_integral< NumberType >::value||std::is_same< NumberType, number_unsigned_t >::value||std::is_same< NumberType, number_integer_t >::value||std::is_same< NumberType, binary_char_t >::value, int > = 0>
dump an integer
Dump a given integer to output stream o. Works internally with number_buffer.
- Parameters
-
[in] | x | integer number (signed or unsigned) to dump |
- Template Parameters
-
NumberType | either number_integer_t or number_unsigned_t |
◆ operator=() [1/2]
template<typename BasicJsonType >
◆ operator=() [2/2]
template<typename BasicJsonType >
The documentation for this class was generated from the following file:
- /home/runner/work/allwpilib/allwpilib/wpiutil/src/main/native/thirdparty/json/include/wpi/detail/output/serializer.h