mirror of
https://github.com/nlohmann/json.git
synced 2026-10-05 06:00:29 +00:00
Add helper types to make it easier to create a basic_json type with modified template parameters
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -27348,6 +27348,65 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
/// SAX interface type, see @ref nlohmann::json_sax
|
||||
using json_sax_t = json_sax<basic_json>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// utility templates to create a json type with different template parameters //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Json type using a different type for storing objects
|
||||
template<template<typename, typename, typename...> class ObjectType2>
|
||||
using with_changed_object_t = basic_json<ObjectType2, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing arrays
|
||||
template<template<typename, typename...> class ArrayType2>
|
||||
using with_changed_array_t = basic_json<ObjectType, ArrayType2, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing strings
|
||||
template<class StringType2>
|
||||
using with_changed_string_t = basic_json<ObjectType, ArrayType, StringType2, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing booleans
|
||||
template<class BooleanType2>
|
||||
using with_changed_boolean_t = basic_json<ObjectType, ArrayType, StringType, BooleanType2,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing signed integers
|
||||
template<class NumberIntegerType2>
|
||||
using with_changed_integer_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType2, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing unsigned integers
|
||||
template<class NumberUnsignedType2>
|
||||
using with_changed_unsigned_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType2, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing floating point numbers
|
||||
template<class NumberFloatType2>
|
||||
using with_changed_float_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType2, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type as base allocator
|
||||
template<template<typename> class AllocatorType2>
|
||||
using with_changed_allocator_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType2, JSONSerializer, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type as json serializer
|
||||
template<template<typename, typename = void> class JSONSerializer2>
|
||||
using with_changed_json_serializer_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer2, BinaryType, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type for storing binary data
|
||||
template<class BinaryType2>
|
||||
using with_changed_binary_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType2, CustomBaseClass>;
|
||||
|
||||
/// Json type using a different type as base class
|
||||
template<class CustomBaseClass2>
|
||||
using with_changed_base_class_t = basic_json<ObjectType, ArrayType, StringType, BooleanType,
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass2>;
|
||||
|
||||
////////////////
|
||||
// exceptions //
|
||||
////////////////
|
||||
|
||||
Reference in New Issue
Block a user