ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nlohmann::detail::serializer< BasicJsonType > Class Template Reference

#include <acts/blob/master/thirdparty/nlohmann_json/single_include/nlohmann/json.hpp>

+ Collaboration diagram for nlohmann::detail::serializer< BasicJsonType >:

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
 
serializeroperator= (const serializer &)=delete
 
 serializer (serializer &&)=delete
 
serializeroperator= (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
 

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
 

Private Member Functions

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 , detail::enable_if_t< std::is_same< NumberType, number_unsigned_t >::value orstd::is_same< NumberType, number_integer_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 Private Member Functions

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
 

Private Attributes

output_adapter_t< char > o = nullptr
 the output of the serializer
 
std::array< char, 64 > number_buffer {{}}
 a (hopefully) large enough character buffer
 
const std::lconv * loc = nullptr
 the locale
 
const char thousands_sep = '\0'
 the locale's thousand separator character
 
const char decimal_point = '\0'
 the locale's decimal point character
 
std::array< char, 512 > string_buffer {{}}
 string buffer
 
const char indent_char
 the indentation character
 
string_t indent_string
 the indentation string
 
const error_handler_t error_handler
 error_handler how to react on decoding errors
 

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 nlohmann::detail::serializer< BasicJsonType >

Definition at line 13787 of file json.hpp.

View newest version in sPHENIX GitHub at line 13787 of file json.hpp

Member Typedef Documentation

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

Definition at line 13790 of file json.hpp.

View newest version in sPHENIX GitHub at line 13790 of file json.hpp

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

Definition at line 13791 of file json.hpp.

View newest version in sPHENIX GitHub at line 13791 of file json.hpp

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

Definition at line 13792 of file json.hpp.

View newest version in sPHENIX GitHub at line 13792 of file json.hpp

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

Definition at line 13789 of file json.hpp.

View newest version in sPHENIX GitHub at line 13789 of file json.hpp

Constructor & Destructor Documentation

template<typename BasicJsonType >
nlohmann::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 13802 of file json.hpp.

View newest version in sPHENIX GitHub at line 13802 of file json.hpp

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

Member Function Documentation

template<typename BasicJsonType >
unsigned int nlohmann::detail::serializer< BasicJsonType >::count_digits ( number_unsigned_t  x)
inlineprivatenoexcept

count digits

Count the number of decimal (base 10) digits for an input unsigned integer.

Parameters
[in]xunsigned integer number to count its digits
Returns
number of decimal digits

Definition at line 14303 of file json.hpp.

View newest version in sPHENIX GitHub at line 14303 of file json.hpp

References Acts::UnitConstants::u, and x.

template<typename BasicJsonType >
static std::uint8_t nlohmann::detail::serializer< BasicJsonType >::decode ( std::uint8_t &  state,
std::uint32_t &  codep,
const std::uint8_t  byte 
)
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]statethe state of the decoding
[in,out]codepcodepoint (valid only if resulting state is UTF8_ACCEPT)
[in]bytenext byte to decode
Returns
new state
Note
The function has been edited: a std::array is used.
See Also
http://bjoern.hoehrmann.de/utf-8/decoder/dfa/

Definition at line 14527 of file json.hpp.

View newest version in sPHENIX GitHub at line 14527 of file json.hpp

References Acts::UnitConstants::u.

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]valvalue to serialize
[in]pretty_printwhether the output shall be pretty-printed
[in]indent_stepthe indent level
[in]current_indentthe current indent level (only used internally)

Definition at line 13837 of file json.hpp.

View newest version in sPHENIX GitHub at line 13837 of file json.hpp

References JSON_HEDLEY_UNLIKELY.

Referenced by nlohmann::basic_json::dump().

+ Here is the caller graph for this function:

template<typename BasicJsonType >
void nlohmann::detail::serializer< BasicJsonType >::dump_escaped ( const string_t s,
const bool  ensure_ascii 
)
inlineprivate

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]sthe string to escape
[in]ensure_asciiwhether to escape non-ASCII characters with sequences

Linear in the length of string s.

Definition at line 14047 of file json.hpp.

View newest version in sPHENIX GitHub at line 14047 of file json.hpp

References JSON_HEDLEY_LIKELY, JSON_THROW, sn, nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type(), nlohmann::to_string(), and Acts::UnitConstants::u.

+ Here is the call graph for this function:

template<typename BasicJsonType >
void nlohmann::detail::serializer< BasicJsonType >::dump_float ( number_float_t  x)
inlineprivate

dump a floating-point number

Dump a given floating-point number to output stream o. Works internally with number_buffer.

Parameters
[in]xfloating-point number to dump

Definition at line 14428 of file json.hpp.

View newest version in sPHENIX GitHub at line 14428 of file json.hpp

References isfinite.

template<typename BasicJsonType >
void nlohmann::detail::serializer< BasicJsonType >::dump_float ( number_float_t  x,
std::true_type   
)
inlineprivate

Definition at line 14449 of file json.hpp.

View newest version in sPHENIX GitHub at line 14449 of file json.hpp

References nlohmann::detail::to_chars(), and x.

+ Here is the call graph for this function:

template<typename BasicJsonType >
void nlohmann::detail::serializer< BasicJsonType >::dump_float ( number_float_t  x,
std::false_type   
)
inlineprivate

Definition at line 14457 of file json.hpp.

View newest version in sPHENIX GitHub at line 14457 of file json.hpp

References c, d, and x.

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>
void nlohmann::detail::serializer< BasicJsonType >::dump_integer ( NumberType  x)
inlineprivate

dump an integer

Dump a given integer to output stream o. Works internally with number_buffer.

Parameters
[in]xinteger number (signed or unsigned) to dump
Template Parameters
NumberTypeeither number_integer_t or number_unsigned_t

Definition at line 14342 of file json.hpp.

View newest version in sPHENIX GitHub at line 14342 of file json.hpp

References x.

template<typename BasicJsonType >
serializer& nlohmann::detail::serializer< BasicJsonType >::operator= ( const serializer< BasicJsonType > &  )
delete
template<typename BasicJsonType >
serializer& nlohmann::detail::serializer< BasicJsonType >::operator= ( serializer< BasicJsonType > &&  )
delete
template<typename BasicJsonType >
number_unsigned_t nlohmann::detail::serializer< BasicJsonType >::remove_sign ( number_unsigned_t  x)
inlineprivate

Definition at line 14564 of file json.hpp.

View newest version in sPHENIX GitHub at line 14564 of file json.hpp

References x.

template<typename BasicJsonType >
number_unsigned_t nlohmann::detail::serializer< BasicJsonType >::remove_sign ( number_integer_t  x)
inlineprivatenoexcept

Definition at line 14579 of file json.hpp.

View newest version in sPHENIX GitHub at line 14579 of file json.hpp

References max, and x.

Member Data Documentation

template<typename BasicJsonType >
const char nlohmann::detail::serializer< BasicJsonType >::decimal_point = '\0'
private

the locale's decimal point character

Definition at line 14597 of file json.hpp.

View newest version in sPHENIX GitHub at line 14597 of file json.hpp

template<typename BasicJsonType >
const error_handler_t nlohmann::detail::serializer< BasicJsonType >::error_handler
private

error_handler how to react on decoding errors

Definition at line 14608 of file json.hpp.

View newest version in sPHENIX GitHub at line 14608 of file json.hpp

template<typename BasicJsonType >
const char nlohmann::detail::serializer< BasicJsonType >::indent_char
private

the indentation character

Definition at line 14603 of file json.hpp.

View newest version in sPHENIX GitHub at line 14603 of file json.hpp

template<typename BasicJsonType >
string_t nlohmann::detail::serializer< BasicJsonType >::indent_string
private

the indentation string

Definition at line 14605 of file json.hpp.

View newest version in sPHENIX GitHub at line 14605 of file json.hpp

template<typename BasicJsonType >
const std::lconv* nlohmann::detail::serializer< BasicJsonType >::loc = nullptr
private

the locale

Definition at line 14593 of file json.hpp.

View newest version in sPHENIX GitHub at line 14593 of file json.hpp

template<typename BasicJsonType >
std::array<char, 64> nlohmann::detail::serializer< BasicJsonType >::number_buffer {{}}
private

a (hopefully) large enough character buffer

Definition at line 14590 of file json.hpp.

View newest version in sPHENIX GitHub at line 14590 of file json.hpp

template<typename BasicJsonType >
output_adapter_t<char> nlohmann::detail::serializer< BasicJsonType >::o = nullptr
private

the output of the serializer

Definition at line 14587 of file json.hpp.

View newest version in sPHENIX GitHub at line 14587 of file json.hpp

template<typename BasicJsonType >
std::array<char, 512> nlohmann::detail::serializer< BasicJsonType >::string_buffer {{}}
private

string buffer

Definition at line 14600 of file json.hpp.

View newest version in sPHENIX GitHub at line 14600 of file json.hpp

template<typename BasicJsonType >
const char nlohmann::detail::serializer< BasicJsonType >::thousands_sep = '\0'
private

the locale's thousand separator character

Definition at line 14595 of file json.hpp.

View newest version in sPHENIX GitHub at line 14595 of file json.hpp

template<typename BasicJsonType >
constexpr std::uint8_t nlohmann::detail::serializer< BasicJsonType >::UTF8_ACCEPT = 0
staticprivate

Definition at line 13793 of file json.hpp.

View newest version in sPHENIX GitHub at line 13793 of file json.hpp

template<typename BasicJsonType >
constexpr std::uint8_t nlohmann::detail::serializer< BasicJsonType >::UTF8_REJECT = 1
staticprivate

Definition at line 13794 of file json.hpp.

View newest version in sPHENIX GitHub at line 13794 of file json.hpp


The documentation for this class was generated from the following file: