nlohmann::json_sax< BasicJsonType > Struct Template Referenceabstract

SAX interface. More...

`#include <json.hpp>`

## Public Types

using | number_integer_t = typename BasicJsonType::number_integer_t
| type for (signed) integers More...
using | number_unsigned_t = typename BasicJsonType::number_unsigned_t
| type for unsigned integers More...
using | number_float_t = typename BasicJsonType::number_float_t
| type for floating-point numbers More...
using | string_t = typename BasicJsonType::string_t
| type for strings More...
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

## Public Member Functions

virtual bool | null ()=0
| a null value was read More...
virtual bool | boolean (bool val)=0
| a boolean value was read More...
virtual bool | number_integer (number_integer_t val)=0
| an integer number was read More...
virtual bool | number_unsigned (number_unsigned_t val)=0
| an unsigned integer number was read More...
virtual bool | number_float (number_float_t val, const string_t &s)=0
| an floating-point number was read More...
virtual bool | string (string_t &val)=0
| a string was read More...
virtual bool | start_object (std::size_t elements)=0
| the beginning of an object was read More...
virtual bool | key (string_t &val)=0
| an object key was read More...
virtual bool | end_object ()=0
| the end of an object was read More...
virtual bool | start_array (std::size_t elements)=0
| the beginning of an array was read More...
virtual bool | end_array ()=0
| the end of an array was read More...
virtual bool | parse_error (std::size_t position, const std::string &last_token, const detail::exception &ex)=0
| a parse error occurred More...
virtual | ~json_sax ()=default
virtual bool | null ()=0
| a null value was read More...
virtual bool | boolean (bool val)=0
| a boolean value was read More...
virtual bool | number_integer (number_integer_t val)=0
| an integer number was read More...
virtual bool | number_unsigned (number_unsigned_t val)=0
| an unsigned integer number was read More...
virtual bool | number_float (number_float_t val, const string_t &s)=0
| an floating-point number was read More...
virtual bool | string (string_t &val)=0
| a string was read More...
virtual bool | binary (binary_t &val)=0
| a binary string was read More...
virtual bool | start_object (std::size_t elements)=0
| the beginning of an object was read More...
virtual bool | key (string_t &val)=0
| an object key was read More...
virtual bool | end_object ()=0
| the end of an object was read More...
virtual bool | start_array (std::size_t elements)=0
| the beginning of an array was read More...
virtual bool | end_array ()=0
| the end of an array was read More...
virtual bool | parse_error (std::size_t position, const std::string &last_token, const detail::exception &ex)=0
| a parse error occurred More...
virtual | ~json_sax ()=default

## Detailed Description

### template<typename BasicJsonType>
struct nlohmann::json_sax< BasicJsonType >

SAX interface.

This class describes the SAX interface used by nlohmann::json::sax_parse. Each function is called in different situations while the input is parsed. The boolean return value informs the parser whether to continue processing the input.

## Member Typedef Documentation

## binary_t

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::binary_t = typename BasicJsonType::binary_t

## number_float_t [1/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::number_float_t = typename BasicJsonType::number_float_t

type for floating-point numbers

## number_float_t [2/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::number_float_t = typename BasicJsonType::number_float_t

## number_integer_t [1/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::number_integer_t = typename BasicJsonType::number_integer_t

type for (signed) integers

## number_integer_t [2/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::number_integer_t = typename BasicJsonType::number_integer_t

## number_unsigned_t [1/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::number_unsigned_t = typename BasicJsonType::number_unsigned_t

type for unsigned integers

## number_unsigned_t [2/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::number_unsigned_t = typename BasicJsonType::number_unsigned_t

## string_t [1/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::string_t = typename BasicJsonType::string_t

type for strings

## string_t [2/2]

template<typename BasicJsonType >

using nlohmann::json_sax< BasicJsonType >::string_t = typename BasicJsonType::string_t

## Constructor & Destructor Documentation

## ~json_sax() [1/2]

template<typename BasicJsonType >

virtual nlohmann::json_sax< BasicJsonType >::~json_sax | ( |  | ) |

virtualdefault

## ~json_sax() [2/2]

template<typename BasicJsonType >

virtual nlohmann::json_sax< BasicJsonType >::~json_sax | ( |  | ) |

virtualdefault

## Member Function Documentation

## binary()

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::binary | ( | binary_t & | val | ) |

pure virtual

a binary string was read

Parameters

  [in] | val | binary value

Returns
  whether parsing should proceed

Note
  It is safe to move the passed binary.

## boolean() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::boolean | ( | bool | val | ) |

pure virtual

a boolean value was read

Parameters

  [in] | val | boolean value

Returns
  whether parsing should proceed

## boolean() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::boolean | ( | bool | val | ) |

pure virtual

a boolean value was read

Parameters

  [in] | val | boolean value

Returns
  whether parsing should proceed

## end_array() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::end_array | ( |  | ) |

pure virtual

the end of an array was read

Returns
  whether parsing should proceed

## end_array() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::end_array | ( |  | ) |

pure virtual

the end of an array was read

Returns
  whether parsing should proceed

## end_object() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::end_object | ( |  | ) |

pure virtual

the end of an object was read

Returns
  whether parsing should proceed

## end_object() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::end_object | ( |  | ) |

pure virtual

the end of an object was read

Returns
  whether parsing should proceed

## key() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::key | ( | string_t & | val | ) |

pure virtual

an object key was read

Parameters

  [in] | val | object key

Returns
  whether parsing should proceed

Note
  It is safe to move the passed string.

## key() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::key | ( | string_t & | val | ) |

pure virtual

an object key was read

Parameters

  [in] | val | object key

Returns
  whether parsing should proceed

Note
  It is safe to move the passed string.

## null() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::null | ( |  | ) |

pure virtual

a null value was read

Returns
  whether parsing should proceed

## null() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::null | ( |  | ) |

pure virtual

a null value was read

Returns
  whether parsing should proceed

## number_float() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::number_float | ( | number_float_t | val,
|  | const string_t & | s
| ) |  |

pure virtual

an floating-point number was read

Parameters

  [in] | val | floating-point value
  [in] | s | raw token value

Returns
  whether parsing should proceed

## number_float() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::number_float | ( | number_float_t | val,
|  | const string_t & | s
| ) |  |

pure virtual

an floating-point number was read

Parameters

  [in] | val | floating-point value
  [in] | s | raw token value

Returns
  whether parsing should proceed

## number_integer() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::number_integer | ( | number_integer_t | val | ) |

pure virtual

an integer number was read

Parameters

  [in] | val | integer value

Returns
  whether parsing should proceed

## number_integer() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::number_integer | ( | number_integer_t | val | ) |

pure virtual

an integer number was read

Parameters

  [in] | val | integer value

Returns
  whether parsing should proceed

## number_unsigned() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::number_unsigned | ( | number_unsigned_t | val | ) |

pure virtual

an unsigned integer number was read

Parameters

  [in] | val | unsigned integer value

Returns
  whether parsing should proceed

## number_unsigned() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::number_unsigned | ( | number_unsigned_t | val | ) |

pure virtual

an unsigned integer number was read

Parameters

  [in] | val | unsigned integer value

Returns
  whether parsing should proceed

## parse_error() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::parse_error | ( | std::size_t | position,
|  | const std::string & | last_token,
|  | const detail::exception & | ex
| ) |  |

pure virtual

a parse error occurred

Parameters

  [in] | position | the position in the input where the error occurs
  [in] | last_token | the last read token
  [in] | ex | an exception object describing the error

Returns
  whether parsing should proceed (must return false)

## parse_error() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::parse_error | ( | std::size_t | position,
|  | const std::string & | last_token,
|  | const detail::exception & | ex
| ) |  |

pure virtual

a parse error occurred

Parameters

  [in] | position | the position in the input where the error occurs
  [in] | last_token | the last read token
  [in] | ex | an exception object describing the error

Returns
  whether parsing should proceed (must return false)

## start_array() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::start_array | ( | std::size_t | elements | ) |

pure virtual

the beginning of an array was read

Parameters

  [in] | elements | number of array elements or -1 if unknown

Returns
  whether parsing should proceed

Note
  binary formats may report the number of elements

## start_array() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::start_array | ( | std::size_t | elements | ) |

pure virtual

the beginning of an array was read

Parameters

  [in] | elements | number of array elements or -1 if unknown

Returns
  whether parsing should proceed

Note
  binary formats may report the number of elements

## start_object() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::start_object | ( | std::size_t | elements | ) |

pure virtual

the beginning of an object was read

Parameters

  [in] | elements | number of object elements or -1 if unknown

Returns
  whether parsing should proceed

Note
  binary formats may report the number of elements

## start_object() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::start_object | ( | std::size_t | elements | ) |

pure virtual

the beginning of an object was read

Parameters

  [in] | elements | number of object elements or -1 if unknown

Returns
  whether parsing should proceed

Note
  binary formats may report the number of elements

## string() [1/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::string | ( | string_t & | val | ) |

pure virtual

a string was read

Parameters

  [in] | val | string value

Returns
  whether parsing should proceed

Note
  It is safe to move the passed string.

## string() [2/2]

template<typename BasicJsonType >

virtual bool nlohmann::json_sax< BasicJsonType >::string | ( | string_t & | val | ) |

pure virtual

a string was read

Parameters

  [in] | val | string value

Returns
  whether parsing should proceed

Note
  It is safe to move the passed string.

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

- build/_deps/json-src/include/nlohmann/json.hpp