DAW JSON Link
daw_to_json_fwd.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 "impl/version.h"
12 
15 
16 namespace daw::json {
17  inline namespace DAW_JSON_VER {
18  namespace options {
21  template<auto... PolicyFlags>
22  struct output_flags_t {
23  static_assert(
24  ( json_details::is_output_option_v<decltype( PolicyFlags )> and ... ),
25  "Only valid output flags can be used. See cookbook "
26  "output_options.md" );
27  static constexpr json_options_t value =
28  json_details::serialization::set_bits(
29  json_details::serialization::default_policy_flag, PolicyFlags... );
30  };
33  template<>
34  struct output_flags_t<> {
35  static constexpr json_options_t value =
36  json_details::serialization::default_policy_flag;
37  };
38 
41  template<auto... PolicyFlags>
42  inline constexpr auto output_flags =
43  options::output_flags_t<PolicyFlags...>{ };
44  } // namespace options
45 
56  template<typename JsonClass = use_default, typename Value,
57  typename WritableType = std::string,
58  auto... PolicyFlags DAW_JSON_ENABLEIF(
60  daw::remove_cvref_t<WritableType>> )>
62  concepts::is_writable_output_type_v<daw::remove_cvref_t<WritableType>> )
63  constexpr daw::rvalue_to_value_t<WritableType> to_json(
64  Value const &value, WritableType &&it = std::string{ },
65  options::output_flags_t<PolicyFlags...> = options::output_flags<> );
66 
75  template<typename JsonClass = use_default, typename Value,
76  auto... PolicyFlags>
77  inline std::string to_json( Value const &value,
78  options::output_flags_t<PolicyFlags...> );
79 
89  template<typename JsonElement = use_default, typename Container,
90  typename WritableType,
91  auto... PolicyFlags DAW_JSON_ENABLEIF(
93  daw::remove_cvref_t<WritableType>> )>
95  concepts::is_writable_output_type_v<daw::remove_cvref_t<WritableType>> )
96  constexpr daw::rvalue_to_value_t<WritableType> to_json_array(
97  Container const &c, WritableType &&it,
98  options::output_flags_t<PolicyFlags...> = options::output_flags<> );
107  template<typename JsonElement = use_default, typename Container,
108  auto... PolicyFlags>
109  inline std::string to_json_array(
110  Container const &c,
111  options::output_flags_t<PolicyFlags...> = options::output_flags<> );
112  } // namespace DAW_JSON_VER
113 } // namespace daw::json
#define DAW_JSON_ENABLEIF(...)
std::string to_json(Value const &value, options::output_flags_t< PolicyFlags... > flgs)
Definition: daw_to_json.h:77
std::string to_json_array(Container const &c, options::output_flags_t< PolicyFlags... > flgs)
Definition: daw_to_json.h:163
constexpr auto output_flags
Specify output policy flags in to_json calls. See cookbook item output_options.md.
Customization point traits.
DAW_JSON_REQUIRES(boost::describe::has_describe_members< T >::value and use_boost_describe_v< T >) struct json_data_contract< T >
Specify output policy flags in to_json calls. See cookbook item output_options.md.
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition: version.h:25