DAW JSON Link
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
DAW_JSON_NS Namespace Reference

Namespaces

 datetime
 
 json_details
 
 parse_policy_details
 
 parse_utils
 
 utils
 

Classes

struct  basic_json_pair
 
class  basic_json_value
 
struct  basic_json_value_iterator
 
struct  basic_json_value_iterator_range
 
class  basic_stateful_json_value
 
struct  BasicNoCommentSkippingPolicy
 
struct  BasicParsePolicy
 
struct  can_single_allocation_string
 
struct  can_single_allocation_string< std::basic_string< Char, CharTrait, Allocator > >
 
struct  constexpr_exec_tag
 
struct  construct_from_iso8601_timestamp
 
struct  construct_from_iso8601_timestamp< JsonNullable::Never >
 
struct  construct_from_iso8601_timestamp< JsonNullable::Nullable >
 
class  CppCommentSkippingPolicy
 
struct  custom_from_converter_t
 
struct  custom_to_converter_t
 
struct  default_constructor
 
struct  default_constructor< json_alt< T, I > >
 
struct  default_constructor< std::unordered_map< K, V, H, E, Alloc > >
 
class  DefaultJsonEventParserStackPolicy
 
class  HashCommentSkippingPolicy
 
struct  json_alt
 
struct  json_array
 
class  json_array_iterator
 
struct  json_array_range
 
struct  json_bool
 
struct  json_class
 
struct  json_class_map
 
struct  json_custom
 
struct  json_data_contract
 
struct  json_data_contract< tuple_json_mapping< Members... > >
 
struct  json_date
 
struct  json_raw
 
struct  json_key_value
 
struct  json_key_value_array
 
struct  json_link_basic_type_map
 
struct  json_link_basic_type_map< bool >
 
struct  json_link_basic_type_map< daw::string_view >
 
struct  json_link_basic_type_map< double >
 
struct  json_link_basic_type_map< float >
 
struct  json_link_basic_type_map< int >
 
struct  json_link_basic_type_map< long >
 
struct  json_link_basic_type_map< long long >
 
struct  json_link_basic_type_map< short >
 
struct  json_link_basic_type_map< std::string >
 
struct  json_link_basic_type_map< std::string_view >
 
struct  json_link_basic_type_map< unsigned int >
 
struct  json_link_basic_type_map< unsigned long >
 
struct  json_link_basic_type_map< unsigned long long >
 
struct  json_link_basic_type_map< unsigned short >
 
struct  json_member_list
 
struct  json_member_name
 
struct  json_number
 
struct  json_ordered_member_list
 
class  json_path_node
 
struct  json_string
 
struct  json_string_raw
 
struct  json_submember_tagged_variant
 
struct  json_tagged_variant
 
struct  json_tagged_variant_type_list
 
struct  json_variant
 
struct  json_variant_type_list
 
struct  JsonEventParserStackValue
 
struct  missing_json_data_contract_for
 
struct  nullable_constructor
 
struct  nullable_constructor< std::optional< T > >
 
struct  nullable_constructor< std::unique_ptr< T, Deleter > >
 
struct  ordered_json_member
 
struct  runtime_exec_tag
 
struct  TestInputIteratorType
 
struct  tuple_json_mapping
 

Typedefs

using CppCommentSkippingPolicyChecked = BasicParsePolicy< false, CppCommentSkippingPolicy, default_exec_tag, false >
 
using CppCommentSkippingPolicyUnchecked = BasicParsePolicy< true, CppCommentSkippingPolicy, default_exec_tag, false >
 
using default_exec_tag = constexpr_exec_tag
 
using DefaultParsePolicy = NoCommentSkippingPolicyChecked
 
using HashCommentSkippingPolicyChecked = BasicParsePolicy< false, HashCommentSkippingPolicy, default_exec_tag, false >
 
using HashCommentSkippingPolicyUnchecked = BasicParsePolicy< true, HashCommentSkippingPolicy, default_exec_tag, false >
 
template<JSONNAMETYPE Name, typename JsonElement , typename Container = std::vector<typename json_details::unnamed_default_type_mapping< JsonElement>::parse_to_t>, typename Constructor = nullable_constructor<Container>>
using json_array_null = json_array< Name, JsonElement, Container, Constructor, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename T = std::optional<bool>, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = nullable_constructor<T>>
using json_bool_null = json_bool< Name, T, LiteralAsString, Constructor, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename T = double, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = default_constructor<T>, JsonNullable Nullable = JsonNullable::Never>
using json_checked_number = json_number< Name, T, LiteralAsString, Constructor, JsonRangeCheck::CheckForNarrowing, Nullable >
 
template<JSONNAMETYPE Name, typename T = std::optional<double>, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = nullable_constructor<T>>
using json_checked_number_null = json_number< Name, T, LiteralAsString, Constructor, JsonRangeCheck::CheckForNarrowing, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename T , typename Constructor = nullable_constructor<T>>
using json_class_null = json_class< Name, T, Constructor, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename T , typename FromConverter = custom_from_converter_t<T>, typename ToConverter = custom_to_converter_t<T>, CustomJsonTypes CustomJsonType = CustomJsonTypes::Either>
using json_custom_null = json_custom< Name, T, FromConverter, ToConverter, CustomJsonType, JsonNullable::Nullable >
 
template<typename T >
using json_data_contract_trait_t = typename DAW_JSON_NS::json_data_contract< T >::type
 
template<JSONNAMETYPE Name, typename T = std::optional<std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds>>, typename Constructor = construct_from_iso8601_timestamp<JsonNullable::Nullable>>
using json_date_null = json_date< Name, T, Constructor, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename Container , typename JsonValueType , typename JsonKeyType , typename Constructor = nullable_constructor<Container>>
using json_key_value_array_null = json_key_value_array< Name, Container, JsonValueType, JsonKeyType, Constructor, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename Container , typename JsonValueType , typename JsonKeyType = json_string<no_name>, typename Constructor = nullable_constructor<Container>>
using json_key_value_null = json_key_value< Name, Container, JsonValueType, JsonKeyType, Constructor, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename T = std::optional<double>, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = nullable_constructor<T>, JsonRangeCheck RangeCheck = JsonRangeCheck::Never>
using json_number_null = json_number< Name, T, LiteralAsString, Constructor, RangeCheck, JsonNullable::Nullable >
 
using json_pair = basic_json_pair< NoCommentSkippingPolicyChecked >
 
template<JSONNAMETYPE Name, typename String = std::optional<std::string>, typename Constructor = nullable_constructor<String>, JsonNullable EmptyStringNull = JsonNullable::Never, EightBitModes EightBitMode = EightBitModes::AllowFull>
using json_string_null = json_string< Name, String, Constructor, EmptyStringNull, EightBitMode, JsonNullable::Nullable >
 
template<JSONNAMETYPE Name, typename String = std::optional<std::string>, typename Constructor = nullable_constructor<String>, JsonNullable EmptyStringNull = JsonNullable::Nullable, EightBitModes EightBitMode = EightBitModes::AllowFull, AllowEscapeCharacter AllowEscape = AllowEscapeCharacter::Allow>
using json_string_raw_null = json_string_raw< Name, String, Constructor, EmptyStringNull, EightBitMode, JsonNullable::Nullable, AllowEscape >
 
template<JSONNAMETYPE Name, typename T , typename TagMember , typename Switcher , typename JsonElements = json_details::determine_variant_element_types<JsonNullable::Nullable, T>, typename Constructor = nullable_constructor<T>>
using json_tagged_variant_null = json_tagged_variant< Name, T, TagMember, Switcher, JsonElements, Constructor, JsonNullable::Nullable >
 
using json_value = basic_json_value< NoCommentSkippingPolicyChecked >
 
using json_value_state = basic_stateful_json_value< NoCommentSkippingPolicyChecked >
 
template<JSONNAMETYPE Name, typename T , typename JsonElements , typename Constructor = nullable_constructor<T>>
using json_variant_null = json_variant< Name, T, JsonElements, Constructor, JsonNullable::Nullable >
 
using NoCommentSkippingPolicy = BasicNoCommentSkippingPolicy< false >
 
using NoCommentSkippingPolicyChecked = BasicParsePolicy< false, NoCommentSkippingPolicy, default_exec_tag, false >
 
using NoCommentSkippingPolicyUnchecked = BasicParsePolicy< true, NoCommentSkippingPolicy, default_exec_tag, false >
 
template<JsonParseTypes v>
using ParseTag = std::integral_constant< JsonParseTypes, v >
 
using simd_exec_tag = runtime_exec_tag
 
template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using SIMDCppCommentSkippingPolicyChecked = BasicParsePolicy< false, CppCommentSkippingPolicy, ExecTag, false, Allocator >
 
template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using SIMDCppCommentSkippingPolicyUnchecked = BasicParsePolicy< true, CppCommentSkippingPolicy, ExecTag, false, Allocator >
 
template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using SIMDHashCommentSkippingPolicyChecked = BasicParsePolicy< false, HashCommentSkippingPolicy, ExecTag, false, Allocator >
 
template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using SIMDHashCommentSkippingPolicyUnchecked = BasicParsePolicy< true, HashCommentSkippingPolicy, ExecTag, false, Allocator >
 
template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using SIMDNoCommentSkippingPolicyChecked = BasicParsePolicy< false, NoCommentSkippingPolicy, ExecTag, false, Allocator >
 
template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using SIMDNoCommentSkippingPolicyUnchecked = BasicParsePolicy< true, NoCommentSkippingPolicy, ExecTag, false, Allocator >
 

Enumerations

enum class  AllowEscapeCharacter { Allow , NotBeforeDblQuote }
 
enum class  CustomJsonTypes { Literal , String , Either }
 
enum class  EightBitModes { DisallowHigh = false , AllowFull = true }
 
enum  json_parse_handler_result { Continue , SkipClassArray , Complete }
 
enum class  JsonBaseParseTypes : std::uint_fast8_t {
  Number , Bool , String , Class ,
  Array , Null , None
}
 
enum class  JsonNullable { Never = false , Nullable = true }
 
enum class  JsonParseTypes : std::uint_fast8_t {
  Real , Signed , Unsigned , Bool ,
  StringRaw , StringEscaped , Date , Class ,
  Array , Null , KeyValue , KeyValueArray ,
  Custom , Variant , VariantTagged , Unknown
}
 
enum class  JsonRangeCheck { Never = false , CheckForNarrowing = true }
 
enum class  LiteralAsStringOpt : std::uint8_t { Never , Maybe , Always }
 
enum class  StackParseStateType { Class , Array }
 

Functions

template<typename ParseState >
 basic_json_value_iterator_range (basic_json_value_iterator< ParseState >, basic_json_value_iterator< ParseState >) -> basic_json_value_iterator_range< ParseState >
 
template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error (DAW_JSON_NS::json_details::missing_member reason)
 
template<bool ShouldThrow = use_daw_json_exceptions_v, typename ParseState >
static DAW_JSON_NOINLINE void daw_json_error (DAW_JSON_NS::json_details::missing_member reason, ParseState const &location)
 
template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error (DAW_JSON_NS::json_details::missing_token reason)
 
template<bool ShouldThrow = use_daw_json_exceptions_v, typename ParseState >
static DAW_JSON_NOINLINE void daw_json_error (DAW_JSON_NS::json_details::missing_token reason, ParseState const &location)
 
template<bool ShouldThrow = use_daw_json_exceptions_v>
DAW_JSON_NOINLINE void daw_json_error (ErrorReason reason)
 
template<bool ShouldThrow = use_daw_json_exceptions_v, typename ParseState >
static DAW_JSON_NOINLINE void daw_json_error (ErrorReason reason, ParseState const &location)
 
constexpr std::size_t find_column_number_of (char const *doc_pos, char const *doc_start)
 
constexpr std::size_t find_column_number_of (json_path_node const &node, char const *doc_start)
 
std::vector< json_path_nodefind_json_path_stack_to (char const *parse_location, char const *doc_start)
 Get the json_path_nodes representing the path to the nearest value's position in the document. More...
 
std::vector< json_path_nodefind_json_path_stack_to (json_exception const &jex, char const *doc_start)
 
std::string find_json_path_to (char const *parse_location, char const *doc_start)
 
std::string find_json_path_to (json_exception const &jex, char const *doc_start)
 
constexpr std::size_t find_line_number_of (char const *doc_pos, char const *doc_start)
 
constexpr std::size_t find_line_number_of (json_path_node const &node, char const *doc_start)
 
template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename ParseState >
constexpr Result from_json (basic_json_value< ParseState > value)
 
template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename ParseState >
constexpr Result from_json (basic_json_value< ParseState > value, std::string_view member_path)
 
template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result >
constexpr Result from_json (std::string_view json_data)
 
template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result >
constexpr Result from_json (std::string_view json_data, std::string_view member_path)
 
template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename Allocator >
constexpr Result from_json_alloc (std::string_view json_data, Allocator const &alloc)
 
template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename Allocator >
constexpr Result from_json_alloc (std::string_view json_data, std::string_view member_path, Allocator const &alloc)
 
template<typename JsonElement , typename Container , typename ParsePolicy , typename Constructor , bool KnownBounds>
constexpr Container from_json_array (std::string_view json_data, std::string_view member_path)
 
template<std::size_t Idx, typename ParseState >
constexpr decltype(auto) get (basic_json_pair< ParseState > &&parse_state)
 
template<std::size_t Idx, typename ParseState >
constexpr decltype(auto) get (basic_json_pair< ParseState > &parse_state)
 
template<std::size_t Idx, typename ParseState >
constexpr decltype(auto) get (basic_json_pair< ParseState > const &parse_state)
 
template<typename ParsePolicy = NoCommentSkippingPolicyChecked, typename StackContainerPolicy = DefaultJsonEventParserStackPolicy< JsonEventParserStackValue<ParsePolicy>>, typename Handler >
constexpr void json_event_parser (DAW_JSON_NS::basic_json_value< ParsePolicy > jvalue, Handler &&handler)
 
template<typename ParsePolicy = NoCommentSkippingPolicyChecked, typename Handler >
void json_event_parser (std::string_view json_document, Handler &&handler)
 
template<typename Real , typename OutputIterator >
OutputIterator real2string (Real const &value, OutputIterator out_it)
 
template<typename Result , typename Value , typename JsonClass >
constexpr Result to_json (Value const &value)
 
template<typename Value , typename JsonClass , typename OutputIterator >
constexpr OutputIterator to_json (Value const &value, OutputIterator out_it)
 
template<typename Result , typename JsonElement , typename Container >
constexpr Result to_json_array (Container &&c)
 
template<typename JsonElement , typename Container , typename OutputIterator >
constexpr OutputIterator to_json_array (Container const &c, OutputIterator out_it)
 
std::string to_json_path_string (std::vector< json_path_node > const &path_stack)
 Convert a json_path_node stack to a JSON Path string. More...
 
constexpr std::string_view to_string (JsonBaseParseTypes pt)
 

Variables

template<typename T >
constexpr bool force_aggregate_construction_v
 
template<JsonParseTypes ParseType, JsonNullable Nullable>
constexpr JsonParseTypes get_parse_type_v
 
template<typename JsonMember >
constexpr bool is_no_name = JsonMember::name == no_name
 
constexpr char const no_name [] = "\a"
 

Typedef Documentation

◆ CppCommentSkippingPolicyChecked

◆ CppCommentSkippingPolicyUnchecked

◆ default_exec_tag

◆ DefaultParsePolicy

◆ HashCommentSkippingPolicyChecked

◆ HashCommentSkippingPolicyUnchecked

◆ json_array_null

template<JSONNAMETYPE Name, typename JsonElement , typename Container = std::vector<typename json_details::unnamed_default_type_mapping< JsonElement>::parse_to_t>, typename Constructor = nullable_constructor<Container>>
using DAW_JSON_NS::json_array_null = typedef json_array<Name, JsonElement, Container, Constructor, JsonNullable::Nullable>

Link to a nullable JSON array

Template Parameters
Namename of JSON member to link to
Containertype of C++ container being constructed(e.g. vector<int>)
JsonElementJson type being parsed e.g. json_number, json_string...
ConstructorA callable used to make Container, default will use the Containers constructor. Both normal and aggregate are supported

◆ json_bool_null

template<JSONNAMETYPE Name, typename T = std::optional<bool>, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = nullable_constructor<T>>
using DAW_JSON_NS::json_bool_null = typedef json_bool<Name, T, LiteralAsString, Constructor, JsonNullable::Nullable>

The member is a nullable boolean

Template Parameters
Namename of json member
Tresult type to pass to Constructor
LiteralAsStringCould this number be embedded in a string
ConstructorCallable used to construct result

◆ json_checked_number

template<JSONNAMETYPE Name, typename T = double, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = default_constructor<T>, JsonNullable Nullable = JsonNullable::Never>
using DAW_JSON_NS::json_checked_number = typedef json_number<Name, T, LiteralAsString, Constructor, JsonRangeCheck::CheckForNarrowing, Nullable>

The member is a range checked number

Template Parameters
Namename of json member
Ttype of number(e.g. double, int, unsigned...) to pass to Constructor
LiteralAsStringCould this number be embedded in a string
ConstructorCallable used to construct result
NullableCan the member be missing or have a null value

◆ json_checked_number_null

template<JSONNAMETYPE Name, typename T = std::optional<double>, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = nullable_constructor<T>>
using DAW_JSON_NS::json_checked_number_null = typedef json_number<Name, T, LiteralAsString, Constructor, JsonRangeCheck::CheckForNarrowing, JsonNullable::Nullable>

The member is a nullable range checked number

Template Parameters
Namename of json member
Ttype of number(e.g. optional<double>, optional<int>, optional<unsigned>...) to pass to Constructor
LiteralAsStringCould this number be embedded in a string
ConstructorCallable used to construct result

◆ json_class_null

template<JSONNAMETYPE Name, typename T , typename Constructor = nullable_constructor<T>>
using DAW_JSON_NS::json_class_null = typedef json_class<Name, T, Constructor, JsonNullable::Nullable>

Link to a nullable JSON class

Template Parameters
Namename of JSON member to link to
Ttype that has specialization of daw::json::json_data_contract
ConstructorA callable used to construct T. The default supports normal and aggregate construction

◆ json_custom_null

template<JSONNAMETYPE Name, typename T , typename FromConverter = custom_from_converter_t<T>, typename ToConverter = custom_to_converter_t<T>, CustomJsonTypes CustomJsonType = CustomJsonTypes::Either>
using DAW_JSON_NS::json_custom_null = typedef json_custom<Name, T, FromConverter, ToConverter, CustomJsonType, JsonNullable::Nullable>

Allow parsing of a nullable type that does not fit

Template Parameters
NameName of JSON member to link to
Ttype of value being constructed
FromConverterCallable that accepts a std::string_view of the range to parse
ToConverterReturns a string from the value
CustomJsonTypeJSON type value is encoded as literal/string

◆ json_data_contract_trait_t

template<typename T >
using DAW_JSON_NS::json_data_contract_trait_t = typedef typename DAW_JSON_NS::json_data_contract<T>::type

◆ json_date_null

template<JSONNAMETYPE Name, typename T = std::optional<std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds>>, typename Constructor = construct_from_iso8601_timestamp<JsonNullable::Nullable>>
using DAW_JSON_NS::json_date_null = typedef json_date<Name, T, Constructor, JsonNullable::Nullable>

Link to a JSON string representing a nullable date

Template Parameters
Namename of JSON member to link to
TC++ type to construct, by default is a time_point
ConstructorA Callable used to construct a T. Must accept a char pointer and size as argument to the date/time string.

◆ json_key_value_array_null

template<JSONNAMETYPE Name, typename Container , typename JsonValueType , typename JsonKeyType , typename Constructor = nullable_constructor<Container>>
using DAW_JSON_NS::json_key_value_array_null = typedef json_key_value_array<Name, Container, JsonValueType, JsonKeyType, Constructor, JsonNullable::Nullable>

Map a nullable KV type json array [ {"key": ValueOfKeyType, "value": ValueOfValueType},... ] to a c++ class. needs to be constructable with a pointer, size

Template Parameters
Namename of JSON member to link to
Containertype to put values in
JsonValueTypeJson type of value in kv pair( e.g. json_number, json_string, ... ). If specific json member type isn't specified, the member name defaults to "value"
JsonKeyTypetype of key in kv pair. If specific json member type isn't specified, the key name defaults to "key"
ConstructorA callable used to make Container, default will use the Containers constructor. Both normal and aggregate are supported

◆ json_key_value_null

template<JSONNAMETYPE Name, typename Container , typename JsonValueType , typename JsonKeyType = json_string<no_name>, typename Constructor = nullable_constructor<Container>>
using DAW_JSON_NS::json_key_value_null = typedef json_key_value<Name, Container, JsonValueType, JsonKeyType, Constructor, JsonNullable::Nullable>

Map a nullable KV type json class { "Key StringRaw": ValueType, ... } to a c++ class. Keys are Always string like and the destination needs to be constructable with a pointer, size

Template Parameters
Namename of JSON member to link to
Containertype to put values in
JsonValueTypeJson type of value in kv pair( e.g. json_number, json_string, ... ). It also supports basic types like numbers, bool, and mapped classes and enums(mapped to numbers)
JsonKeyTypetype of key in kv pair. As with value it supports basic types too
ConstructorA callable used to make Container, default will use the Containers constructor. Both normal and aggregate are supported

◆ json_number_null

template<JSONNAMETYPE Name, typename T = std::optional<double>, LiteralAsStringOpt LiteralAsString = LiteralAsStringOpt::Never, typename Constructor = nullable_constructor<T>, JsonRangeCheck RangeCheck = JsonRangeCheck::Never>
using DAW_JSON_NS::json_number_null = typedef json_number<Name, T, LiteralAsString, Constructor, RangeCheck, JsonNullable::Nullable>

NOTE: Some of the basic json types used for deduction are in daw_json_parse_common.h The member is a nullable number

Template Parameters
Namename of json member
Ttype of number(e.g. double, int, unsigned...) to pass to Constructor
LiteralAsStringCould this number be embedded in a string
ConstructorCallable used to construct result
RangeCheckCheck if thevalue will fit in the result

◆ json_pair

◆ json_string_null

template<JSONNAMETYPE Name, typename String = std::optional<std::string>, typename Constructor = nullable_constructor<String>, JsonNullable EmptyStringNull = JsonNullable::Never, EightBitModes EightBitMode = EightBitModes::AllowFull>
using DAW_JSON_NS::json_string_null = typedef json_string<Name, String, Constructor, EmptyStringNull, EightBitMode, JsonNullable::Nullable>

Member is a nullable escaped string and requires unescaping and escaping of string data

Template Parameters
Nameof json member
Stringresult type constructed by Constructor
Constructora callable taking as arguments ( InputIterator, InputIterator ). If others are needed use the Constructor callable convert
EmptyStringNullif string is empty, call Constructor with no arguments
EightBitModeAllow filtering of characters with the MSB set

◆ json_string_raw_null

template<JSONNAMETYPE Name, typename String = std::optional<std::string>, typename Constructor = nullable_constructor<String>, JsonNullable EmptyStringNull = JsonNullable::Nullable, EightBitModes EightBitMode = EightBitModes::AllowFull, AllowEscapeCharacter AllowEscape = AllowEscapeCharacter::Allow>
using DAW_JSON_NS::json_string_raw_null = typedef json_string_raw<Name, String, Constructor, EmptyStringNull, EightBitMode, JsonNullable::Nullable, AllowEscape>

Member is a nullable escaped string and requires unescaping and escaping of string data. Not all invalid codepoints are detected

Template Parameters
Nameof json member
Stringresult type constructed by Constructor
Constructora callable taking as arguments ( char const *, std::size_t )
EmptyStringNullif string is empty, call Constructor with no arguments
EightBitModeAllow filtering of characters with the MSB set arguments
AllowEscapeTell parser if we know a \ or escape will be in the data

◆ json_tagged_variant_null

template<JSONNAMETYPE Name, typename T , typename TagMember , typename Switcher , typename JsonElements = json_details::determine_variant_element_types<JsonNullable::Nullable, T>, typename Constructor = nullable_constructor<T>>
using DAW_JSON_NS::json_tagged_variant_null = typedef json_tagged_variant<Name, T, TagMember, Switcher, JsonElements, Constructor, JsonNullable::Nullable>

◆ json_value

◆ json_value_state

◆ json_variant_null

template<JSONNAMETYPE Name, typename T , typename JsonElements , typename Constructor = nullable_constructor<T>>
using DAW_JSON_NS::json_variant_null = typedef json_variant<Name, T, JsonElements, Constructor, JsonNullable::Nullable>

◆ NoCommentSkippingPolicy

◆ NoCommentSkippingPolicyChecked

◆ NoCommentSkippingPolicyUnchecked

◆ ParseTag

template<JsonParseTypes v>
using DAW_JSON_NS::ParseTag = typedef std::integral_constant<JsonParseTypes, v>

Tag lookup for parsing overload selection

◆ simd_exec_tag

◆ SIMDCppCommentSkippingPolicyChecked

template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using DAW_JSON_NS::SIMDCppCommentSkippingPolicyChecked = typedef BasicParsePolicy<false, CppCommentSkippingPolicy, ExecTag, false, Allocator>

◆ SIMDCppCommentSkippingPolicyUnchecked

template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using DAW_JSON_NS::SIMDCppCommentSkippingPolicyUnchecked = typedef BasicParsePolicy<true, CppCommentSkippingPolicy, ExecTag, false, Allocator>

◆ SIMDHashCommentSkippingPolicyChecked

template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using DAW_JSON_NS::SIMDHashCommentSkippingPolicyChecked = typedef BasicParsePolicy<false, HashCommentSkippingPolicy, ExecTag, false, Allocator>

◆ SIMDHashCommentSkippingPolicyUnchecked

template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using DAW_JSON_NS::SIMDHashCommentSkippingPolicyUnchecked = typedef BasicParsePolicy<true, HashCommentSkippingPolicy, ExecTag, false, Allocator>

◆ SIMDNoCommentSkippingPolicyChecked

template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using DAW_JSON_NS::SIMDNoCommentSkippingPolicyChecked = typedef BasicParsePolicy<false, NoCommentSkippingPolicy, ExecTag, false, Allocator>

◆ SIMDNoCommentSkippingPolicyUnchecked

template<typename ExecTag , typename Allocator = json_details::NoAllocator>
using DAW_JSON_NS::SIMDNoCommentSkippingPolicyUnchecked = typedef BasicParsePolicy<true, NoCommentSkippingPolicy, ExecTag, false, Allocator>

Enumeration Type Documentation

◆ AllowEscapeCharacter

Enumerator
Allow 
NotBeforeDblQuote 

◆ CustomJsonTypes

Enumerator
Literal 
String 
Either 

◆ EightBitModes

Enumerator
DisallowHigh 
AllowFull 

◆ json_parse_handler_result

Enumerator
Continue 
SkipClassArray 
Complete 

◆ JsonBaseParseTypes

enum DAW_JSON_NS::JsonBaseParseTypes : std::uint_fast8_t
strong
Enumerator
Number 
Bool 
String 
Class 
Array 
Null 
None 

◆ JsonNullable

Enumerator
Never 
Nullable 

◆ JsonParseTypes

enum DAW_JSON_NS::JsonParseTypes : std::uint_fast8_t
strong
Enumerator
Real 
Signed 
Unsigned 
Bool 
StringRaw 
StringEscaped 
Date 
Class 
Array 
Null 
KeyValue 
KeyValueArray 
Custom 
Variant 
VariantTagged 
Unknown 

◆ JsonRangeCheck

Enumerator
Never 
CheckForNarrowing 

◆ LiteralAsStringOpt

enum DAW_JSON_NS::LiteralAsStringOpt : std::uint8_t
strong

Allows having literals parse that are encoded as strings. It allows one to have it be Never true, Maybe true or Always true. This controls whether the parser will Never remove quotes, check if quotes exist, or Always remove quotes around the literal

Enumerator
Never 
Maybe 
Always 

◆ StackParseStateType

Enumerator
Class 
Array 

Function Documentation

◆ basic_json_value_iterator_range()

template<typename ParseState >
DAW_JSON_NS::basic_json_value_iterator_range ( basic_json_value_iterator< ParseState >  ,
basic_json_value_iterator< ParseState >   
) -> basic_json_value_iterator_range< ParseState >

◆ daw_json_error() [1/6]

template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void DAW_JSON_NS::daw_json_error ( DAW_JSON_NS::json_details::missing_member  reason)
static

◆ daw_json_error() [2/6]

template<bool ShouldThrow = use_daw_json_exceptions_v, typename ParseState >
static DAW_JSON_NOINLINE void DAW_JSON_NS::daw_json_error ( DAW_JSON_NS::json_details::missing_member  reason,
ParseState const &  location 
)
static

◆ daw_json_error() [3/6]

template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void DAW_JSON_NS::daw_json_error ( DAW_JSON_NS::json_details::missing_token  reason)
static

◆ daw_json_error() [4/6]

template<bool ShouldThrow = use_daw_json_exceptions_v, typename ParseState >
static DAW_JSON_NOINLINE void DAW_JSON_NS::daw_json_error ( DAW_JSON_NS::json_details::missing_token  reason,
ParseState const &  location 
)
static

◆ daw_json_error() [5/6]

template<bool ShouldThrow = use_daw_json_exceptions_v>
DAW_JSON_NOINLINE void DAW_JSON_NS::daw_json_error ( ErrorReason  reason)

◆ daw_json_error() [6/6]

template<bool ShouldThrow = use_daw_json_exceptions_v, typename ParseState >
static DAW_JSON_NOINLINE void DAW_JSON_NS::daw_json_error ( ErrorReason  reason,
ParseState const &  location 
)
static

◆ find_column_number_of() [1/2]

constexpr std::size_t DAW_JSON_NS::find_column_number_of ( char const *  doc_pos,
char const *  doc_start 
)
constexpr

◆ find_column_number_of() [2/2]

constexpr std::size_t DAW_JSON_NS::find_column_number_of ( json_path_node const &  node,
char const *  doc_start 
)
constexpr

◆ find_json_path_stack_to() [1/2]

std::vector< json_path_node > DAW_JSON_NS::find_json_path_stack_to ( char const *  parse_location,
char const *  doc_start 
)
inline

Get the json_path_nodes representing the path to the nearest value's position in the document.

Parameters
parse_locationThe position in the document to find
doc_startA pointer to the stat of the JSON document

◆ find_json_path_stack_to() [2/2]

std::vector<json_path_node> DAW_JSON_NS::find_json_path_stack_to ( json_exception const &  jex,
char const *  doc_start 
)
inline

◆ find_json_path_to() [1/2]

std::string DAW_JSON_NS::find_json_path_to ( char const *  parse_location,
char const *  doc_start 
)
inline

◆ find_json_path_to() [2/2]

std::string DAW_JSON_NS::find_json_path_to ( json_exception const &  jex,
char const *  doc_start 
)
inline

◆ find_line_number_of() [1/2]

constexpr std::size_t DAW_JSON_NS::find_line_number_of ( char const *  doc_pos,
char const *  doc_start 
)
constexpr

◆ find_line_number_of() [2/2]

constexpr std::size_t DAW_JSON_NS::find_line_number_of ( json_path_node const &  node,
char const *  doc_start 
)
constexpr

◆ from_json() [1/4]

template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename ParseState >
constexpr Result DAW_JSON_NS::from_json ( basic_json_value< ParseState >  value)
inlineconstexpr

◆ from_json() [2/4]

template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename ParseState >
constexpr Result DAW_JSON_NS::from_json ( basic_json_value< ParseState >  value,
std::string_view  member_path 
)
constexpr

◆ from_json() [3/4]

template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result >
constexpr Result DAW_JSON_NS::from_json ( std::string_view  json_data)
constexpr

Construct the JSONMember from the JSON document argument.

Template Parameters
JsonMemberany bool, arithmetic, string, string_view, daw::json::json_data_contract
Parameters
json_dataJSON string data
Template Parameters
KnownBoundsThe bounds of the json_data are known to contain the whole value
Returns
A reified T constructed from JSON data
Exceptions
daw::json::json_exceptionConstruct the JSONMember from the JSON document argument.
Template Parameters
JsonMemberany bool, arithmetic, string, string_view, daw::json::json_data_contract
Parameters
json_dataJSON string data
Template Parameters
KnownBoundsThe bounds of the json_data are known to contain the whole value
ParsePolicyParse policy used while parsing. Default is with checking and no comments
Returns
A reified JSONMember constructed from JSON data
Exceptions
daw::json::json_exception

◆ from_json() [4/4]

template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result >
constexpr Result DAW_JSON_NS::from_json ( std::string_view  json_data,
std::string_view  member_path 
)
constexpr

◆ from_json_alloc() [1/2]

template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename Allocator >
constexpr Result DAW_JSON_NS::from_json_alloc ( std::string_view  json_data,
Allocator const &  alloc 
)
constexpr

Construct the JSONMember from the JSON document argument.

Template Parameters
JsonMemberany bool, arithmetic, string, string_view, daw::json::json_data_contract
Parameters
json_dataJSON string data
Template Parameters
KnownBoundsThe bounds of the json_data are known to contain the whole value
Returns
A reified T constructed from JSON data
Exceptions
daw::json::json_exception

◆ from_json_alloc() [2/2]

template<typename JsonMember , typename ParsePolicy , bool KnownBounds, typename Result , typename Allocator >
constexpr Result DAW_JSON_NS::from_json_alloc ( std::string_view  json_data,
std::string_view  member_path,
Allocator const &  alloc 
)
constexpr

◆ from_json_array()

template<typename JsonElement , typename Container , typename ParsePolicy , typename Constructor , bool KnownBounds>
constexpr Container DAW_JSON_NS::from_json_array ( std::string_view  json_data,
std::string_view  member_path 
)
constexpr

Parse JSON data where the root item is an array

Template Parameters
JsonElementThe type of each element in array. Must be one of the above json_XXX classes. This version is checked
ContainerContainer to store values in
ConstructorCallable to construct Container with no arguments
Parameters
json_dataJSON string data containing array
member_pathA dot separated path of member names to start parsing from. Array indices are specified with square brackets e.g. [5] is the 6th item
Template Parameters
KnownBoundsThe bounds of the json_data are known to contain the whole value
Returns
A Container containing parsed data from JSON string
Exceptions
daw::json::json_exception

◆ get() [1/3]

template<std::size_t Idx, typename ParseState >
constexpr decltype( auto ) DAW_JSON_NS::get ( basic_json_pair< ParseState > &&  parse_state)
constexpr

◆ get() [2/3]

template<std::size_t Idx, typename ParseState >
constexpr decltype( auto ) DAW_JSON_NS::get ( basic_json_pair< ParseState > &  parse_state)
constexpr

◆ get() [3/3]

template<std::size_t Idx, typename ParseState >
constexpr decltype( auto ) DAW_JSON_NS::get ( basic_json_pair< ParseState > const &  parse_state)
constexpr

◆ json_event_parser() [1/2]

template<typename ParsePolicy = NoCommentSkippingPolicyChecked, typename StackContainerPolicy = DefaultJsonEventParserStackPolicy< JsonEventParserStackValue<ParsePolicy>>, typename Handler >
constexpr void DAW_JSON_NS::json_event_parser ( DAW_JSON_NS::basic_json_value< ParsePolicy >  jvalue,
Handler &&  handler 
)
inlineconstexpr

◆ json_event_parser() [2/2]

template<typename ParsePolicy = NoCommentSkippingPolicyChecked, typename Handler >
void DAW_JSON_NS::json_event_parser ( std::string_view  json_document,
Handler &&  handler 
)
inline

◆ real2string()

template<typename Real , typename OutputIterator >
OutputIterator DAW_JSON_NS::real2string ( Real const &  value,
OutputIterator  out_it 
)
inline

◆ to_json() [1/2]

template<typename Result , typename Value , typename JsonClass >
constexpr Result DAW_JSON_NS::to_json ( Value const &  value)
constexpr

Serialize a value to JSON. Some types(std::string, string_view. integer's and floating point numbers do not need a mapping setup). For user classes, a json_data_contract specialization is needed.

Template Parameters
Resultstd::string like type to put result into
JsonClassType that has json_parser_description and to_json_data function overloads
Parameters
valuevalue to serialize
Returns
JSON string data

◆ to_json() [2/2]

template<typename Value , typename JsonClass , typename OutputIterator >
constexpr OutputIterator DAW_JSON_NS::to_json ( Value const &  value,
OutputIterator  out_it 
)
constexpr
Template Parameters
OutputIteratorIterator to character data to
JsonClassType that has json_parser_description and to_json_data function overloads
Parameters
valuevalue to serialize
out_itresult to serialize to

◆ to_json_array() [1/2]

template<typename Result , typename JsonElement , typename Container >
constexpr Result DAW_JSON_NS::to_json_array ( Container &&  c)
constexpr

Serialize a container to JSON. This convenience method allows for easier serialization of containers when the root of the document is an array Serialize Container

Template Parameters
ContainerType of Container to serialize the elements of
Parameters
cContainer containing data to serialize.
Returns
A std::string containing the serialized elements of c

◆ to_json_array() [2/2]

template<typename JsonElement , typename Container , typename OutputIterator >
constexpr OutputIterator DAW_JSON_NS::to_json_array ( Container const &  c,
OutputIterator  out_it 
)
constexpr

Serialize a container to JSON. This convenience method allows for easier serialization of containers when the root of the document is an array Serialize Container

Template Parameters
ContainerType of Container to serialize the elements of
OutputIteratorIterator to write data to
Parameters
cContainer containing data to serialize.
Returns
OutputIterator with final state of iterator

◆ to_json_path_string()

std::string DAW_JSON_NS::to_json_path_string ( std::vector< json_path_node > const &  path_stack)
inline

Convert a json_path_node stack to a JSON Path string.

Parameters
path_stackA vector with json_path_nodes representing the path in the JSON document tree
Returns
A string in JSON Path format

◆ to_string()

constexpr std::string_view DAW_JSON_NS::to_string ( JsonBaseParseTypes  pt)
constexpr

Variable Documentation

◆ force_aggregate_construction_v

template<typename T >
constexpr bool DAW_JSON_NS::force_aggregate_construction_v
inlineconstexpr
Initial value:
=
daw::is_detected_v<json_details::force_aggregate_construction_test, T>

◆ get_parse_type_v

template<JsonParseTypes ParseType, JsonNullable Nullable>
constexpr JsonParseTypes DAW_JSON_NS::get_parse_type_v
inlineconstexpr
Initial value:
=
Nullable == JsonNullable::Never ? ParseType : JsonParseTypes::Null

◆ is_no_name

template<typename JsonMember >
constexpr bool DAW_JSON_NS::is_no_name = JsonMember::name == no_name
inlineconstexpr

◆ no_name

constexpr char const DAW_JSON_NS::no_name[] = "\a"
inlineconstexpr