#include "json.h"
Public Member Functions | |
serializer (const serializer &)=delete | |
serializer (const serializer &)=delete | |
serializer (output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict) | |
serializer (output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict) | |
serializer (serializer &&)=delete | |
serializer (serializer &&)=delete | |
~serializer ()=default | |
~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 (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... | |
for (std::size_t i=0;i< s.size();++i) | |
for (std::size_t i=0;i< s.size();++i) | |
if (JSON_HEDLEY_LIKELY(state==UTF8_ACCEPT)) | |
if (JSON_HEDLEY_LIKELY(state==UTF8_ACCEPT)) | |
serializer & | operator= (const serializer &)=delete |
serializer & | operator= (const serializer &)=delete |
serializer & | operator= (serializer &&)=delete |
serializer & | operator= (serializer &&)=delete |
Public Attributes | |
JSON_PRIVATE_UNLESS_TESTED | __pad0__: void dump_escaped(const string_t& s |
std::size_t | bytes = 0 |
std::size_t | bytes_after_last_accept = 0 |
const char | decimal_point = '\0' |
the locale's decimal point character More... | |
else | |
JSON_PRIVATE_UNLESS_TESTED const bool | ensure_ascii |
const error_handler_t | error_handler |
error_handler how to react on decoding errors More... | |
const char | indent_char |
the indentation character More... | |
string_t | indent_string |
the indentation string More... | |
const std::lconv * | loc = nullptr |
the locale More... | |
std::array< char, 64 > | number_buffer {{}} |
a (hopefully) large enough character buffer More... | |
std::uint8_t | state = UTF8_ACCEPT |
std::array< char, 512 > | string_buffer {{}} |
string buffer More... | |
const char | thousands_sep = '\0' |
the locale's thousand separator character More... | |
std::size_t | undumped_chars = 0 |
Private Types | |
using | binary_char_t = typename BasicJsonType::binary_t::value_type |
using | binary_char_t = typename BasicJsonType::binary_t::value_type |
using | number_float_t = typename BasicJsonType::number_float_t |
using | number_float_t = typename BasicJsonType::number_float_t |
using | number_integer_t = typename BasicJsonType::number_integer_t |
using | number_integer_t = typename BasicJsonType::number_integer_t |
using | number_unsigned_t = typename BasicJsonType::number_unsigned_t |
using | number_unsigned_t = typename BasicJsonType::number_unsigned_t |
using | string_t = typename BasicJsonType::string_t |
using | string_t = typename BasicJsonType::string_t |
Static Private Attributes | |
static constexpr std::uint8_t | UTF8_ACCEPT = 0 |
static constexpr std::uint8_t | UTF8_REJECT = 1 |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
|
delete |
|
delete |
|
default |
|
inline |
|
delete |
|
delete |
|
default |
|
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.
escape_string()
operator<<
"%g"
format[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) |
Definition at line 15607 of file json.h.
References nlohmann::detail::array, nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::discarded, nlohmann::detail::serializer< BasicJsonType >::ensure_ascii, nlohmann::detail::serializer< BasicJsonType >::indent_string, JSON_ASSERT, JSON_HEDLEY_UNLIKELY, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
Referenced by nlohmann::detail::serializer< BasicJsonType >::dump().
|
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.
escape_string()
operator<<
"%g"
format[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) |
Definition at line 15607 of file json.h.
References nlohmann::detail::array, nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::discarded, nlohmann::detail::serializer< BasicJsonType >::dump(), nlohmann::detail::serializer< BasicJsonType >::ensure_ascii, nlohmann::detail::serializer< BasicJsonType >::indent_string, JSON_ASSERT, JSON_HEDLEY_UNLIKELY, nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.
|
inline |
Definition at line 15901 of file json.h.
References nlohmann::detail::serializer< BasicJsonType >::bytes, nlohmann::detail::serializer< BasicJsonType >::bytes_after_last_accept, nlohmann::detail::type_error::create(), nlohmann::detail::serializer< BasicJsonType >::ensure_ascii, nlohmann::detail::serializer< BasicJsonType >::error_handler, nlohmann::detail::ignore, JSON_ASSERT, JSON_THROW, nlohmann::detail::replace, nlohmann::detail::serializer< BasicJsonType >::state, nlohmann::detail::strict, nlohmann::detail::serializer< BasicJsonType >::string_buffer, nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type(), nlohmann::to_string(), nlohmann::detail::serializer< BasicJsonType >::undumped_chars, nlohmann::detail::serializer< BasicJsonType >::UTF8_ACCEPT, and nlohmann::detail::serializer< BasicJsonType >::UTF8_REJECT.
|
inline |
Definition at line 15901 of file json.h.
References nlohmann::detail::serializer< BasicJsonType >::bytes, nlohmann::detail::serializer< BasicJsonType >::bytes_after_last_accept, nlohmann::detail::type_error::create(), nlohmann::detail::serializer< BasicJsonType >::ensure_ascii, nlohmann::detail::serializer< BasicJsonType >::error_handler, nlohmann::detail::ignore, JSON_ASSERT, JSON_THROW, nlohmann::detail::replace, nlohmann::detail::serializer< BasicJsonType >::state, nlohmann::detail::strict, nlohmann::detail::serializer< BasicJsonType >::string_buffer, nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type(), nlohmann::to_string(), nlohmann::detail::serializer< BasicJsonType >::undumped_chars, nlohmann::detail::serializer< BasicJsonType >::UTF8_ACCEPT, and nlohmann::detail::serializer< BasicJsonType >::UTF8_REJECT.
|
inline |
Definition at line 16090 of file json.h.
References nlohmann::detail::serializer< BasicJsonType >::bytes, and nlohmann::detail::serializer< BasicJsonType >::string_buffer.
|
inline |
Definition at line 16090 of file json.h.
References nlohmann::detail::serializer< BasicJsonType >::bytes, and nlohmann::detail::serializer< BasicJsonType >::string_buffer.
|
delete |
|
delete |
|
delete |
|
delete |
JSON_PRIVATE_UNLESS_TESTED nlohmann::detail::serializer< BasicJsonType >::__pad0__ |
std::size_t nlohmann::detail::serializer< BasicJsonType >::bytes = 0 |
Definition at line 15895 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for(), and nlohmann::detail::serializer< BasicJsonType >::if().
std::size_t nlohmann::detail::serializer< BasicJsonType >::bytes_after_last_accept = 0 |
Definition at line 15898 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for().
const char nlohmann::detail::serializer< BasicJsonType >::decimal_point = '\0' |
nlohmann::detail::serializer< BasicJsonType >::else |
JSON_PRIVATE_UNLESS_TESTED const bool nlohmann::detail::serializer< BasicJsonType >::ensure_ascii |
Definition at line 15891 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::dump(), and nlohmann::detail::serializer< BasicJsonType >::for().
const error_handler_t nlohmann::detail::serializer< BasicJsonType >::error_handler |
error_handler how to react on decoding errors
Definition at line 16456 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for().
const char nlohmann::detail::serializer< BasicJsonType >::indent_char |
string_t nlohmann::detail::serializer< BasicJsonType >::indent_string |
the indentation string
Definition at line 16453 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::dump().
const std::lconv * nlohmann::detail::serializer< BasicJsonType >::loc = nullptr |
std::array< char, 64 > nlohmann::detail::serializer< BasicJsonType >::number_buffer {{}} |
std::uint8_t nlohmann::detail::serializer< BasicJsonType >::state = UTF8_ACCEPT |
Definition at line 15894 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for().
std::array< char, 512 > nlohmann::detail::serializer< BasicJsonType >::string_buffer {{}} |
string buffer
Definition at line 16448 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for(), and nlohmann::detail::serializer< BasicJsonType >::if().
const char nlohmann::detail::serializer< BasicJsonType >::thousands_sep = '\0' |
std::size_t nlohmann::detail::serializer< BasicJsonType >::undumped_chars = 0 |
Definition at line 15899 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for().
|
staticconstexprprivate |
Definition at line 15558 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for().
|
staticconstexprprivate |
Definition at line 15559 of file json.h.
Referenced by nlohmann::detail::serializer< BasicJsonType >::for().