DAW JSON Link
Loading...
Searching...
No Matches
daw_json_enums.h
Go to the documentation of this file.
1// Copyright (c) Darrell Wright
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5//
6// Official repository: https://github.com/beached/daw_json_link
7//
8
9#pragma once
10
11#include "version.h"
12
13#include <daw/daw_constant.h>
14
15#include <cstdint>
16#include <string_view>
17
18namespace daw::json {
19 inline namespace DAW_JSON_VER {
21 enum class JsonParseTypes : std::uint_fast8_t {
22 Real,
23 Signed,
24 Unsigned,
25 Bool,
26 StringRaw,
27 StringEscaped,
28 Date,
29 Class,
30 Array,
31 SizedArray,
33 Null,
34 KeyValue,
36 KeyValueArray,
37 Custom,
39 Variant,
41 VariantTagged,
44 VariantIntrusive,
46 Tuple,
48 Unknown,
49 };
50
52 enum class JsonBaseParseTypes : std::uint_fast8_t {
53 Number,
54 Bool,
55 String,
56 Class,
57 Array,
58 Null,
59 None
60 };
61
62 constexpr std::string_view to_string( JsonBaseParseTypes pt ) {
63 switch( pt ) {
64 case JsonBaseParseTypes::Number:
65 return "Number";
66 case JsonBaseParseTypes::Bool:
67 return "Bool";
68 case JsonBaseParseTypes::String:
69 return "String";
70 case JsonBaseParseTypes::Class:
71 return "Class";
72 case JsonBaseParseTypes::Array:
73 return "Array";
74 case JsonBaseParseTypes::Null:
75 return "Null";
76 case JsonBaseParseTypes::None:
77 default:
78 return "None";
79 }
80 }
81
84 enum class JsonNullable : unsigned {
87 Nullable,
90 NullVisible
91 };
92
96 template<JsonParseTypes v>
97 using ParseTag = daw::constant<v>;
98
99 } // namespace DAW_JSON_VER
100} // namespace daw::json
constexpr std::string_view to_string(JsonBaseParseTypes pt)
JsonParseTypes
The tags used by the parser to determine what parser to call.
JsonNullable
Control how json_nullable members are serialized.
Customization point traits.
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition version.h:20