DAW JSON Link
daw_json_serialize_options_impl.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_json_option_bits.h"
15 
16 namespace daw::json {
17  inline namespace DAW_JSON_VER {
18  namespace json_details {
19  template<typename>
20  inline constexpr bool is_output_option_v = false;
21 
22  template<>
23  inline constexpr bool is_output_option_v<options::SerializationFormat> =
24  true;
25 
26  template<>
27  inline constexpr unsigned
28  json_option_bits_width<options::SerializationFormat> = 1;
29 
30  template<>
31  inline constexpr auto
32  default_json_option_value<options::SerializationFormat> =
33  options::SerializationFormat::Minified;
34 
35  template<>
36  inline constexpr bool is_output_option_v<options::IndentationType> = true;
37 
38  template<>
39  inline constexpr unsigned
40  json_option_bits_width<options::IndentationType> = 3;
41 
42  template<>
43  inline constexpr auto
44  default_json_option_value<options::IndentationType> =
45  options::IndentationType::Space2;
46 
47  template<>
48  inline constexpr bool
49  is_output_option_v<options::RestrictedStringOutput> = true;
50 
51  template<>
52  inline constexpr unsigned
53  json_option_bits_width<options::RestrictedStringOutput> = 2;
54 
55  template<>
56  inline constexpr auto
57  default_json_option_value<options::RestrictedStringOutput> =
58  options::RestrictedStringOutput::ErrorInvalidUTF8;
59 
60  template<>
61  inline constexpr bool is_output_option_v<options::NewLineDelimiter> =
62  true;
63 
64  template<>
65  inline constexpr unsigned
66  json_option_bits_width<options::NewLineDelimiter> = 1;
67 
68  template<>
69  inline constexpr auto
70  default_json_option_value<options::NewLineDelimiter> =
71  options::NewLineDelimiter::n;
72 
73  template<>
74  inline constexpr bool is_output_option_v<options::OutputTrailingComma> =
75  true;
76 
77  template<>
78  inline constexpr unsigned
79  json_option_bits_width<options::OutputTrailingComma> = 1;
80 
81  template<>
82  inline constexpr auto
83  default_json_option_value<options::OutputTrailingComma> =
84  options::OutputTrailingComma::No;
85  } // namespace json_details
86  } // namespace DAW_JSON_VER
87 } // namespace daw::json
Customization point traits.
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition: version.h:25