STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
detail::serializer< BasicJsonType > Class Template Reference

#include <json.hpp>

Collaboration diagram for detail::serializer< BasicJsonType >:
[legend]

Public Member Functions

 serializer (output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict)
 serializer (const serializer &)=delete
serializer & operator= (const serializer &)=delete
 serializer (serializer &&)=delete
serializer & operator= (serializer &&)=delete
 ~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
 for (std::size_t i=0;i< s.size();++i)
 if (JSON_HEDLEY_LIKELY(state==UTF8_ACCEPT))

Public Attributes

JSON_PRIVATE_UNLESS_TESTED : void dump_escaped(const string_t& s
JSON_PRIVATE_UNLESS_TESTED const bool ensure_ascii
std::uint8_t state = UTF8_ACCEPT
std::size_t bytes = 0
std::size_t bytes_after_last_accept = 0
std::size_t undumped_chars = 0
 else
 enable_if_t< std::is_signed< NumberType >::value, int >
 enable_if_t< std::is_unsigned< NumberType >::value, int >
*a *(hopefully) large enough character buffer std the locale const std::lconv * loc = nullptr
*the locale s thousand separator character const char thousands_sep = '\0'
*the locale s decimal point character const char decimal_point = '\0'
*string buffer std::array< char, 512 > string_buffer {{}}
*the indentation character const char indent_char
*the indentation string string_t indent_string
*error_handler how to react on decoding errors const error_handler_t error_handler

Private Types

using string_t = typename BasicJsonType::string_t
using number_float_t = typename BasicJsonType::number_float_t
using number_integer_t = typename BasicJsonType::number_integer_t
using number_unsigned_t = typename BasicJsonType::number_unsigned_t
using binary_char_t = typename BasicJsonType::binary_t::value_type

Static Private Attributes

static constexpr std::uint8_t UTF8_ACCEPT = 0
static constexpr std::uint8_t UTF8_REJECT = 1

Detailed Description

template<typename BasicJsonType>
class detail::serializer< BasicJsonType >

Definition at line 18059 of file json.hpp.

Member Typedef Documentation

◆ binary_char_t

template<typename BasicJsonType>
using detail::serializer< BasicJsonType >::binary_char_t = typename BasicJsonType::binary_t::value_type
private

Definition at line 18065 of file json.hpp.

◆ number_float_t

template<typename BasicJsonType>
using detail::serializer< BasicJsonType >::number_float_t = typename BasicJsonType::number_float_t
private

Definition at line 18062 of file json.hpp.

◆ number_integer_t

template<typename BasicJsonType>
using detail::serializer< BasicJsonType >::number_integer_t = typename BasicJsonType::number_integer_t
private

Definition at line 18063 of file json.hpp.

◆ number_unsigned_t

template<typename BasicJsonType>
using detail::serializer< BasicJsonType >::number_unsigned_t = typename BasicJsonType::number_unsigned_t
private

Definition at line 18064 of file json.hpp.

◆ string_t

template<typename BasicJsonType>
using detail::serializer< BasicJsonType >::string_t = typename BasicJsonType::string_t
private

Definition at line 18061 of file json.hpp.

Constructor & Destructor Documentation

◆ serializer() [1/3]

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::serializer ( output_adapter_t< char > s,
const char ichar,
error_handler_t error_handler_ = error_handler_t::strict )
inline
Parameters
[in]soutput stream to serialize to
[in]icharindentation character to use
[in]error_handler_how to react on decoding errors

Definition at line 18075 of file json.hpp.

References decimal_point, error_handler, indent_char, indent_string, loc, nullptr, o, detail::strict, and thousands_sep.

Referenced by operator=(), operator=(), serializer(), and serializer().

◆ serializer() [2/3]

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::serializer ( const serializer< BasicJsonType > & )
delete

References serializer().

◆ serializer() [3/3]

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::serializer ( serializer< BasicJsonType > && )
delete

References serializer().

◆ ~serializer()

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::~serializer ( )
default

Member Function Documentation

◆ dump()

template<typename BasicJsonType>
void 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
  • binary values are serialized as objects containing the subtype and the byte array
Parameters
[in]valvalue to serialize
[in]pretty_printwhether the output shall be pretty-printed
[in]ensure_asciiIf 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_stepthe indent level
[in]current_indentthe current indent level (only used internally)

Definition at line 18115 of file json.hpp.

References detail::array, detail::binary, detail::boolean, detail::discarded, dump(), ensure_ascii, indent_string, JSON_ASSERT, JSON_HEDLEY_UNLIKELY, detail::null, detail::number_float, detail::number_integer, detail::number_unsigned, o, detail::object, and detail::string.

Referenced by dump().

◆ for()

◆ if()

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::if ( JSON_HEDLEY_LIKELY(state==UTF8_ACCEPT) )
inline

Definition at line 18598 of file json.hpp.

References bytes, o, state, string_buffer, and UTF8_ACCEPT.

◆ operator=() [1/2]

template<typename BasicJsonType>
serializer & detail::serializer< BasicJsonType >::operator= ( const serializer< BasicJsonType > & )
delete

References serializer().

◆ operator=() [2/2]

template<typename BasicJsonType>
serializer & detail::serializer< BasicJsonType >::operator= ( serializer< BasicJsonType > && )
delete

References serializer().

Member Data Documentation

◆ __pad0__

template<typename BasicJsonType>
JSON_PRIVATE_UNLESS_TESTED detail::serializer< BasicJsonType >::__pad0__

Definition at line 18384 of file json.hpp.

◆ bytes

template<typename BasicJsonType>
std::size_t detail::serializer< BasicJsonType >::bytes = 0

Definition at line 18403 of file json.hpp.

Referenced by for(), and if().

◆ bytes_after_last_accept

template<typename BasicJsonType>
std::size_t detail::serializer< BasicJsonType >::bytes_after_last_accept = 0

Definition at line 18406 of file json.hpp.

Referenced by for().

◆ decimal_point

template<typename BasicJsonType>
* the locale s decimal point character const char detail::serializer< BasicJsonType >::decimal_point = '\0'

Definition at line 18981 of file json.hpp.

Referenced by serializer().

◆ else

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::else

Definition at line 18606 of file json.hpp.

◆ enable_if_t< std::is_signed< NumberType >::value, int >

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::enable_if_t< std::is_signed< NumberType >::value, int >
Initial value:
= 0>
bool is_negative_number(NumberType x)
{
return x < 0;
}
template < typename NumberType

Definition at line 18606 of file json.hpp.

◆ enable_if_t< std::is_unsigned< NumberType >::value, int >

template<typename BasicJsonType>
detail::serializer< BasicJsonType >::enable_if_t< std::is_unsigned< NumberType >::value, int >
Initial value:
= 0 >
bool is_negative_number(NumberType )
{
return false;
}
template < typename NumberType

Definition at line 18606 of file json.hpp.

◆ ensure_ascii

template<typename BasicJsonType>
JSON_PRIVATE_UNLESS_TESTED const bool detail::serializer< BasicJsonType >::ensure_ascii
Initial value:
{
std::uint32_t codepoint{}

Definition at line 18399 of file json.hpp.

Referenced by dump(), and for().

◆ error_handler

template<typename BasicJsonType>
* error_handler how to react on decoding errors const error_handler_t detail::serializer< BasicJsonType >::error_handler

Definition at line 18992 of file json.hpp.

Referenced by for(), and serializer().

◆ indent_char

template<typename BasicJsonType>
* the indentation character const char detail::serializer< BasicJsonType >::indent_char

Definition at line 18987 of file json.hpp.

Referenced by serializer().

◆ indent_string

template<typename BasicJsonType>
* the indentation string string_t detail::serializer< BasicJsonType >::indent_string

Definition at line 18989 of file json.hpp.

Referenced by dump(), and serializer().

◆ loc

template<typename BasicJsonType>
* a* (hopefully) large enough character buffer std the locale const std::lconv* detail::serializer< BasicJsonType >::loc = nullptr

Definition at line 18977 of file json.hpp.

Referenced by serializer().

◆ state

◆ string_buffer

template<typename BasicJsonType>
* string buffer std::array<char, 512> detail::serializer< BasicJsonType >::string_buffer {{}}

Definition at line 18984 of file json.hpp.

Referenced by for(), and if().

◆ thousands_sep

template<typename BasicJsonType>
* the locale s thousand separator character const char detail::serializer< BasicJsonType >::thousands_sep = '\0'

Definition at line 18979 of file json.hpp.

Referenced by serializer().

◆ undumped_chars

template<typename BasicJsonType>
std::size_t detail::serializer< BasicJsonType >::undumped_chars = 0

Definition at line 18407 of file json.hpp.

Referenced by for().

◆ UTF8_ACCEPT

template<typename BasicJsonType>
std::uint8_t detail::serializer< BasicJsonType >::UTF8_ACCEPT = 0
staticconstexprprivate

Definition at line 18066 of file json.hpp.

Referenced by for(), and if().

◆ UTF8_REJECT

template<typename BasicJsonType>
std::uint8_t detail::serializer< BasicJsonType >::UTF8_REJECT = 1
staticconstexprprivate

Definition at line 18067 of file json.hpp.

Referenced by for().


The documentation for this class was generated from the following file:
  • daq-server/diablo_server/lib/include/nlohmann/json.hpp