#include <json.hpp>
|
| void | dump_escaped (const string_t &s, const bool ensure_ascii) |
| | dump escaped string
|
| |
| unsigned int | count_digits (number_unsigned_t x) noexcept |
| | count digits
|
| |
| template<typename NumberType , enable_if_t< std::is_signed< NumberType >::value, int > = 0> |
| bool | is_negative_number (NumberType x) |
| |
| template<typename NumberType , enable_if_t< std::is_unsigned< NumberType >::value, int > = 0> |
| bool | is_negative_number (NumberType) |
| |
| 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
|
| |
| void | dump_float (number_float_t x) |
| | dump a floating-point number
|
| |
| void | dump_float (number_float_t x, std::true_type) |
| |
| void | dump_float (number_float_t x, std::false_type) |
| |
| number_unsigned_t | remove_sign (number_unsigned_t x) |
| |
| number_unsigned_t | remove_sign (number_integer_t x) noexcept |
| |
|
| static std::string | hex_bytes (std::uint8_t byte) |
| | convert a byte to a uppercase hex representation
|
| |
| static std::uint8_t | decode (std::uint8_t &state, std::uint32_t &codep, const std::uint8_t byte) noexcept |
| | check whether a string is UTF-8 encoded
|
| |
◆ binary_char_t
template<typename BasicJsonType >
◆ number_float_t
template<typename BasicJsonType >
◆ number_integer_t
template<typename BasicJsonType >
◆ number_unsigned_t
template<typename BasicJsonType >
◆ string_t
template<typename BasicJsonType >
◆ serializer() [1/3]
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/3]
template<typename BasicJsonType >
◆ serializer() [3/3]
template<typename BasicJsonType >
◆ ~serializer()
template<typename BasicJsonType >
◆ count_digits()
template<typename BasicJsonType >
count digits
Count the number of decimal (base 10) digits for an input unsigned integer.
- Parameters
-
| [in] | x | unsigned integer number to count its digits |
- Returns
- number of decimal digits
◆ decode()
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/
◆ dump()
template<typename BasicJsonType >
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 >
◆ dump_float() [3/3]
template<typename BasicJsonType >
◆ dump_integer()
template<typename BasicJsonType >
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 |
◆ hex_bytes()
template<typename BasicJsonType >
convert a byte to a uppercase hex representation
- Parameters
-
| [in] | byte | byte to represent |
- Returns
- representation ("00".."FF")
◆ is_negative_number() [1/2]
template<typename BasicJsonType >
template<typename NumberType ,
enable_if_t< std::is_signed< NumberType >
::value, int > = 0>
◆ is_negative_number() [2/2]
template<typename BasicJsonType >
template<typename NumberType ,
enable_if_t< std::is_unsigned< NumberType >
::value, int > = 0>
◆ operator=() [1/2]
template<typename BasicJsonType >
◆ operator=() [2/2]
template<typename BasicJsonType >
◆ remove_sign() [1/2]
template<typename BasicJsonType >
◆ remove_sign() [2/2]
template<typename BasicJsonType >
◆ decimal_point
template<typename BasicJsonType >
the locale's decimal point character
◆ error_handler
template<typename BasicJsonType >
error_handler how to react on decoding errors
◆ indent_char
template<typename BasicJsonType >
the indentation character
◆ indent_string
template<typename BasicJsonType >
◆ loc
template<typename BasicJsonType >
◆ number_buffer
template<typename BasicJsonType >
a (hopefully) large enough character buffer
template<typename BasicJsonType >
the output of the serializer
◆ string_buffer
template<typename BasicJsonType >
◆ thousands_sep
template<typename BasicJsonType >
the locale's thousand separator character
◆ UTF8_ACCEPT
template<typename BasicJsonType >
◆ UTF8_REJECT
template<typename BasicJsonType >
The documentation for this class was generated from the following file: