SIRIUS 7.5.0
Electronic structure library and applications
|
serialization to CBOR and MessagePack values More...
#include <nlohmann_json.hpp>
Public Member Functions | |
binary_writer (output_adapter_t< CharType > adapter) | |
create a binary writer More... | |
void | write_bson (const BasicJsonType &j) |
void | write_cbor (const BasicJsonType &j) |
void | write_msgpack (const BasicJsonType &j) |
void | write_ubjson (const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true, const bool use_bjdata=false) |
Static Public Member Functions | |
template<typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_signed< char >::value > * = nullptr> | |
static constexpr CharType | to_char_type (std::uint8_t x) noexcept |
template<typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_unsigned< char >::value > * = nullptr> | |
static CharType | to_char_type (std::uint8_t x) noexcept |
template<typename C = CharType, enable_if_t< std::is_unsigned< C >::value > * = nullptr> | |
static constexpr CharType | to_char_type (std::uint8_t x) noexcept |
template<typename InputCharType , typename C = CharType, enable_if_t< std::is_signed< C >::value &&std::is_signed< char >::value &&std::is_same< char, typename std::remove_cv< InputCharType >::type >::value > * = nullptr> | |
static constexpr CharType | to_char_type (InputCharType x) noexcept |
Private Types | |
using | string_t = typename BasicJsonType::string_t |
using | binary_t = typename BasicJsonType::binary_t |
using | number_float_t = typename BasicJsonType::number_float_t |
Private Member Functions | |
void | write_bson_entry_header (const string_t &name, const std::uint8_t element_type) |
Writes the given element_type and name to the output adapter. More... | |
void | write_bson_boolean (const string_t &name, const bool value) |
Writes a BSON element with key name and boolean value value. More... | |
void | write_bson_double (const string_t &name, const double value) |
Writes a BSON element with key name and double value value. More... | |
void | write_bson_string (const string_t &name, const string_t &value) |
Writes a BSON element with key name and string value value. More... | |
void | write_bson_null (const string_t &name) |
Writes a BSON element with key name and null value. More... | |
void | write_bson_integer (const string_t &name, const std::int64_t value) |
Writes a BSON element with key name and integer value. More... | |
void | write_bson_unsigned (const string_t &name, const BasicJsonType &j) |
Writes a BSON element with key name and unsigned value. More... | |
void | write_bson_object_entry (const string_t &name, const typename BasicJsonType::object_t &value) |
Writes a BSON element with key name and object value. More... | |
void | write_bson_array (const string_t &name, const typename BasicJsonType::array_t &value) |
Writes a BSON element with key name and array value. More... | |
void | write_bson_binary (const string_t &name, const binary_t &value) |
Writes a BSON element with key name and binary value value. More... | |
void | write_bson_element (const string_t &name, const BasicJsonType &j) |
Serializes the JSON value j to BSON and associates it with the key name. More... | |
void | write_bson_object (const typename BasicJsonType::object_t &value) |
template<typename NumberType , typename std::enable_if< std::is_floating_point< NumberType >::value, int >::type = 0> | |
void | write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix, const bool use_bjdata) |
template<typename NumberType , typename std::enable_if< std::is_unsigned< NumberType >::value, int >::type = 0> | |
void | write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix, const bool use_bjdata) |
template<typename NumberType , typename std::enable_if< std::is_signed< NumberType >::value &&!std::is_floating_point< NumberType >::value, int >::type = 0> | |
void | write_number_with_ubjson_prefix (const NumberType n, const bool add_prefix, const bool use_bjdata) |
CharType | ubjson_prefix (const BasicJsonType &j, const bool use_bjdata) const noexcept |
determine the type prefix of container values More... | |
bool | write_bjdata_ndarray (const typename BasicJsonType::object_t &value, const bool use_count, const bool use_type) |
template<typename NumberType > | |
void | write_number (const NumberType n, const bool OutputIsLittleEndian=false) |
void | write_compact_float (const number_float_t n, detail::input_format_t format) |
Static Private Member Functions | |
static std::size_t | calc_bson_entry_header_size (const string_t &name, const BasicJsonType &j) |
static std::size_t | calc_bson_string_size (const string_t &value) |
static std::size_t | calc_bson_integer_size (const std::int64_t value) |
static constexpr std::size_t | calc_bson_unsigned_size (const std::uint64_t value) noexcept |
static std::size_t | calc_bson_array_size (const typename BasicJsonType::array_t &value) |
static std::size_t | calc_bson_binary_size (const typename BasicJsonType::binary_t &value) |
static std::size_t | calc_bson_element_size (const string_t &name, const BasicJsonType &j) |
Calculates the size necessary to serialize the JSON value j with its name. More... | |
static std::size_t | calc_bson_object_size (const typename BasicJsonType::object_t &value) |
Calculates the size of the BSON serialization of the given JSON-object j. More... | |
static constexpr CharType | get_cbor_float_prefix (float) |
static constexpr CharType | get_cbor_float_prefix (double) |
static constexpr CharType | get_msgpack_float_prefix (float) |
static constexpr CharType | get_msgpack_float_prefix (double) |
static constexpr CharType | get_ubjson_float_prefix (float) |
static constexpr CharType | get_ubjson_float_prefix (double) |
Private Attributes | |
const bool | is_little_endian = little_endianness() |
whether we can assume little endianness More... | |
output_adapter_t< CharType > | oa = nullptr |
the output More... | |
serialization to CBOR and MessagePack values
Definition at line 14992 of file nlohmann_json.hpp.
|
private |
Definition at line 14994 of file nlohmann_json.hpp.
|
private |
Definition at line 14995 of file nlohmann_json.hpp.
|
private |
Definition at line 14996 of file nlohmann_json.hpp.
|
inlineexplicit |
create a binary writer
[in] | adapter | output adapter to write to |
Definition at line 15004 of file nlohmann_json.hpp.
|
inline |
[in] | j | JSON value to serialize |
Definition at line 15013 of file nlohmann_json.hpp.
|
inline |
[in] | j | JSON value to serialize |
Definition at line 15042 of file nlohmann_json.hpp.
|
inline |
[in] | j | JSON value to serialize |
Definition at line 15366 of file nlohmann_json.hpp.
|
inline |
[in] | j | JSON value to serialize |
[in] | use_count | whether to use '#' prefixes (optimized format) |
[in] | use_type | whether to use '$' prefixes (optimized format) |
[in] | add_prefix | whether prefixes need to be used for this value |
[in] | use_bjdata | whether write in BJData format, default is false |
Definition at line 15692 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Definition at line 15913 of file nlohmann_json.hpp.
|
inlineprivate |
Writes the given element_type and name to the output adapter.
Definition at line 15928 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and boolean value value.
Definition at line 15940 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and double value value.
Definition at line 15950 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Definition at line 15960 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and string value value.
Definition at line 15968 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and null value.
Definition at line 15982 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Definition at line 15990 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and integer value.
Definition at line 16000 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivatenoexcept |
Definition at line 16018 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and unsigned value.
Definition at line 16028 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and object value.
Definition at line 16050 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Definition at line 16060 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Definition at line 16075 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and array value.
Definition at line 16083 of file nlohmann_json.hpp.
|
inlineprivate |
Writes a BSON element with key name and binary value value.
Definition at line 16102 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Calculates the size necessary to serialize the JSON value j with its name.
Definition at line 16117 of file nlohmann_json.hpp.
|
inlineprivate |
Serializes the JSON value j to BSON and associates it with the key name.
name | The name to associate with the JSON entity j within the current BSON document |
Definition at line 16165 of file nlohmann_json.hpp.
|
inlinestaticprivate |
Calculates the size of the BSON serialization of the given JSON-object j.
[in] | value | JSON value to serialize |
Definition at line 16212 of file nlohmann_json.hpp.
|
inlineprivate |
[in] | value | JSON value to serialize |
Definition at line 16227 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivate |
Definition at line 16243 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivate |
Definition at line 16248 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivate |
Definition at line 16257 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivate |
Definition at line 16262 of file nlohmann_json.hpp.
|
inlineprivate |
Definition at line 16274 of file nlohmann_json.hpp.
|
inlineprivate |
Definition at line 16288 of file nlohmann_json.hpp.
|
inlineprivate |
Definition at line 16376 of file nlohmann_json.hpp.
|
inlineprivatenoexcept |
determine the type prefix of container values
Definition at line 16457 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivate |
Definition at line 16558 of file nlohmann_json.hpp.
|
inlinestaticconstexprprivate |
Definition at line 16563 of file nlohmann_json.hpp.
|
inlineprivate |
Definition at line 16571 of file nlohmann_json.hpp.
|
inlineprivate |
Definition at line 16698 of file nlohmann_json.hpp.
|
inlineprivate |
Definition at line 16714 of file nlohmann_json.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 16748 of file nlohmann_json.hpp.
|
inlinestaticnoexcept |
Definition at line 16755 of file nlohmann_json.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 16766 of file nlohmann_json.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 16777 of file nlohmann_json.hpp.
|
private |
whether we can assume little endianness
Definition at line 16784 of file nlohmann_json.hpp.
|
private |
the output
Definition at line 16787 of file nlohmann_json.hpp.