template<typename BasicJsonType>
class nlohmann::detail::serializer< BasicJsonType >
Definition at line 8265 of file json.hpp.
template<typename BasicJsonType >
|
inlinestaticprivatenoexcept |
check whether a string is UTF-8 encoded
The function checks each byte of a string whether it is UTF-8 encoded. The result of the check is stored in the state parameter. The function must be called initially with state 0 (accept). State 1 means the string must be rejected, because the current byte is not allowed. If the string is completely processed, but the state is non-zero, the string ended prematurely; that is, the last byte indicated more bytes should have followed.
- Parameters
-
[in,out] | state | the state of the decoding |
[in,out] | codep | codepoint (valid only if resulting state is UTF8_ACCEPT) |
[in] | byte | next byte to decode |
- Returns
- new state
- Note
- The function has been edited: a std::array is used.
- Copyright
- Copyright (c) 2008-2009 Bjoern Hoehrmann bjoer.nosp@m.n@ho.nosp@m.ehrma.nosp@m.nn.d.nosp@m.e
- See also
- http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
Definition at line 8809 of file json.hpp.
template<typename BasicJsonType >
void nlohmann::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
- Parameters
-
[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) |
Definition at line 8307 of file json.hpp.
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 sequences |
Linear in the length of string s.
Definition at line 8514 of file json.hpp.
template<typename BasicJsonType >
template<typename NumberType , detail::enable_if_t< std::is_same< NumberType, number_unsigned_t >::value orstd::is_same< NumberType, number_integer_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 |
Definition at line 8669 of file json.hpp.