|
slot 0.0.1
A real time UI render framework
|
deserialization of CBOR, MessagePack, and UBJSON values 更多...
#include <json.hpp>

Public 成员函数 | |
| binary_reader (InputAdapterType &&adapter, const input_format_t format=input_format_t::json) noexcept | |
| create a binary reader | |
| binary_reader (const binary_reader &)=delete | |
| binary_reader (binary_reader &&)=default | |
| binary_reader & | operator= (const binary_reader &)=delete |
| binary_reader & | operator= (binary_reader &&)=default |
| ~binary_reader ()=default | |
| bool | sax_parse (const input_format_t format, json_sax_t *sax_, const bool strict=true, const cbor_tag_handler_t tag_handler=cbor_tag_handler_t::error) |
Private 类型 | |
| using | number_integer_t = typename BasicJsonType::number_integer_t |
| using | number_unsigned_t = typename BasicJsonType::number_unsigned_t |
| using | number_float_t = typename BasicJsonType::number_float_t |
| using | string_t = typename BasicJsonType::string_t |
| using | binary_t = typename BasicJsonType::binary_t |
| using | json_sax_t = SAX |
| using | char_type = typename InputAdapterType::char_type |
| using | char_int_type = typename char_traits<char_type>::int_type |
| using | bjd_type = std::pair<char_int_type, string_t> |
Private 属性 | |
| InputAdapterType | ia |
| input adapter | |
| char_int_type | current = char_traits<char_type>::eof() |
| the current character | |
| std::size_t | chars_read = 0 |
| the number of characters read | |
| const bool | is_little_endian = little_endianness() |
| whether we can assume little endianness | |
| const input_format_t | input_format = input_format_t::json |
| input format | |
| json_sax_t * | sax = nullptr |
| the SAX parser | |
| JSON_PRIVATE_UNLESS_TESTED | : const decltype(JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_) bjd_optimized_type_markers = JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_ |
| const decltype(JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_) | bjd_types_map |
静态 Private 属性 | |
| static JSON_INLINE_VARIABLE constexpr std::size_t | npos = static_cast<std::size_t>(-1) |
deserialization of CBOR, MessagePack, and UBJSON values
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineexplicitnoexcept |
create a binary reader
| [in] | adapter | input adapter to read from |
|
delete |
|
default |
|
default |
|
inlineprivate |
| [in] | format | the current format |
| [in] | detail | a detailed error message |
| [in] | context | further context information |

|
inlineprivate |
get next character from the input
This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a -'ve valued char_traits<char_type>::eof() in that case.
|
inlineprivate |
create a byte array by reading bytes from the input
| NumberType | the type of the number |
| [in] | format | the current format (for diagnostics) |
| [in] | len | number of bytes to read |
| [out] | result | byte array created by reading len bytes |

|
inlineprivate |
Parses a byte array input of length len from the BSON input.
| [in] | len | The length of the byte array to be read. |
| [in,out] | result | A reference to the binary variable where the read array is to be stored. |
| NumberType | The type of the length len |
true if the byte array was successfully parsed 
|
inlineprivate |
Parses a C-style string from the BSON input.
| [in,out] | result | A reference to the string variable where the read string is to be stored. |
true if the \x00-byte indicating the end of the string was encountered before the EOF; false` indicates an unexpected EOF. 
|
inlineprivate |
Parses a zero-terminated string of length len from the BSON input.
| [in] | len | The length (including the zero-byte at the end) of the string to be read. |
| [in,out] | result | A reference to the string variable where the read string is to be stored. |
| NumberType | The type of the length len |
true if the string was successfully parsed 
|
inlineprivate |
| [in] | len | the length of the array or static_cast<std::size_t>(-1) for an array of indefinite size |
| [in] | tag_handler | how CBOR tags should be treated |

|
inlineprivate |
reads a CBOR byte array
This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into the byte array. Additionally, CBOR's byte arrays with indefinite lengths are supported.
| [out] | result | created byte array |

|
inlineprivate |
| [in] | len | the length of the object or static_cast<std::size_t>(-1) for an object of indefinite size |
| [in] | tag_handler | how CBOR tags should be treated |

|
inlineprivate |
reads a CBOR string
This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. Additionally, CBOR's strings with indefinite lengths are supported.
| [out] | result | created string |

|
inlineprivate |

|
inlineprivate |
| [in] | len | the length of the array |
|
inlineprivate |
reads a MessagePack byte array
This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into a byte array.
| [out] | result | created byte array |
|
inlineprivate |
| [in] | len | the length of the object |

|
inlineprivate |
reads a MessagePack string
This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string.
| [out] | result | created string |

|
inlineprivate |

|
inlineprivate |
create a string by reading characters from the input
| NumberType | the type of the number |
| [in] | format | the current format (for diagnostics) |
| [in] | len | number of characters to read |
| [out] | result | string created by reading len bytes |

|
inlineprivate |
|
inlineprivate |
|
inlineprivate |

|
inlineprivate |
| [out] | dim | an integer vector storing the ND array dimensions |
|
inlineprivate |
|
inlineprivate |
determine the type and size for a container
In the optimized UBJSON format, a type and a size can be provided to allow for a more compact representation.
| [out] | result | pair of the size and the type |
| [in] | inside_ndarray | whether the parser is parsing an ND array dimensional vector |

|
inlineprivate |
| [out] | result | determined size |
| [in,out] | is_ndarray | for input, true means already inside an ndarray vector or ndarray dimension is not allowed; false means ndarray is allowed; for output, true means an ndarray is found; is_ndarray can only return true when its initial value is false |
| [in] | prefix | type marker if already read, otherwise set to 0 |
|
inlineprivate |
reads a UBJSON string
This function is either called after reading the 'S' byte explicitly indicating a string, or in case of an object key where the 'S' byte can be left out.
| [out] | result | created string |
| [in] | get_char | whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead |

|
inlineprivate |
| prefix | the previously read or set type prefix |

|
default |
|
delete |
|
inlineprivate |
Reads an array from the BSON input and passes it to the SAX-parser.
|
inlineprivate |
Read a BSON document element of the given element_type.
| [in] | element_type | The BSON element type, c.f. http://bsonspec.org/spec.html |
| [in] | element_type_parse_position | The position in the input stream, where the element_type was read. |

|
inlineprivate |
Read a BSON element list (as specified in the BSON-spec)
The same binary layout is used for objects and arrays, hence it must be indicated with the argument is_array which one is expected (true --> array, false --> object).
| [in] | is_array | Determines if the element list being read is to be treated as an object (is_array == false), or as an array (is_array == true). |

|
inlineprivate |
Reads in a BSON-object and passes it to the SAX-parser.
|
inlineprivate |
| [in] | get_char | whether a new character should be retrieved from the input (true) or whether the last read character should be considered instead (false) |
| [in] | tag_handler | how CBOR tags should be treated |

|
inlineprivate |

|
inlineprivate |
| [in] | get_char | whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead |
|
inline |
| [in] | format | the binary format to parse |
| [in] | sax_ | a SAX event processor |
| [in] | strict | whether to expect the input to be consumed completed |
| [in] | tag_handler | how to treat CBOR tags |

|
inlineprivate |
| [in] | format | the current format (for diagnostics) |
| [in] | context | further context information (for diagnostics) |
|
private |
|
private |
|
private |
the number of characters read
|
private |
the current character
|
private |
input adapter
|
private |
input format
|
private |
whether we can assume little endianness
|
staticconstexprprivate |
|
private |
the SAX parser