GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
json.hpp File Reference

Go to the source code of this file.

Classes

struct  grem::json::SourceLocation
 Line and column numbers of a location in a JSON source string. More...
struct  grem::json::Error
 Exception type for errors originating from the JSON API. More...
struct  grem::json::SerializationOptions
 Options for JSON serialization. More...
struct  grem::json::DeserializationOptions
 Options for JSON deserialization. More...
class  grem::json::ObjectBase< Allocator >
 JSON object type whose API mimics that of std::map<String, Value>. More...
class  grem::json::ArrayBase< Allocator >
 JSON array type whose API mimics that of std::vector<Value>. More...
class  grem::json::VariantBase< Allocator >
 JSON value type. More...
class  grem::json::ValueBase< Allocator >
 JSON value with an associated SourceLocation. More...
struct  grem::json::TokenBase< Allocator >
 Token data scanned from JSON. More...
class  grem::json::Lexer< It, Allocator >
 Lexical analyzer for scanning and tokenizing input in the JSON5 format. More...
class  grem::json::Parser< It, Allocator >
 Syntactic analyzer for parsing input in the JSON5 format obtained from a json::Lexer. More...
class  grem::json::Parser< It, Allocator >::ValueVisitor
 Polymorphic interface for visitation-based parsing of JSON values. More...
struct  grem::json::Parser< It, Allocator >::ConcreteValueVisitor< Visitor >
 Implementation of ValueVisitor for freestanding classes that implement all or parts of its interface without directly inheriting from it. More...
class  grem::json::Parser< It, Allocator >::PropertyVisitor
 Polymorphic interface for visitation-based parsing of JSON object properties. More...
struct  grem::json::Parser< It, Allocator >::ConcretePropertyVisitor< Visitor >
 Implementation of PropertyVisitor for freestanding classes that implement all or parts of its interface without directly inheriting from it. More...
struct  grem::json::Parser< It, Allocator >::SkipValueVisitor
 Implementation of ValueVisitor that skips over the parsed value and discards the result. More...
struct  grem::json::Parser< It, Allocator >::SkipPropertyVisitor
 Implementation of PropertyVisitor that skips over the parsed property and discards the result. More...
struct  grem::json::Writer
 Stateful wrapper object of an output stream for JSON serialization. More...
struct  grem::json::Reader
 Stateful wrapper object of an input stream for JSON deserialization. More...

Namespaces

namespace  grem
namespace  grem::json
namespace  grem::pmr
namespace  grem::pmr::json

Typedefs

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

Enumerations

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

Functions

template<template< typename > typename Allocator, typename Predicate>
ObjectBase< Allocator >::size_type grem::json::erase_if (ObjectBase< Allocator > &container, Predicate predicate)
template<template< typename > typename Allocator, typename U>
ArrayBase< Allocator >::size_type grem::json::erase (ArrayBase< Allocator > &container, const U &value)
template<template< typename > typename Allocator, typename Predicate>
ArrayBase< Allocator >::size_type grem::json::erase_if (ArrayBase< Allocator > &container, Predicate predicate)
constexpr bool grem::json::isWhitespace (char32_t codePoint) noexcept
 Check if a Unicode code point is considered to be whitespace in JSON5.
constexpr bool grem::json::isPunctuationCharacter (char32_t codePoint) noexcept
 Check if a Unicode code point is considered to be punctuation in JSON5.
constexpr bool grem::json::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 grem::json::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 grem::json::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 & grem::json::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 & grem::json::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 & grem::json::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 & grem::json::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 & grem::json::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 & grem::json::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 & grem::json::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 & grem::json::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 > grem::json::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 grem::json::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 grem::json::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 grem::json::onNull (Callback callback)
 Build a Parser::ValueVisitor that handles Null values with a given callback function.
template<typename Callback>
auto grem::json::onBoolean (Callback callback)
 Build a Parser::ValueVisitor that handles Boolean values with a given callback function.
template<typename Callback>
auto grem::json::onString (Callback callback)
 Build a Parser::ValueVisitor that handles String values with a given callback function.
template<typename Callback>
auto grem::json::onNumber (Callback callback)
 Build a Parser::ValueVisitor that handles Number values with a given callback function.
template<typename Callback>
auto grem::json::onObject (Callback callback)
 Build a Parser::ValueVisitor that handles objects with a given callback function.
template<typename Callback>
auto grem::json::onArray (Callback callback)
 Build a Parser::ValueVisitor that handles arrays with a given callback function.
template<typename Callback>
auto grem::json::onProperty (Callback callback)
 Build a Parser::PropertyVisitor that handles object properties with a given callback function.
template<template< typename > typename Allocator>
void grem::json::swap (ObjectBase< Allocator > &a, ObjectBase< Allocator > &b) noexcept
template<template< typename > typename Allocator>
void grem::json::swap (ArrayBase< Allocator > &a, ArrayBase< Allocator > &b) noexcept