GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::json Namespace Reference

Classes

class  ObjectBase
 JSON object type whose API mimics that of std::map<String, Value>. More...
class  ArrayBase
 JSON array type whose API mimics that of std::vector<Value>. More...
struct  SourceLocation
 Line and column numbers of a location in a JSON source string. More...
struct  Error
 Exception type for errors originating from the JSON API. More...
struct  SerializationOptions
 Options for JSON serialization. More...
struct  DeserializationOptions
 Options for JSON deserialization. More...
class  VariantBase
 JSON value type. More...
class  ValueBase
 JSON value with an associated SourceLocation. More...
struct  TokenBase
 Token data scanned from JSON. More...
class  Lexer
 Lexical analyzer for scanning and tokenizing input in the JSON5 format. More...
class  Parser
 Syntactic analyzer for parsing input in the JSON5 format obtained from a json::Lexer. More...
struct  Serializer
 Base template to specialize in order to implement JSON serialization for a specific type. More...
struct  Deserializer
 Base template to specialize in order to implement JSON deserialization for a specific type. More...
struct  Writer
 Stateful wrapper object of an output stream for JSON serialization. More...
struct  Reader
 Stateful wrapper object of an input stream for JSON deserialization. More...
struct  Serializer< grem::physics::Quantity< N, UnitT > >
struct  Deserializer< grem::physics::Quantity< N, UnitT > >

Typedefs

using Null = Monostate
 JSON null type.
using Boolean = bool
 JSON boolean type.
template<template< typename > typename Allocator>
using StringBase = grem::StringBase<char, std::char_traits<char>, Allocator<char>>
 JSON string type.
using String = StringBase<std::allocator>
 JSON string type using the default allocator.
using Number = double
 JSON number type.
using Object = json::ObjectBase<std::allocator>
 JSON object type using the default allocator.
using Array = json::ArrayBase<std::allocator>
 JSON array type using the default allocator.
using Variant = json::VariantBase<std::allocator>
 JSON value type using the default allocator.
using Value = json::ValueBase<std::allocator>
 JSON value type with an associated SourceLocation using the default allocator.
template<template< typename > typename Allocator>
using StringParserBase = Parser<const char8_t*, Allocator>
 Parser for reading contiguous UTF-8-encoded JSON strings.
using StringParser = StringParserBase<std::allocator>
 Parser for reading contiguous UTF-8-encoded JSON strings using the default allocator.
template<template< typename > typename Allocator>
using StreamParserBase = Parser<std::istreambuf_iterator<char>, Allocator>
 Parser for reading UTF-8-encoded JSON input stream buffers.
using StreamParser = StreamParserBase<std::allocator>
 Parser for reading UTF-8-encoded JSON input stream buffers using the default allocator.

Enumerations

enum class  TokenType : uint8_t {
  END_OF_FILE , IDENTIFIER_NULL , IDENTIFIER_FALSE , IDENTIFIER_TRUE ,
  IDENTIFIER_NAME , PUNCTUATOR_COMMA , PUNCTUATOR_COLON , PUNCTUATOR_OPEN_SQUARE_BRACKET ,
  PUNCTUATOR_CLOSE_SQUARE_BRACKET , PUNCTUATOR_OPEN_CURLY_BRACE , PUNCTUATOR_CLOSE_CURLY_BRACE , STRING ,
  NUMBER_BINARY , NUMBER_OCTAL , NUMBER_DECIMAL , NUMBER_HEXADECIMAL ,
  NUMBER_POSITIVE_INFINITY , NUMBER_NEGATIVE_INFINITY , NUMBER_POSITIVE_NAN , NUMBER_NEGATIVE_NAN
}
 Type of a scanned JSON5 token. More...

Functions

template<template< typename > typename Allocator, typename Predicate>
ObjectBase< Allocator >::size_type erase_if (ObjectBase< Allocator > &container, Predicate predicate)
template<template< typename > typename Allocator, typename U>
ArrayBase< Allocator >::size_type erase (ArrayBase< Allocator > &container, const U &value)
template<template< typename > typename Allocator, typename Predicate>
ArrayBase< Allocator >::size_type erase_if (ArrayBase< Allocator > &container, Predicate predicate)
constexpr bool isWhitespace (char32_t codePoint) noexcept
 Check if a Unicode code point is considered to be whitespace in JSON5.
constexpr bool isPunctuationCharacter (char32_t codePoint) noexcept
 Check if a Unicode code point is considered to be punctuation in JSON5.
constexpr bool isLineTerminatorCharacter (char32_t codePoint) noexcept
 Check if a Unicode code point marks the beginning of a line terminator sequence in JSON5.
template<typename T, typename SerializerOverride = detail::NoSerializerOverride>
void serialize (std::ostream &stream, const T &value, const SerializationOptions &options={}, SerializerOverride serializerOverride={})
 Serialize a value of any JSON-serializable type to an output stream.
template<typename T, typename DeserializerOverride = detail::NoDeserializerOverride>
void deserialize (std::istream &stream, T &value, const DeserializationOptions &options={}, DeserializerOverride deserializerOverride={}, const SourceLocation &source={})
 Deserialize a value of any JSON-serializable type from an input stream.
template<template< typename > typename Allocator>
std::ostream & operator<< (std::ostream &stream, const ObjectBase< Allocator > &value)
 Write a JSON object to an output stream using the default serialization options.
template<template< typename > typename Allocator>
std::istream & operator>> (std::istream &stream, ObjectBase< Allocator > &value)
 Read a JSON object from an input stream using the default deserialization options.
template<template< typename > typename Allocator>
std::ostream & operator<< (std::ostream &stream, const ArrayBase< Allocator > &value)
 Write a JSON array to an output stream using the default serialization options.
template<template< typename > typename Allocator>
std::istream & operator>> (std::istream &stream, ArrayBase< Allocator > &value)
 Read a JSON array from an input stream using the default deserialization options.
template<template< typename > typename Allocator>
std::ostream & operator<< (std::ostream &stream, const VariantBase< Allocator > &value)
 Write a JSON value to an output stream using the default serialization options.
template<template< typename > typename Allocator>
std::istream & operator>> (std::istream &stream, VariantBase< Allocator > &value)
 Read a JSON value from an input stream using the default deserialization options.
template<template< typename > typename Allocator>
std::ostream & operator<< (std::ostream &stream, const ValueBase< Allocator > &value)
 Write a JSON value to an output stream using the default serialization options.
template<template< typename > typename Allocator>
std::istream & operator>> (std::istream &stream, ValueBase< Allocator > &value)
 Read a JSON value from an input stream using the default deserialization options.
template<typename T, typename SerializerOverride = detail::NoSerializerOverride, typename Allocator = std::allocator<char>>
grem::StringBase< char, std::char_traits< char >, Allocator > serializeToString (const T &value, const SerializationOptions &options={}, SerializerOverride serializerOverride={}, const Allocator &allocator=Allocator())
 Serialize a value of any JSON-serializable type to a string.
template<typename T, typename DeserializerOverride = detail::NoDeserializerOverride, typename Allocator = std::allocator<char>>
void deserializeFromString (grem::StringBase< char, std::char_traits< char >, Allocator > string, T &value, const DeserializationOptions &options={}, DeserializerOverride deserializerOverride={}, const SourceLocation &source={})
 Deserialize a value of any JSON-serializable type from a string.
template<typename T, typename DeserializerOverride = detail::NoDeserializerOverride, typename Allocator = std::allocator<char>>
T deserializeFromString (grem::StringBase< char, std::char_traits< char >, Allocator > string, const DeserializationOptions &options={}, DeserializerOverride deserializerOverride={}, const SourceLocation &source={})
 Deserialize a value of any JSON-serializable type from a string.
template<typename Callback>
auto onNull (Callback callback)
 Build a Parser::ValueVisitor that handles Null values with a given callback function.
template<typename Callback>
auto onBoolean (Callback callback)
 Build a Parser::ValueVisitor that handles Boolean values with a given callback function.
template<typename Callback>
auto onString (Callback callback)
 Build a Parser::ValueVisitor that handles String values with a given callback function.
template<typename Callback>
auto onNumber (Callback callback)
 Build a Parser::ValueVisitor that handles Number values with a given callback function.
template<typename Callback>
auto onObject (Callback callback)
 Build a Parser::ValueVisitor that handles objects with a given callback function.
template<typename Callback>
auto onArray (Callback callback)
 Build a Parser::ValueVisitor that handles arrays with a given callback function.
template<typename Callback>
auto onProperty (Callback callback)
 Build a Parser::PropertyVisitor that handles object properties with a given callback function.
template<template< typename > typename Allocator>
void swap (ObjectBase< Allocator > &a, ObjectBase< Allocator > &b) noexcept
template<template< typename > typename Allocator>
void swap (ArrayBase< Allocator > &a, ArrayBase< Allocator > &b) noexcept

Typedef Documentation

◆ Null

JSON null type.

◆ Boolean

using grem::json::Boolean = bool

JSON boolean type.

◆ StringBase

template<template< typename > typename Allocator>
using grem::json::StringBase = grem::StringBase<char, std::char_traits<char>, Allocator<char>>

JSON string type.

Template Parameters
Allocatorallocator type template to use.

◆ String

using grem::json::String = StringBase<std::allocator>

JSON string type using the default allocator.

◆ Number

using grem::json::Number = double

JSON number type.

◆ Object

using grem::json::Object = json::ObjectBase<std::allocator>

JSON object type using the default allocator.

◆ Array

using grem::json::Array = json::ArrayBase<std::allocator>

JSON array type using the default allocator.

◆ Variant

typedef json::VariantBase< std::allocator > grem::json::Variant = json::VariantBase<std::allocator>

JSON value type using the default allocator.

◆ Value

using grem::json::Value = json::ValueBase<std::allocator>

JSON value type with an associated SourceLocation using the default allocator.

◆ StringParserBase

template<template< typename > typename Allocator>
using grem::json::StringParserBase = Parser<const char8_t*, Allocator>

Parser for reading contiguous UTF-8-encoded JSON strings.

◆ StringParser

using grem::json::StringParser = StringParserBase<std::allocator>

Parser for reading contiguous UTF-8-encoded JSON strings using the default allocator.

◆ StreamParserBase

template<template< typename > typename Allocator>
using grem::json::StreamParserBase = Parser<std::istreambuf_iterator<char>, Allocator>

Parser for reading UTF-8-encoded JSON input stream buffers.

◆ StreamParser

using grem::json::StreamParser = StreamParserBase<std::allocator>

Parser for reading UTF-8-encoded JSON input stream buffers using the default allocator.

Enumeration Type Documentation

◆ TokenType

enum class grem::json::TokenType : uint8_t
strong

Type of a scanned JSON5 token.

Enumerator
END_OF_FILE 

End-of-file marker.

IDENTIFIER_NULL 

Keyword null.

IDENTIFIER_FALSE 

Keyword false.

IDENTIFIER_TRUE 

Keyword true.

IDENTIFIER_NAME 

Unquoted identifier, e.g. abc.

PUNCTUATOR_COMMA 

Comma ',' symbol.

PUNCTUATOR_COLON 

Colon ':' symbol.

PUNCTUATOR_OPEN_SQUARE_BRACKET 

Open square bracket '[' symbol.

PUNCTUATOR_CLOSE_SQUARE_BRACKET 

Closing square bracket ']' symbol.

PUNCTUATOR_OPEN_CURLY_BRACE 

Open curly brace '{' symbol.

PUNCTUATOR_CLOSE_CURLY_BRACE 

Closing curly brace '}' symbol.

STRING 

Quoted string literal, e.g. "abc".

NUMBER_BINARY 

Binary number literal, e.g. 0b0000000111111111.

NUMBER_OCTAL 

Octal number literal, e.g. 0777.

NUMBER_DECIMAL 

Decimal number literal, e.g. 511.

NUMBER_HEXADECIMAL 

Hexadecimal number literal, e.g. 0x01FF.

NUMBER_POSITIVE_INFINITY 

Keyword Infinity.

NUMBER_NEGATIVE_INFINITY 

Keyword -Infinity.

NUMBER_POSITIVE_NAN 

Keyword NaN.

NUMBER_NEGATIVE_NAN 

Keyword -NaN.

Function Documentation

◆ erase_if() [1/2]

template<template< typename > typename Allocator, typename Predicate>
ObjectBase< Allocator >::size_type grem::json::erase_if ( ObjectBase< Allocator > & container,
Predicate predicate )
inline

◆ erase()

template<template< typename > typename Allocator, typename U>
ArrayBase< Allocator >::size_type grem::json::erase ( ArrayBase< Allocator > & container,
const U & value )
inline

◆ erase_if() [2/2]

template<template< typename > typename Allocator, typename Predicate>
ArrayBase< Allocator >::size_type grem::json::erase_if ( ArrayBase< Allocator > & container,
Predicate predicate )
inline

◆ isWhitespace()

bool grem::json::isWhitespace ( char32_t codePoint)
nodiscardconstexprnoexcept

Check if a Unicode code point is considered to be whitespace in JSON5.

Parameters
codePointcode point value to check.
Returns
true if the code point is considered whitespace, false otherwise.

◆ isPunctuationCharacter()

bool grem::json::isPunctuationCharacter ( char32_t codePoint)
nodiscardconstexprnoexcept

Check if a Unicode code point is considered to be punctuation in JSON5.

Parameters
codePointcode point value to check.
Returns
true if the code point is considered punctuation, false otherwise.

◆ isLineTerminatorCharacter()

bool grem::json::isLineTerminatorCharacter ( char32_t codePoint)
nodiscardconstexprnoexcept

Check if a Unicode code point marks the beginning of a line terminator sequence in JSON5.

Parameters
codePointcode point value to check.
Returns
true if the code point is considered a line terminator, false otherwise.

◆ serialize()

template<typename T, typename SerializerOverride = detail::NoSerializerOverride>
void grem::json::serialize ( std::ostream & stream,
const T & value,
const SerializationOptions & options = {},
SerializerOverride serializerOverride = {} )
inline

Serialize a value of any JSON-serializable type to an output stream.

Parameters
streamstream to write the output to.
valuevalue to serialize.
optionsserialization options, see SerializationOptions.
serializerOverrideoverloaded function object that overrides the default serialization behavior for the value or its nested elements/fields whenever a call to serializerOverride(writer, value) yields a valid matching overload.
Exceptions
json::Erroron failure to serialize the value.
std::ios_base::failureif thrown by the output stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by a user-defined implementation of Serializer or SerializerOverride, if one is used in the serialization of the given value type.
Note
Serialization of user-defined types can be defined by implementing a specialization of the Serializer template.

◆ deserialize()

template<typename T, typename DeserializerOverride = detail::NoDeserializerOverride>
void grem::json::deserialize ( std::istream & stream,
T & value,
const DeserializationOptions & options = {},
DeserializerOverride deserializerOverride = {},
const SourceLocation & source = {} )
inline

Deserialize a value of any JSON-serializable type from an input stream.

Parameters
streamstream to read the input from.
valuevalue to deserialize to.
optionsdeserialization options, see DeserializationOptions.
deserializerOverrideoverloaded function object that overrides the default deserialization behavior for the value or its nested elements/fields whenever a call to deserializerOverride(reader, value) yields a valid matching overload.
sourcesource location corresponding to the start of the given stream.
Exceptions
json::Erroron failure to parse the value from the stream.
std::ios_base::failureif thrown by the input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by a user-defined implementation of Deserializer or DeserializerOverride, if one is used in the deserialization of the given value type.
Note
Deserialization of user-defined types can be defined by implementing a specialization of the Deserializer template.

◆ operator<<() [1/4]

template<template< typename > typename Allocator>
std::ostream & grem::json::operator<< ( std::ostream & stream,
const ObjectBase< Allocator > & value )
inline

Write a JSON object to an output stream using the default serialization options.

Parameters
streamstream to write the output to.
valuethe JSON value to serialize.
Returns
a reference to the stream parameter, for chaining.
Exceptions
json::Erroron failure to serialize the value.
std::ios_base::failureif thrown by the output stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator>>() [1/4]

template<template< typename > typename Allocator>
std::istream & grem::json::operator>> ( std::istream & stream,
ObjectBase< Allocator > & value )
inline

Read a JSON object from an input stream using the default deserialization options.

If the function fails to parse a JSON value from the stream, std::ios_base::failbit is set on the stream, which may or may not cause an exception to be thrown.

Parameters
streamstream to read the input from.
valuethe JSON value to deserialize to.
Returns
a reference to the stream parameter, for chaining.
Exceptions
std::ios_base::failureif thrown by the input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator<<() [2/4]

template<template< typename > typename Allocator>
std::ostream & grem::json::operator<< ( std::ostream & stream,
const ArrayBase< Allocator > & value )
inline

Write a JSON array to an output stream using the default serialization options.

Parameters
streamstream to write the output to.
valuethe JSON value to serialize.
Returns
a reference to the stream parameter, for chaining.
Exceptions
json::Erroron failure to serialize the value.
std::ios_base::failureif thrown by the output stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator>>() [2/4]

template<template< typename > typename Allocator>
std::istream & grem::json::operator>> ( std::istream & stream,
ArrayBase< Allocator > & value )
inline

Read a JSON array from an input stream using the default deserialization options.

If the function fails to parse a JSON value from the stream, std::ios_base::failbit is set on the stream, which may or may not cause an exception to be thrown.

Parameters
streamstream to read the input from.
valuethe JSON value to deserialize to.
Returns
a reference to the stream parameter, for chaining.
Exceptions
std::ios_base::failureif thrown by the input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator<<() [3/4]

template<template< typename > typename Allocator>
std::ostream & grem::json::operator<< ( std::ostream & stream,
const VariantBase< Allocator > & value )
inline

Write a JSON value to an output stream using the default serialization options.

Parameters
streamstream to write the output to.
valuethe JSON value to serialize.
Returns
a reference to the stream parameter, for chaining.
Exceptions
json::Erroron failure to serialize the value.
std::ios_base::failureif thrown by the output stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator>>() [3/4]

template<template< typename > typename Allocator>
std::istream & grem::json::operator>> ( std::istream & stream,
VariantBase< Allocator > & value )
inline

Read a JSON value from an input stream using the default deserialization options.

If the function fails to parse a JSON value from the stream, std::ios_base::failbit is set on the stream, which may or may not cause an exception to be thrown.

Parameters
streamstream to read the input from.
valuethe JSON value to deserialize to.
Returns
a reference to the stream parameter, for chaining.
Exceptions
std::ios_base::failureif thrown by the input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator<<() [4/4]

template<template< typename > typename Allocator>
std::ostream & grem::json::operator<< ( std::ostream & stream,
const ValueBase< Allocator > & value )
inline

Write a JSON value to an output stream using the default serialization options.

Parameters
streamstream to write the output to.
valuethe JSON value to serialize.
Returns
a reference to the stream parameter, for chaining.
Exceptions
json::Erroron failure to serialize the value.
std::ios_base::failureif thrown by the output stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ operator>>() [4/4]

template<template< typename > typename Allocator>
std::istream & grem::json::operator>> ( std::istream & stream,
ValueBase< Allocator > & value )
inline

Read a JSON value from an input stream using the default deserialization options.

If the function fails to parse a JSON value from the stream, std::ios_base::failbit is set on the stream, which may or may not cause an exception to be thrown.

Parameters
streamstream to read the input from.
valuethe JSON value to deserialize to.
Returns
a reference to the stream parameter, for chaining.
Exceptions
std::ios_base::failureif thrown by the input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ serializeToString()

template<typename T, typename SerializerOverride = detail::NoSerializerOverride, typename Allocator = std::allocator<char>>
grem::StringBase< char, std::char_traits< char >, Allocator > grem::json::serializeToString ( const T & value,
const SerializationOptions & options = {},
SerializerOverride serializerOverride = {},
const Allocator & allocator = Allocator() )
inline

Serialize a value of any JSON-serializable type to a string.

Parameters
valuevalue to serialize.
optionsserialization options, see SerializationOptions.
serializerOverrideoverloaded function object that overrides the default serialization behavior for the value or its nested elements/fields whenever a call to serializerOverride(writer, value) yields a valid matching overload.
allocatorallocator to use for the string.
Returns
a string containing the serialized value.
Exceptions
json::Erroron failure to serialize the value.
std::ios_base::failureif thrown by the internal output stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by a user-defined implementation of Serializer or SerializerOverride, if one is used in the serialization of the given value type.
Note
Serialization of user-defined types can be defined by implementing a specialization of the Serializer template.

◆ deserializeFromString() [1/2]

template<typename T, typename DeserializerOverride = detail::NoDeserializerOverride, typename Allocator = std::allocator<char>>
void grem::json::deserializeFromString ( grem::StringBase< char, std::char_traits< char >, Allocator > string,
T & value,
const DeserializationOptions & options = {},
DeserializerOverride deserializerOverride = {},
const SourceLocation & source = {} )
inline

Deserialize a value of any JSON-serializable type from a string.

Parameters
stringstring to read from.
valuevalue to deserialize to.
optionsdeserialization options, see DeserializationOptions.
deserializerOverrideoverloaded function object that overrides the default deserialization behavior for the value or its nested elements/fields whenever a call to deserializerOverride(reader, value) yields a valid matching overload.
sourcesource location corresponding to the start of the given JSON string.
Exceptions
json::Erroron failure to deserialize the value.
std::ios_base::failureif thrown by the internal input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by a user-defined implementation of Deserializer or DeserializerOverride, if one is used in the serialization of the given value type.
Note
Deserialization of user-defined types can be defined by implementing a specialization of the Deserializer template.

◆ deserializeFromString() [2/2]

template<typename T, typename DeserializerOverride = detail::NoDeserializerOverride, typename Allocator = std::allocator<char>>
T grem::json::deserializeFromString ( grem::StringBase< char, std::char_traits< char >, Allocator > string,
const DeserializationOptions & options = {},
DeserializerOverride deserializerOverride = {},
const SourceLocation & source = {} )
inlinenodiscard

Deserialize a value of any JSON-serializable type from a string.

Template Parameters
TJSON-deserializable value type to deserialize.
Parameters
stringstring to read from.
optionsdeserialization options, see DeserializationOptions.
deserializerOverrideoverloaded function object that overrides the default deserialization behavior for the value or its nested elements/fields whenever a call to deserializerOverride(reader, value) yields a valid matching overload.
sourcesource location corresponding to the start of the given JSON string.
Exceptions
json::Erroron failure to deserialize the value.
std::ios_base::failureif thrown by the internal input stream.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by a user-defined implementation of Deserializer or DeserializerOverride, if one is used in the serialization of the given value type.
Note
Deserialization of user-defined types can be defined by implementing a specialization of the Deserializer template.

◆ onNull()

template<typename Callback>
auto grem::json::onNull ( Callback callback)
inlinenodiscard

Build a Parser::ValueVisitor that handles Null values with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as ValueVisitor::visitNull() and has the same semantics.
Returns
a visitor that uses the given callback for visiting values of type Null. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
json::onBoolean()
json::onString()
json::onNumber()
json::onObject()
json::onArray()
Parser::parseFile(Parser::ValueVisitor&)
Parser::parseValue(Parser::ValueVisitor&)
Parser::parseArray(Parser::ValueVisitor&)

◆ onBoolean()

template<typename Callback>
auto grem::json::onBoolean ( Callback callback)
inlinenodiscard

Build a Parser::ValueVisitor that handles Boolean values with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as ValueVisitor::visitBoolean() and has the same semantics.
Returns
a visitor that uses the given callback for visiting values of type Boolean. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
json::onNull()
json::onString()
json::onNumber()
json::onObject()
json::onArray()
Parser::parseFile(Parser::ValueVisitor&)
Parser::parseValue(Parser::ValueVisitor&)
Parser::parseArray(Parser::ValueVisitor&)

◆ onString()

template<typename Callback>
auto grem::json::onString ( Callback callback)
inlinenodiscard

Build a Parser::ValueVisitor that handles String values with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as ValueVisitor::visitString() and has the same semantics.
Returns
a visitor that uses the given callback for visiting values of type String. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
json::onNull()
json::onBoolean()
json::onNumber()
json::onObject()
json::onArray()
Parser::parseFile(Parser::ValueVisitor&)
Parser::parseValue(Parser::ValueVisitor&)
Parser::parseArray(Parser::ValueVisitor&)

◆ onNumber()

template<typename Callback>
auto grem::json::onNumber ( Callback callback)
inlinenodiscard

Build a Parser::ValueVisitor that handles Number values with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as ValueVisitor::visitNumber() and has the same semantics.
Returns
a visitor that uses the given callback for visiting values of type Number. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
json::onNull()
json::onBoolean()
json::onString()
json::onObject()
json::onArray()
Parser::parseFile(Parser::ValueVisitor&)
Parser::parseValue(Parser::ValueVisitor&)
Parser::parseArray(Parser::ValueVisitor&)

◆ onObject()

template<typename Callback>
auto grem::json::onObject ( Callback callback)
inlinenodiscard

Build a Parser::ValueVisitor that handles objects with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as ValueVisitor::visitObject() and has the same semantics.
Returns
a visitor that uses the given callback for visiting objects. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
json::onNull()
json::onBoolean()
json::onString()
json::onNumber()
json::onArray()
Parser::parseFile(Parser::ValueVisitor&)
Parser::parseValue(Parser::ValueVisitor&)
Parser::parseArray(Parser::ValueVisitor&)

◆ onArray()

template<typename Callback>
auto grem::json::onArray ( Callback callback)
inlinenodiscard

Build a Parser::ValueVisitor that handles arrays with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as ValueVisitor::visitArray() and has the same semantics.
Returns
a visitor that uses the given callback for visiting arrays. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
json::onNull()
json::onBoolean()
json::onString()
json::onNumber()
json::onObject()
Parser::parseFile(Parser::ValueVisitor&)
Parser::parseValue(Parser::ValueVisitor&)
Parser::parseArray(Parser::ValueVisitor&)

◆ onProperty()

template<typename Callback>
auto grem::json::onProperty ( Callback callback)
inlinenodiscard

Build a Parser::PropertyVisitor that handles object properties with a given callback function.

Parameters
callbackfunction object that is callable with the same signature as PropertyVisitor::visitProperty() and has the same semantics.
Returns
a visitor that uses the given callback for visiting arrays. This visitor can be combined with other related visitors using the pipe operator '|'.
Exceptions
anyexception thrown by the move constructor of the callback type.
See also
Parser::parseObject(Parser::PropertyVisitor&)

◆ swap() [1/2]

template<template< typename > typename Allocator>
void grem::json::swap ( ObjectBase< Allocator > & a,
ObjectBase< Allocator > & b )
inlinenoexcept

◆ swap() [2/2]

template<template< typename > typename Allocator>
void grem::json::swap ( ArrayBase< Allocator > & a,
ArrayBase< Allocator > & b )
inlinenoexcept