nlohmann::detail::serializer< BasicJsonType > Class Template Reference

#include <json.hpp>

Public Member Functions

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 More...
 
serializeroperator= (const serializer &)=delete
 
serializeroperator= (serializer &&)=delete
 
 serializer (const serializer &)=delete
 
 serializer (output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict)
 
 serializer (serializer &&)=delete
 
 ~serializer ()=default
 

Constructor & Destructor Documentation

◆ serializer() [1/3]

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 
)
Parameters
[in]soutput stream to serialize to
[in]icharindentation character to use
[in]error_handler_how to react on decoding errors

◆ serializer() [2/3]

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

◆ serializer() [3/3]

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

◆ ~serializer()

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

Member Function Documentation

◆ dump()

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 
)

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)

References nlohmann::detail::array, nlohmann::detail::binary, nlohmann::detail::boolean, nlohmann::detail::discarded, nlohmann::detail::serializer< BasicJsonType >::dump(), nlohmann::detail::null, nlohmann::detail::number_float, nlohmann::detail::number_integer, nlohmann::detail::number_unsigned, nlohmann::detail::object, and nlohmann::detail::string.

Referenced by nlohmann::detail::serializer< BasicJsonType >::dump().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

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