diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e66663faa..11ca6f5720 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18.3) +cmake_minimum_required(VERSION 3.13) project(jsoncons) diff --git a/include/jsoncons/json_filter.hpp.orig b/include/jsoncons/json_filter.hpp.orig deleted file mode 100644 index c6ddec7903..0000000000 --- a/include/jsoncons/json_filter.hpp.orig +++ /dev/null @@ -1,666 +0,0 @@ -// Copyright 2013 Daniel Parker -// Distributed under the Boost license, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See https://github.com/danielaparker/jsoncons for latest version - -#ifndef JSONCONS_JSON_FILTER_HPP -#define JSONCONS_JSON_FILTER_HPP - -#include - -#include - -namespace jsoncons { - -template -class basic_json_filter : public basic_json_visitor -{ -public: - using typename basic_json_visitor::char_type; - using typename basic_json_visitor::string_view_type; -private: - basic_json_visitor* destination_; - - // noncopyable - basic_json_filter(const basic_json_filter&) = delete; - basic_json_filter& operator=(const basic_json_filter&) = delete; -public: - basic_json_filter(basic_json_visitor& visitor) - : destination_(std::addressof(visitor)) - { - } - - // moveable - basic_json_filter(basic_json_filter&&) = default; - basic_json_filter& operator=(basic_json_filter&&) = default; - - basic_json_visitor& destination() - { - return *destination_; - } - -#if !defined(JSONCONS_NO_DEPRECATED) - - JSONCONS_DEPRECATED_MSG("Instead, use destination()") - basic_json_visitor& to_handler() - { - return destination_; - } - JSONCONS_DEPRECATED_MSG("Instead, use destination") - basic_json_visitor& input_handler() - { - return destination_; - } - - JSONCONS_DEPRECATED_MSG("Instead, use destination") - basic_json_visitor& downstream_handler() - { - return destination_; - } - - JSONCONS_DEPRECATED_MSG("Instead, use destination") - basic_json_visitor& destination_handler() - { - return destination_; - } -#endif - -private: - void visit_flush() override - { - destination_->flush(); - } - - bool visit_begin_object(semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->begin_object(tag, context, ec); - } - - bool visit_begin_object(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->begin_object(length, tag, context, ec); - } - - bool visit_end_object(const ser_context& context, std::error_code& ec) override - { - return destination_->end_object(context, ec); - } - - bool visit_begin_array(semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->begin_array(tag, context, ec); - } - - bool visit_begin_array(std::size_t length, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->begin_array(length, tag, context, ec); - } - - bool visit_end_array(const ser_context& context, std::error_code& ec) override - { - return destination_->end_array(context, ec); - } - - bool visit_key(const string_view_type& name, - const ser_context& context, - std::error_code& ec) override - { - return destination_->key(name, context, ec); - } - - bool visit_string(const string_view_type& value, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->string_value(value, tag, context, ec); - } - - bool visit_byte_string(const byte_string_view& b, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->byte_string_value(b, tag, context, ec); - } - - bool visit_byte_string(const byte_string_view& b, - uint64_t ext_tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->byte_string_value(b, ext_tag, context, ec); - } - - bool visit_uint64(uint64_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->uint64_value(value, tag, context, ec); - } - - bool visit_int64(int64_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->int64_value(value, tag, context, ec); - } - - bool visit_half(uint16_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->half_value(value, tag, context, ec); - } - - bool visit_double(double value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->double_value(value, tag, context, ec); - } - - bool visit_bool(bool value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->bool_value(value, tag, context, ec); - } - - bool visit_null(semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->null_value(tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(half_arg_t, - const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(half_arg, s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_begin_multi_dim(const jsoncons::span& shape, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->begin_multi_dim(shape, tag, context, ec); - } - - bool visit_end_multi_dim(const ser_context& context, - std::error_code& ec) override - { - return destination_->end_multi_dim(context, ec); - } -}; - -template -class basic_rename_object_key_filter : public basic_json_filter -{ -public: - using typename basic_json_filter::string_view_type; - -private: - std::basic_string name_; - std::basic_string new_name_; -public: - basic_rename_object_key_filter(const std::basic_string& name, - const std::basic_string& new_name, - basic_json_visitor& visitor) - : basic_json_filter(visitor), - name_(name), new_name_(new_name) - { - } - -private: - bool visit_key(const string_view_type& name, - const ser_context& context, - std::error_code& ec) override - { - if (name == name_) - { - return this->destination().key(new_name_,context, ec); - } - else - { - return this->destination().key(name,context,ec); - } - } -}; - -template -class json_visitor_adaptor : public From -{ -public: - using typename From::string_view_type; -private: - To* destination_; - - // noncopyable - json_visitor_adaptor(const json_visitor_adaptor&) = delete; - json_visitor_adaptor& operator=(const json_visitor_adaptor&) = delete; -public: - - json_visitor_adaptor() - : destination_(nullptr) - { - } - json_visitor_adaptor(To& visitor) - : destination_(std::addressof(visitor)) - { - } - - // moveable - json_visitor_adaptor(json_visitor_adaptor&&) = default; - json_visitor_adaptor& operator=(json_visitor_adaptor&&) = default; - - To& destination() - { - return *destination_; - } - -private: - void visit_flush() override - { - destination_->flush(); - } - - bool visit_begin_object(semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->begin_object(tag, context, ec); - } - - bool visit_begin_object(std::size_t length, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->begin_object(length, tag, context, ec); - } - - bool visit_end_object(const ser_context& context, std::error_code& ec) override - { - return destination_->end_object(context, ec); - } - - bool visit_begin_array(semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->begin_array(tag, context, ec); - } - - bool visit_begin_array(std::size_t length, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->begin_array(length, tag, context, ec); - } - - bool visit_end_array(const ser_context& context, std::error_code& ec) override - { - return destination_->end_array(context, ec); - } - - bool visit_key(const string_view_type& name, - const ser_context& context, - std::error_code& ec) override - { - std::basic_string target; - auto result = unicons::convert(name.begin(),name.end(),std::back_inserter(target),unicons::conv_flags::strict); - if (result.ec != unicons::conv_errc()) - { - ec = result.ec; - } - return destination().key(target, context, ec); - } - - bool visit_string(const string_view_type& value, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - std::basic_string target; - auto result = unicons::convert(value.begin(),value.end(),std::back_inserter(target),unicons::conv_flags::strict); - if (result.ec != unicons::conv_errc()) - { - JSONCONS_THROW(ser_error(result.ec)); - } - return destination().string_value(target, tag, context, ec); - } - - bool visit_byte_string(const byte_string_view& b, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->byte_string_value(b, tag, context, ec); - } - - bool visit_byte_string(const byte_string_view& b, - uint64_t ext_tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->byte_string_value(b, ext_tag, context, ec); - } - - bool visit_half(uint16_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->half_value(value, tag, context, ec); - } - - bool visit_double(double value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->double_value(value, tag, context, ec); - } - - bool visit_int64(int64_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->int64_value(value, tag, context, ec); - } - - bool visit_uint64(uint64_t value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->uint64_value(value, tag, context, ec); - } - - bool visit_bool(bool value, semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->bool_value(value, tag, context, ec); - } - - bool visit_null(semantic_tag tag, const ser_context& context, std::error_code& ec) override - { - return destination_->null_value(tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(half_arg_t, - const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(half_arg, s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_typed_array(const jsoncons::span& s, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->typed_array(s, tag, context, ec); - } - - bool visit_begin_multi_dim(const jsoncons::span& shape, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - return destination_->begin_multi_dim(shape, tag, context, ec); - } - - bool visit_end_multi_dim(const ser_context& context, - std::error_code& ec) override - { - return destination_->end_multi_dim(context, ec); - } - -}; - -template -class json_visitor_adaptor : public basic_json_filter -{ - using supertype = basic_json_filter; -public: - using typename From::string_view_type; - using supertype::destination; -private: - - // noncopyable - json_visitor_adaptor(const json_visitor_adaptor&) = delete; - json_visitor_adaptor& operator=(const json_visitor_adaptor&) = delete; -public: - json_visitor_adaptor(To& visitor) - : supertype(visitor) - { - } - - // moveable - json_visitor_adaptor(json_visitor_adaptor&&) = default; - json_visitor_adaptor& operator=(json_visitor_adaptor&&) = default; - -private: - - bool visit_key(const string_view_type& name, - const ser_context& context, - std::error_code& ec) override - { - std::basic_string target; - auto result = unicons::convert(name.begin(),name.end(),std::back_inserter(target),unicons::conv_flags::strict); - if (result.ec != unicons::conv_errc()) - { - ec = result.ec; - } - return destination().key(target, context, ec); - } - - bool visit_string(const string_view_type& value, - semantic_tag tag, - const ser_context& context, - std::error_code& ec) override - { - std::basic_string target; - auto result = unicons::convert(value.begin(),value.end(),std::back_inserter(target),unicons::conv_flags::strict); - if (result.ec != unicons::conv_errc()) - { - JSONCONS_THROW(ser_error(result.ec)); - } - return destination().string_value(target, tag, context, ec); - } -}; -/* -template -class json_visitor_adaptor::value>::type> -{ -public: - using char_type = typename From::char_type; - using char_traits_type = typename From::char_traits_type; - using string_view_type = typename From::string_view_type; -private: - To* destination_; -public: - json_visitor_adaptor() - : destination_(nullptr) - { - } - json_visitor_adaptor(To& visitor) - : destination_(std::addressof(visitor)) - { - } - - operator From&() { return *destination_; } - - // moveable - json_visitor_adaptor(json_visitor_adaptor&&) = default; - json_visitor_adaptor& operator=(json_visitor_adaptor&&) = default; - - To& destination() - { - return *destination_; - } -}; -*/ -template -json_visitor_adaptor make_json_visitor_adaptor(To& to) -{ - return json_visitor_adaptor(to); -} - -using json_filter = basic_json_filter; -using wjson_filter = basic_json_filter; -using rename_object_key_filter = basic_rename_object_key_filter; -using wrename_object_key_filter = basic_rename_object_key_filter; - -#if !defined(JSONCONS_NO_DEPRECATED) -template -using basic_json_content_filter = basic_json_filter; -JSONCONS_DEPRECATED_MSG("Instead, use json_filter") typedef basic_json_filter json_content_filter; -JSONCONS_DEPRECATED_MSG("Instead, use wjson_filter") typedef basic_json_filter wjson_content_filter; -JSONCONS_DEPRECATED_MSG("Instead, use rename_object_key_filter") typedef basic_rename_object_key_filter rename_name_filter; -JSONCONS_DEPRECATED_MSG("Instead, use wrename_object_key_filter") typedef basic_rename_object_key_filter wrename_name_filter; -JSONCONS_DEPRECATED_MSG("Instead, use rename_object_key_filter") typedef basic_rename_object_key_filter rename_object_member_filter; -JSONCONS_DEPRECATED_MSG("Instead, use wrename_object_key_filter") typedef basic_rename_object_key_filter wrename_object_member_filter; -#endif - -} - -#endif diff --git a/include/jsoncons/json_traits_macros.hpp.orig b/include/jsoncons/json_traits_macros.hpp.orig deleted file mode 100644 index f8448aee56..0000000000 --- a/include/jsoncons/json_traits_macros.hpp.orig +++ /dev/null @@ -1,1052 +0,0 @@ -// Copyright 2019 Daniel Parker -// Distributed under the Boost license, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See https://github.com/danielaparker/jsoncons for latest version - -#ifndef JSONCONS_JSON_TRAITS_MACROS_HPP -#define JSONCONS_JSON_TRAITS_MACROS_HPP - -#include // std::swap -#include // std::iterator_traits, std::input_iterator_tag -#include // JSONCONS_EXPAND, JSONCONS_QUOTE -#include -#include -#include // std::numeric_limits -#include -#include // std::enable_if -#include -#include - -namespace jsoncons -{ - #define JSONCONS_RDONLY(X) - - #define JSONCONS_RDWR(X) X - - struct always_true - { - template< class T> - constexpr bool operator()(const T&) const noexcept - { - return true; - } - }; - - struct identity - { - template< class T> - constexpr T&& operator()(T&& val) const noexcept - { - return std::forward(val); - } - }; - - template - struct json_traits_macro_names - {}; - - template - struct json_traits_helper - { - using string_view_type = typename Json::string_view_type; - - template - static void set_udt_member(const Json&, const string_view_type&, const OutputType&) - { - } - template - static void set_udt_member(const Json& j, const string_view_type& key, OutputType& val) - { - val = j.at(key).template as(); - } - - template - static void set_udt_member(const Json&, const string_view_type&, From, const OutputType&) - { - } - template - static void set_udt_member(const Json& j, const string_view_type& key, From from, OutputType& val) - { - val = from(j.at(key).template as()); - } - template - static void set_optional_json_member(const string_view_type& key, const std::shared_ptr& val, Json& j) - { - if (val) j.try_emplace(key, val); - } - template - static void set_optional_json_member(const string_view_type& key, const std::unique_ptr& val, Json& j) - { - if (val) j.try_emplace(key, val); - } - template - static void set_optional_json_member(const string_view_type& key, const jsoncons::optional& val, Json& j) - { - if (val) j.try_emplace(key, val); - } - template - static void set_optional_json_member(const string_view_type& key, const U& val, Json& j) - { - j.try_emplace(key, val); - } - }; -} - -#if defined(_MSC_VER) -#pragma warning( disable : 4127) -#endif - -#define JSONCONS_CONCAT_RAW(a, b) a ## b -#define JSONCONS_CONCAT(a, b) JSONCONS_CONCAT_RAW(a, b) - -// Inspired by https://github.com/Loki-Astari/ThorsSerializer/blob/master/src/Serialize/Traits.h - -#define JSONCONS_NARGS(...) JSONCONS_NARG_(__VA_ARGS__, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) -#define JSONCONS_NARG_(...) JSONCONS_EXPAND( JSONCONS_ARG_N(__VA_ARGS__) ) -#define JSONCONS_ARG_N(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, N, ...) N - -#define JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, Count) Call(P1, P2, P3, P4, Count) - -#define JSONCONS_VARIADIC_REP_N(Call, P1, P2, P3, ...) JSONCONS_VARIADIC_REP_OF_N(Call, P1,P2, P3, JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) -#define JSONCONS_VARIADIC_REP_OF_N(Call, P1, P2, P3, Count, ...) JSONCONS_VARIADIC_REP_OF_N_(Call, P1, P2, P3, Count, __VA_ARGS__) -#define JSONCONS_VARIADIC_REP_OF_N_(Call, P1, P2, P3, Count, ...) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_ ## Count(Call, P1, P2, P3, __VA_ARGS__)) - -#define JSONCONS_VARIADIC_REP_OF_50(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 50) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_49(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_49(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 49) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_48(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_48(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 48) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_47(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_47(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 47, ) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_46(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_46(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 46) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_45(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_45(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 45) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_44(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_44(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 44) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_43(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_43(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 43) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_42(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_42(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 42) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_41(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_41(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 41) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_40(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_40(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 40) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_39(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_39(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 39) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_38(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_38(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 38) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_37(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_37(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 37) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_36(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_36(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 36) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_35(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_35(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 35) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_34(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_34(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 34) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_33(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_33(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 33) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_32(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_32(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 32) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_31(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_31(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 31) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_30(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_30(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 30) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_29(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_29(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 29) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_28(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_28(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 28) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_27(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_27(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 27) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_26(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_26(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 26) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_25(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_25(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 25) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_24(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_24(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 24) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_23(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_23(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 23) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_22(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_22(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 22) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_21(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_21(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 21) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_20(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_20(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 20) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_19(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_19(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 19) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_18(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_18(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 18) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_17(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_17(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 17) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_16(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_16(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 16) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_15(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_15(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 15) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_14(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_14(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 14) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_13(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_13(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 13) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_12(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_12(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 12) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_11(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_11(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 11) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_10(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_10(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 10) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_9(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_9(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 9) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_8(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_8(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 8) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_7(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_7(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 7) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_6(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_6(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 6) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_5(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_5(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 5) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_4(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_4(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 4) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_3(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_3(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 3) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_2(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_2(Call, P1, P2, P3, P4, ...) JSONCONS_EXPAND_CALL5(Call, P1, P2, P3, P4, 2) JSONCONS_EXPAND(JSONCONS_VARIADIC_REP_OF_1(Call, P1, P2, P3, __VA_ARGS__)) -#define JSONCONS_VARIADIC_REP_OF_1(Call, P1, P2, P3, P4) JSONCONS_EXPAND(Call ## _LAST(P1, P2, P3, P4, 1)) - -#define JSONCONS_TYPE_TRAITS_FRIEND \ - template \ - friend struct jsoncons::json_type_traits; - -#define JSONCONS_EXPAND_CALL2(Call, Expr, Id) JSONCONS_EXPAND(Call(Expr, Id)) - -#define JSONCONS_REP_OF_N(Call, Expr, Pre, App, Count) JSONCONS_REP_OF_ ## Count(Call, Expr, Pre, App) - -#define JSONCONS_REP_OF_50(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 50) JSONCONS_REP_OF_49(Call, Expr, , App) -#define JSONCONS_REP_OF_49(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 49) JSONCONS_REP_OF_48(Call, Expr, , App) -#define JSONCONS_REP_OF_48(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 48) JSONCONS_REP_OF_47(Call, Expr, , App) -#define JSONCONS_REP_OF_47(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 47) JSONCONS_REP_OF_46(Call, Expr, , App) -#define JSONCONS_REP_OF_46(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 46) JSONCONS_REP_OF_45(Call, Expr, , App) -#define JSONCONS_REP_OF_45(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 45) JSONCONS_REP_OF_44(Call, Expr, , App) -#define JSONCONS_REP_OF_44(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 44) JSONCONS_REP_OF_43(Call, Expr, , App) -#define JSONCONS_REP_OF_43(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 43) JSONCONS_REP_OF_42(Call, Expr, , App) -#define JSONCONS_REP_OF_42(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 42) JSONCONS_REP_OF_41(Call, Expr, , App) -#define JSONCONS_REP_OF_41(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 41) JSONCONS_REP_OF_40(Call, Expr, , App) -#define JSONCONS_REP_OF_40(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 40) JSONCONS_REP_OF_39(Call, Expr, , App) -#define JSONCONS_REP_OF_39(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 39) JSONCONS_REP_OF_38(Call, Expr, , App) -#define JSONCONS_REP_OF_38(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 38) JSONCONS_REP_OF_37(Call, Expr, , App) -#define JSONCONS_REP_OF_37(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 37) JSONCONS_REP_OF_36(Call, Expr, , App) -#define JSONCONS_REP_OF_36(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 36) JSONCONS_REP_OF_35(Call, Expr, , App) -#define JSONCONS_REP_OF_35(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 35) JSONCONS_REP_OF_34(Call, Expr, , App) -#define JSONCONS_REP_OF_34(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 34) JSONCONS_REP_OF_33(Call, Expr, , App) -#define JSONCONS_REP_OF_33(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 33) JSONCONS_REP_OF_32(Call, Expr, , App) -#define JSONCONS_REP_OF_32(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 32) JSONCONS_REP_OF_31(Call, Expr, , App) -#define JSONCONS_REP_OF_31(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 31) JSONCONS_REP_OF_30(Call, Expr, , App) -#define JSONCONS_REP_OF_30(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 30) JSONCONS_REP_OF_29(Call, Expr, , App) -#define JSONCONS_REP_OF_29(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 29) JSONCONS_REP_OF_28(Call, Expr, , App) -#define JSONCONS_REP_OF_28(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 28) JSONCONS_REP_OF_27(Call, Expr, , App) -#define JSONCONS_REP_OF_27(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 27) JSONCONS_REP_OF_26(Call, Expr, , App) -#define JSONCONS_REP_OF_26(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 26) JSONCONS_REP_OF_25(Call, Expr, , App) -#define JSONCONS_REP_OF_25(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 25) JSONCONS_REP_OF_24(Call, Expr, , App) -#define JSONCONS_REP_OF_24(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 24) JSONCONS_REP_OF_23(Call, Expr, , App) -#define JSONCONS_REP_OF_23(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 23) JSONCONS_REP_OF_22(Call, Expr, , App) -#define JSONCONS_REP_OF_22(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 22) JSONCONS_REP_OF_21(Call, Expr, , App) -#define JSONCONS_REP_OF_21(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 21) JSONCONS_REP_OF_20(Call, Expr, , App) -#define JSONCONS_REP_OF_20(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 20) JSONCONS_REP_OF_19(Call, Expr, , App) -#define JSONCONS_REP_OF_19(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 19) JSONCONS_REP_OF_18(Call, Expr, , App) -#define JSONCONS_REP_OF_18(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 18) JSONCONS_REP_OF_17(Call, Expr, , App) -#define JSONCONS_REP_OF_17(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 17) JSONCONS_REP_OF_16(Call, Expr, , App) -#define JSONCONS_REP_OF_16(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 16) JSONCONS_REP_OF_15(Call, Expr, , App) -#define JSONCONS_REP_OF_15(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 15) JSONCONS_REP_OF_14(Call, Expr, , App) -#define JSONCONS_REP_OF_14(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 14) JSONCONS_REP_OF_13(Call, Expr, , App) -#define JSONCONS_REP_OF_13(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 13) JSONCONS_REP_OF_12(Call, Expr, , App) -#define JSONCONS_REP_OF_12(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 12) JSONCONS_REP_OF_11(Call, Expr, , App) -#define JSONCONS_REP_OF_11(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 11) JSONCONS_REP_OF_10(Call, Expr, , App) -#define JSONCONS_REP_OF_10(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 10) JSONCONS_REP_OF_9(Call, Expr, , App) -#define JSONCONS_REP_OF_9(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 9) JSONCONS_REP_OF_8(Call, Expr, , App) -#define JSONCONS_REP_OF_8(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 8) JSONCONS_REP_OF_7(Call, Expr, , App) -#define JSONCONS_REP_OF_7(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 7) JSONCONS_REP_OF_6(Call, Expr, , App) -#define JSONCONS_REP_OF_6(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 6) JSONCONS_REP_OF_5(Call, Expr, , App) -#define JSONCONS_REP_OF_5(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 5) JSONCONS_REP_OF_4(Call, Expr, , App) -#define JSONCONS_REP_OF_4(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 4) JSONCONS_REP_OF_3(Call, Expr, , App) -#define JSONCONS_REP_OF_3(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 3) JSONCONS_REP_OF_2(Call, Expr, , App) -#define JSONCONS_REP_OF_2(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call, Expr, 2) JSONCONS_REP_OF_1(Call, Expr, , App) -#define JSONCONS_REP_OF_1(Call, Expr, Pre, App) Pre JSONCONS_EXPAND_CALL2(Call ## _LAST, Expr, 1) App -#define JSONCONS_REP_OF_0(Call, Expr, Pre, App) - -#define JSONCONS_GENERATE_TPL_PARAMS(Call, Count) JSONCONS_REP_OF_N(Call, , , ,Count) -#define JSONCONS_GENERATE_TPL_ARGS(Call, Count) JSONCONS_REP_OF_N(Call, ,<,>,Count) -#define JSONCONS_GENERATE_TPL_PARAM(Expr, Id) typename T ## Id, -#define JSONCONS_GENERATE_TPL_PARAM_LAST(Expr, Id) typename T ## Id -#define JSONCONS_GENERATE_MORE_TPL_PARAM(Expr, Id) , typename T ## Id -#define JSONCONS_GENERATE_MORE_TPL_PARAM_LAST(Expr, Id) , typename T ## Id -#define JSONCONS_GENERATE_TPL_ARG(Expr, Id) T ## Id, -#define JSONCONS_GENERATE_TPL_ARG_LAST(Ex, Id) T ## Id - -#define JSONCONS_GENERATE_NAME_STR(Prefix, P2, P3, Member, Count) JSONCONS_GENERATE_NAME_STR_LAST(Prefix, P2, P3, Member, Count) -#define JSONCONS_GENERATE_NAME_STR_LAST(Prefix, P2, P3, Member, Count) \ - static inline const char* Member ## _str(char) {return JSONCONS_QUOTE(,Member);} \ - static inline const wchar_t* Member ## _str(wchar_t) {return JSONCONS_QUOTE(L,Member);} \ - /**/ - -#define JSONCONS_N_MEMBER_IS(Prefix, P2, P3, Member, Count) JSONCONS_N_MEMBER_IS_LAST(Prefix, P2, P3, Member, Count) -#define JSONCONS_N_MEMBER_IS_LAST(Prefix, P2, P3, Member, Count) if ((num_params-Count) < num_mandatory_params1 && !ajson.contains(json_traits_macro_names::Member##_str(char_type{}))) return false; - -#define JSONCONS_N_MEMBER_AS(Prefix,P2,P3, Member, Count) JSONCONS_N_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) -#define JSONCONS_N_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) \ - if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names::Member##_str(char_type{}))) \ - {json_traits_helper::set_udt_member(ajson,json_traits_macro_names::Member##_str(char_type{}),aval.Member);} - -#define JSONCONS_ALL_MEMBER_AS(Prefix, P2,P3,Member, Count) JSONCONS_ALL_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) -#define JSONCONS_ALL_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) \ - json_traits_helper::set_udt_member(ajson,json_traits_macro_names::Member##_str(char_type{}),aval.Member); - -#define JSONCONS_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_TO_JSON_LAST(Prefix, P2, P3, Member, Count) -#define JSONCONS_TO_JSON_LAST(Prefix, P2, P3, Member, Count) if ((num_params-Count) < num_mandatory_params2) \ - {ajson.try_emplace(json_traits_macro_names::Member##_str(char_type{}), aval.Member);} \ - else {json_traits_helper::set_optional_json_member(json_traits_macro_names::Member##_str(char_type{}), aval.Member, ajson);} - -#define JSONCONS_ALL_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_ALL_TO_JSON_LAST(Prefix, P2, P3, Member, Count) -#define JSONCONS_ALL_TO_JSON_LAST(Prefix, P2, P3, Member, Count) \ - ajson.try_emplace(json_traits_macro_names::Member##_str(char_type{}), aval.Member); - -#define JSONCONS_MEMBER_TRAITS_BASE(AsT,ToJ,NumTemplateParams,ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_traits_macro_names \ - { \ - JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ - }; \ - template \ - struct json_type_traits \ - { \ - using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ - using allocator_type = typename Json::allocator_type; \ - using char_type = typename Json::char_type; \ - using string_view_type = typename Json::string_view_type; \ - constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ - constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ - constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_N_MEMBER_IS, ,,, __VA_ARGS__)\ - return true; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # ValueType)); \ - value_type aval{}; \ - JSONCONS_VARIADIC_REP_N(AsT, ,,, __VA_ARGS__) \ - return aval; \ - } \ - static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ - { \ - Json ajson(json_object_arg, semantic_tag::none, alloc); \ - JSONCONS_VARIADIC_REP_N(ToJ, ,,, __VA_ARGS__) \ - return ajson; \ - } \ - }; \ -} \ - /**/ - -#define JSONCONS_N_MEMBER_TRAITS(ValueType,NumMandatoryParams,...) \ - JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_N_MEMBER_AS, JSONCONS_TO_JSON,0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_N_MEMBER_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ - JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_N_MEMBER_AS, JSONCONS_TO_JSON,NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_ALL_MEMBER_TRAITS(ValueType, ...) \ - JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_ALL_MEMBER_AS,JSONCONS_ALL_TO_JSON,0,ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_ALL_MEMBER_TRAITS(NumTemplateParams, ValueType, ...) \ - JSONCONS_MEMBER_TRAITS_BASE(JSONCONS_ALL_MEMBER_AS,JSONCONS_ALL_TO_JSON,NumTemplateParams,ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_MEMBER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_MEMBER_NAME_IS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_MEMBER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_MEMBER_NAME_IS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_MEMBER_NAME_IS_2(Member, Name) !ajson.contains(Name)) return false; -#define JSONCONS_MEMBER_NAME_IS_3(Member, Name, Mode) JSONCONS_MEMBER_NAME_IS_2(Member, Name) -#define JSONCONS_MEMBER_NAME_IS_4(Member, Name, Mode, Match) JSONCONS_MEMBER_NAME_IS_6(Member, Name, Mode, Match, , ) -#define JSONCONS_MEMBER_NAME_IS_5(Member, Name, Mode, Match, Into) JSONCONS_MEMBER_NAME_IS_6(Member, Name, Mode, Match, Into, ) -#define JSONCONS_MEMBER_NAME_IS_6(Member, Name, Mode, Match, Into, From) !ajson.contains(Name)) return false; \ - JSONCONS_TRY{if (!Match(ajson.at(Name).template asMember))>::type>())) return false;} \ - JSONCONS_CATCH(...) {return false;} - -#define JSONCONS_N_MEMBER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_N_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_N_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_MEMBER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_N_MEMBER_NAME_AS_2(Member, Name) \ - if (ajson.contains(Name)) {json_traits_helper::set_udt_member(ajson,Name,aval.Member);} -#define JSONCONS_N_MEMBER_NAME_AS_3(Member, Name, Mode) Mode(JSONCONS_N_MEMBER_NAME_AS_2(Member, Name)) -#define JSONCONS_N_MEMBER_NAME_AS_4(Member, Name, Mode, Match) \ - Mode(if (ajson.contains(Name)) {json_traits_helper::set_udt_member(ajson,Name,aval.Member);}) -#define JSONCONS_N_MEMBER_NAME_AS_5(Member, Name, Mode, Match, Into) \ - Mode(if (ajson.contains(Name)) {json_traits_helper::template set_udt_memberMember))>::type>(ajson,Name,aval.Member);}) -#define JSONCONS_N_MEMBER_NAME_AS_6(Member, Name, Mode, Match, Into, From) \ - Mode(if (ajson.contains(Name)) {json_traits_helper::template set_udt_memberMember))>::type>(ajson,Name,From,aval.Member);}) - -#define JSONCONS_ALL_MEMBER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_ALL_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_ALL_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_MEMBER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_ALL_MEMBER_NAME_AS_2(Member, Name) \ - json_traits_helper::set_udt_member(ajson,Name,aval.Member); -#define JSONCONS_ALL_MEMBER_NAME_AS_3(Member, Name, Mode) Mode(JSONCONS_ALL_MEMBER_NAME_AS_2(Member, Name)) -#define JSONCONS_ALL_MEMBER_NAME_AS_4(Member, Name, Mode, Match) \ - Mode(json_traits_helper::set_udt_member(ajson,Name,aval.Member);) -#define JSONCONS_ALL_MEMBER_NAME_AS_5(Member, Name, Mode, Match, Into) \ - Mode(json_traits_helper::template set_udt_memberMember))>::type>(ajson,Name,aval.Member);) -#define JSONCONS_ALL_MEMBER_NAME_AS_6(Member, Name, Mode, Match, Into, From) \ - Mode(json_traits_helper::template set_udt_memberMember))>::type>(ajson,Name,From,aval.Member);) - -#define JSONCONS_N_MEMBER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_N_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_N_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_MEMBER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_N_MEMBER_NAME_TO_JSON_2(Member, Name) \ - {ajson.try_emplace(Name, aval.Member);} \ -else \ - {json_traits_helper::set_optional_json_member(Name, aval.Member, ajson);} -#define JSONCONS_N_MEMBER_NAME_TO_JSON_3(Member, Name, Mode) JSONCONS_N_MEMBER_NAME_TO_JSON_2(Member, Name) -#define JSONCONS_N_MEMBER_NAME_TO_JSON_4(Member, Name, Mode, Match) JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match,,) -#define JSONCONS_N_MEMBER_NAME_TO_JSON_5(Member, Name, Mode, Match, Into) JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, ) -#define JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) \ - {ajson.try_emplace(Name, Into(aval.Member));} \ -else \ - {json_traits_helper::set_optional_json_member(Name, Into(aval.Member), ajson);} - -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_ALL_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_MEMBER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) ajson.try_emplace(Name, aval.Member); -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_3(Member, Name, Mode) JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_4(Member, Name, Mode, Match) JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match,,) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_5(Member, Name, Mode, Match, Into) JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, ) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(aval.Member)); - -#define JSONCONS_MEMBER_NAME_TRAITS_BASE(AsT,ToJ, NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_type_traits \ - { \ - using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ - using allocator_type = typename Json::allocator_type; \ - using char_type = typename Json::char_type; \ - using string_view_type = typename Json::string_view_type; \ - constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ - constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ - constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_MEMBER_NAME_IS,,,, __VA_ARGS__)\ - return true; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # ValueType)); \ - value_type aval{}; \ - JSONCONS_VARIADIC_REP_N(AsT,,,, __VA_ARGS__) \ - return aval; \ - } \ - static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ - { \ - Json ajson(json_object_arg, semantic_tag::none, alloc); \ - JSONCONS_VARIADIC_REP_N(ToJ,,,, __VA_ARGS__) \ - return ajson; \ - } \ - }; \ -} \ - /**/ - - -#define JSONCONS_N_MEMBER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \ - JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_N_MEMBER_NAME_AS, JSONCONS_N_MEMBER_NAME_TO_JSON, 0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_N_MEMBER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ - JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_N_MEMBER_NAME_AS, JSONCONS_N_MEMBER_NAME_TO_JSON, NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_ALL_MEMBER_NAME_TRAITS(ValueType, ...) \ - JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_ALL_MEMBER_NAME_AS, JSONCONS_ALL_MEMBER_NAME_TO_JSON, 0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_ALL_MEMBER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \ - JSONCONS_MEMBER_NAME_TRAITS_BASE(JSONCONS_ALL_MEMBER_NAME_AS, JSONCONS_ALL_MEMBER_NAME_TO_JSON, NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_CTOR_GETTER_IS(Prefix, P2, P3, Getter, Count) JSONCONS_CTOR_GETTER_IS_LAST(Prefix, P2, P3, Getter, Count) -#define JSONCONS_CTOR_GETTER_IS_LAST(Prefix, P2, P3, Getter, Count) if ((num_params-Count) < num_mandatory_params1 && !ajson.contains(json_traits_macro_names::Getter##_str(char_type{}))) return false; - -#define JSONCONS_CTOR_GETTER_AS(Prefix, P2, P3, Getter, Count) JSONCONS_CTOR_GETTER_AS_LAST(Prefix, P2, P3, Getter, Count), -#define JSONCONS_CTOR_GETTER_AS_LAST(Prefix, P2, P3, Getter, Count) ((num_params-Count) < num_mandatory_params2) ? (ajson.at(json_traits_macro_names::Getter##_str(char_type{}))).template asGetter())>::type>() : (ajson.contains(json_traits_macro_names::Getter##_str(char_type{})) ? (ajson.at(json_traits_macro_names::Getter##_str(char_type{}))).template asGetter())>::type>() : typename std::decayGetter())>::type()) - -#define JSONCONS_CTOR_GETTER_TO_JSON(Prefix, P2, P3, Getter, Count) JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Getter, Count) - -#define JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Getter, Count) \ -if ((num_params-Count) < num_mandatory_params2) { \ - ajson.try_emplace(json_traits_macro_names::Getter##_str(char_type{}), aval.Getter() ); \ - } \ -else { \ - json_traits_helper::set_optional_json_member(json_traits_macro_names::Getter##_str(char_type{}), aval.Getter(), ajson); \ -} - -#define JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_traits_macro_names \ - { \ - JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ - }; \ - template \ - struct json_type_traits \ - { \ - using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ - using allocator_type = typename Json::allocator_type; \ - using char_type = typename Json::char_type; \ - using string_view_type = typename Json::string_view_type; \ - constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ - constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ - constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_IS, ,,, __VA_ARGS__)\ - return true; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # ValueType)); \ - return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_AS, ,,, __VA_ARGS__) ); \ - } \ - static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ - { \ - Json ajson(json_object_arg, semantic_tag::none, alloc); \ - JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_TO_JSON, ,,, __VA_ARGS__) \ - return ajson; \ - } \ - }; \ -} \ - /**/ - -#define JSONCONS_ALL_CTOR_GETTER_TRAITS(ValueType, ...) \ - JSONCONS_CTOR_GETTER_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS(NumTemplateParams, ValueType, ...) \ - JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_N_CTOR_GETTER_TRAITS(ValueType,NumMandatoryParams, ...) \ - JSONCONS_CTOR_GETTER_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_N_ALL_CTOR_GETTER_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ - JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_CTOR_GETTER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_CTOR_GETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_IS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_CTOR_GETTER_NAME_IS_2(Getter, Name) !ajson.contains(Name)) return false; -#define JSONCONS_CTOR_GETTER_NAME_IS_3(Getter, Name, Mode) JSONCONS_CTOR_GETTER_NAME_IS_2(Getter, Name) -#define JSONCONS_CTOR_GETTER_NAME_IS_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_IS_6(Getter, Name, Mode, Match, , ) -#define JSONCONS_CTOR_GETTER_NAME_IS_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_IS_6(Getter, Name, Mode, Match, Into, ) -#define JSONCONS_CTOR_GETTER_NAME_IS_6(Getter, Name, Mode, Match, Into, From) !ajson.contains(Name)) return false; \ - JSONCONS_TRY{if (!Match(ajson.at(Name).template asGetter()))>::type>())) return false;} \ - JSONCONS_CATCH(...) {return false;} - -#define JSONCONS_CTOR_GETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_CTOR_GETTER_NAME_AS_2(Getter, Name) JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name) JSONCONS_COMMA -#define JSONCONS_CTOR_GETTER_NAME_AS_3(Getter, Name, Mode) Mode(JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name)) Mode(JSONCONS_COMMA) -#define JSONCONS_CTOR_GETTER_NAME_AS_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_AS_6(Getter, Name, Mode, Match,,) -#define JSONCONS_CTOR_GETTER_NAME_AS_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_AS_6(Getter, Name, Mode, Match, Into, ) -#define JSONCONS_CTOR_GETTER_NAME_AS_6(Getter, Name, Mode, Match, Into, From) JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter,Name,Mode,Match,Into,From) Mode(JSONCONS_COMMA) -#define JSONCONS_COMMA , - -#define JSONCONS_CTOR_GETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_AS_LAST_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name) (ajson.contains(Name)) ? (ajson.at(Name)).template asGetter())>::type>() : typename std::decayGetter())>::type() -#define JSONCONS_CTOR_GETTER_NAME_AS_LAST_3(Getter, Name, Mode) Mode(JSONCONS_CTOR_GETTER_NAME_AS_LAST_2(Getter, Name)) -#define JSONCONS_CTOR_GETTER_NAME_AS_LAST_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter, Name, Mode, Match,,) -#define JSONCONS_CTOR_GETTER_NAME_AS_LAST_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter, Name, Mode, Match, Into, ) -#define JSONCONS_CTOR_GETTER_NAME_AS_LAST_6(Getter, Name, Mode, Match, Into, From) Mode(ajson.contains(Name) ? From(ajson.at(Name).template asGetter()))>::type>()) : From(typename std::decayGetter()))>::type())) - -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) \ -{ \ - ajson.try_emplace(Name, aval.Getter() ); \ -} \ -else { \ - json_traits_helper::set_optional_json_member(Name, aval.Getter(), ajson); \ -} -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_3(Getter, Name, Mode) JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_TO_JSON_6(Getter, Name, Mode, Match, Into, ) -#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_6(Getter, Name, Mode, Match, Into, From) \ -{ \ - ajson.try_emplace(Name, Into(aval.Getter()) ); \ -} \ -else { \ - json_traits_helper::set_optional_json_member(Name, Into(aval.Getter()), ajson); \ -} - -#define JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_type_traits \ - { \ - using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ - using allocator_type = typename Json::allocator_type; \ - using char_type = typename Json::char_type; \ - using string_view_type = typename Json::string_view_type; \ - constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ - constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ - constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_IS,,,, __VA_ARGS__)\ - return true; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # ValueType)); \ - return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_AS,,,, __VA_ARGS__) ); \ - } \ - static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ - { \ - Json ajson(json_object_arg, semantic_tag::none, alloc); \ - JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_TO_JSON,,,, __VA_ARGS__) \ - return ajson; \ - } \ - }; \ -} \ - /**/ - -#define JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(ValueType, ...) \ - JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_ALL_CTOR_GETTER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \ - JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_N_CTOR_GETTER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \ - JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_N_CTOR_GETTER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ -JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_ENUM_PAIR(Prefix, P2, P3, Member, Count) JSONCONS_ENUM_PAIR_LAST(Prefix, P2, P3, Member, Count), -#define JSONCONS_ENUM_PAIR_LAST(Prefix, P2, P3, Member, Count) {value_type::Member, json_traits_macro_names::Member##_str(char_type{})} - -#define JSONCONS_ENUM_TRAITS_BASE(EnumType, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_traits_macro_names \ - { \ - JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ - }; \ - template \ - struct json_type_traits \ - { \ - static_assert(std::is_enum::value, # EnumType " must be an enum"); \ - using value_type = EnumType; \ - using char_type = typename Json::char_type; \ - using string_type = std::basic_string; \ - using string_view_type = jsoncons::basic_string_view; \ - using allocator_type = typename Json::allocator_type; \ - using mapped_type = std::pair; \ - \ - static std::pair get_values() \ - { \ - static const mapped_type v[] = { \ - JSONCONS_VARIADIC_REP_N(JSONCONS_ENUM_PAIR, ,,, __VA_ARGS__)\ - };\ - return std::make_pair(v,v+JSONCONS_NARGS(__VA_ARGS__)); \ - } \ - \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_string()) return false; \ - auto first = get_values().first; \ - auto last = get_values().second; \ - const string_view_type s = ajson.template as(); \ - if (s.empty() && std::find_if(first, last, \ - [](const mapped_type& item) -> bool \ - { return item.first == value_type(); }) == last) \ - { \ - return true; \ - } \ - auto it = std::find_if(first, last, \ - [&](const mapped_type& item) -> bool \ - { return item.second == s; }); \ - return it != last; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # EnumType)); \ - const string_view_type s = ajson.template as(); \ - auto first = get_values().first; \ - auto last = get_values().second; \ - if (s.empty() && std::find_if(first, last, \ - [](const mapped_type& item) -> bool \ - { return item.first == value_type(); }) == last) \ - { \ - return value_type(); \ - } \ - auto it = std::find_if(first, last, \ - [&](const mapped_type& item) -> bool \ - { return item.second == s; }); \ - if (it == last) \ - { \ - if (s.empty()) \ - { \ - return value_type(); \ - } \ - else \ - { \ - JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not an enum")); \ - } \ - } \ - return it->first; \ - } \ - static Json to_json(value_type aval, allocator_type alloc=allocator_type()) \ - { \ - static constexpr char_type empty_string[] = {0}; \ - auto first = get_values().first; \ - auto last = get_values().second; \ - auto it = std::find_if(first, last, \ - [aval](const mapped_type& item) -> bool \ - { return item.first == aval; }); \ - if (it == last) \ - { \ - if (aval == value_type()) \ - { \ - return Json(empty_string); \ - } \ - else \ - { \ - JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not an enum")); \ - } \ - } \ - return Json(it->second,alloc); \ - } \ - }; \ -} \ - /**/ - -#define JSONCONS_ENUM_TRAITS(EnumType, ...) \ - JSONCONS_ENUM_TRAITS_BASE(EnumType,__VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_NAME_ENUM_PAIR(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_NAME_ENUM_PAIR_ Seq), -#define JSONCONS_NAME_ENUM_PAIR_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_NAME_ENUM_PAIR_ Seq) -#define JSONCONS_NAME_ENUM_PAIR_(Member, Name) {value_type::Member, Name} - -#define JSONCONS_ENUM_NAME_TRAITS(EnumType, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_type_traits \ - { \ - static_assert(std::is_enum::value, # EnumType " must be an enum"); \ - using value_type = EnumType; \ - using char_type = typename Json::char_type; \ - using string_type = std::basic_string; \ - using string_view_type = jsoncons::basic_string_view; \ - using allocator_type = typename Json::allocator_type; \ - using mapped_type = std::pair; \ - \ - static std::pair get_values() \ - { \ - static const mapped_type v[] = { \ - JSONCONS_VARIADIC_REP_N(JSONCONS_NAME_ENUM_PAIR,,,, __VA_ARGS__)\ - };\ - return std::make_pair(v,v+JSONCONS_NARGS(__VA_ARGS__)); \ - } \ - \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_string()) return false; \ - auto first = get_values().first; \ - auto last = get_values().second; \ - const string_view_type s = ajson.template as(); \ - if (s.empty() && std::find_if(first, last, \ - [](const mapped_type& item) -> bool \ - { return item.first == value_type(); }) == last) \ - { \ - return true; \ - } \ - auto it = std::find_if(first, last, \ - [&](const mapped_type& item) -> bool \ - { return item.second == s; }); \ - return it != last; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # EnumType)); \ - const string_view_type s = ajson.template as(); \ - auto first = get_values().first; \ - auto last = get_values().second; \ - if (s.empty() && std::find_if(first, last, \ - [](const mapped_type& item) -> bool \ - { return item.first == value_type(); }) == last) \ - { \ - return value_type(); \ - } \ - auto it = std::find_if(first, last, \ - [&](const mapped_type& item) -> bool \ - { return item.second == s; }); \ - if (it == last) \ - { \ - if (s.empty()) \ - { \ - return value_type(); \ - } \ - else \ - { \ - JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not an enum")); \ - } \ - } \ - return it->first; \ - } \ - static Json to_json(value_type aval, allocator_type alloc=allocator_type()) \ - { \ - static constexpr char_type empty_string[] = {0}; \ - auto first = get_values().first; \ - auto last = get_values().second; \ - auto it = std::find_if(first, last, \ - [aval](const mapped_type& item) -> bool \ - { return item.first == aval; }); \ - if (it == last) \ - { \ - if (aval == value_type()) \ - { \ - return Json(empty_string); \ - } \ - else \ - { \ - JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not an enum")); \ - } \ - } \ - return Json(it->second,alloc); \ - } \ - }; \ - template <> struct is_json_type_traits_declared : public std::true_type {}; \ -} \ - /**/ - -#define JSONCONS_GETTER_SETTER_AS(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_GETTER_SETTER_AS_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names::Property##_str(char_type{}))) {aval.Setter(ajson.at(json_traits_macro_names::Property##_str(char_type{})).template as::type>());} - -#define JSONCONS_ALL_GETTER_SETTER_AS(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_ALL_GETTER_SETTER_AS_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) aval.Setter(ajson.at(json_traits_macro_names::Property##_str(char_type{})).template as::type>()); - -#define JSONCONS_GETTER_SETTER_TO_JSON(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_GETTER_SETTER_TO_JSON_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) \ -if ((num_params-Count) < num_mandatory_params2) \ - {ajson.try_emplace(json_traits_macro_names::Property##_str(char_type{}), aval.Getter());} \ -else \ - {json_traits_helper::set_optional_json_member(json_traits_macro_names::Property##_str(char_type{}), aval.Getter(), ajson);} - -#define JSONCONS_ALL_GETTER_SETTER_TO_JSON(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_ALL_GETTER_SETTER_TO_JSON_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) ajson.try_emplace(json_traits_macro_names::Property##_str(char_type{}), aval.Getter() ); - -#define JSONCONS_GETTER_SETTER_TRAITS_BASE(AsT,ToJ,NumTemplateParams, ValueType,GetPrefix,SetPrefix,NumMandatoryParams1,NumMandatoryParams2, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_traits_macro_names \ - { \ - JSONCONS_VARIADIC_REP_N(JSONCONS_GENERATE_NAME_STR, ,,, __VA_ARGS__)\ - }; \ - template \ - struct json_type_traits \ - { \ - using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ - using allocator_type = typename Json::allocator_type; \ - using char_type = typename Json::char_type; \ - using string_view_type = typename Json::string_view_type; \ - constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ - constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ - constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_N_MEMBER_IS, ,GetPrefix,SetPrefix, __VA_ARGS__)\ - return true; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # ValueType)); \ - value_type aval{}; \ - JSONCONS_VARIADIC_REP_N(AsT, ,GetPrefix,SetPrefix, __VA_ARGS__) \ - return aval; \ - } \ - static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ - { \ - Json ajson(json_object_arg, semantic_tag::none, alloc); \ - JSONCONS_VARIADIC_REP_N(ToJ, ,GetPrefix,SetPrefix, __VA_ARGS__) \ - return ajson; \ - } \ - }; \ -} \ - /**/ - -#define JSONCONS_N_GETTER_SETTER_TRAITS(ValueType,GetPrefix,SetPrefix,NumMandatoryParams, ...) \ - JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_GETTER_SETTER_AS, JSONCONS_GETTER_SETTER_TO_JSON,0, ValueType,GetPrefix,SetPrefix,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_N_GETTER_SETTER_TRAITS(NumTemplateParams, ValueType,GetPrefix,SetPrefix,NumMandatoryParams, ...) \ - JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_GETTER_SETTER_AS, JSONCONS_GETTER_SETTER_TO_JSON,NumTemplateParams, ValueType,GetPrefix,SetPrefix,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_ALL_GETTER_SETTER_TRAITS(ValueType,GetPrefix,SetPrefix, ...) \ - JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_AS, JSONCONS_ALL_GETTER_SETTER_TO_JSON,0,ValueType,GetPrefix,SetPrefix, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_ALL_GETTER_SETTER_TRAITS(NumTemplateParams, ValueType,GetPrefix,SetPrefix, ...) \ - JSONCONS_GETTER_SETTER_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_AS, JSONCONS_ALL_GETTER_SETTER_TO_JSON,NumTemplateParams,ValueType,GetPrefix,SetPrefix, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__),__VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_GETTER_SETTER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_GETTER_SETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_GETTER_SETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_GETTER_SETTER_NAME_IS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_GETTER_SETTER_NAME_IS_3(Getter, Setter, Name) !ajson.contains(Name)) return false; -#define JSONCONS_GETTER_SETTER_NAME_IS_5(Getter, Setter, Name, Mode, Match) JSONCONS_GETTER_SETTER_NAME_IS_7(Getter, Setter, Name, Mode, Match,, ) -#define JSONCONS_GETTER_SETTER_NAME_IS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_GETTER_SETTER_NAME_IS_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_GETTER_SETTER_NAME_IS_7(Getter, Setter, Name, Mode, Match, Into, From) !ajson.contains(Name)) return false; \ - JSONCONS_TRY{if (!Match(ajson.at(Name).template asGetter()))>::type>())) return false;} \ - JSONCONS_CATCH(...) {return false;} - -#define JSONCONS_N_GETTER_SETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_N_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_GETTER_SETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) if (ajson.contains(Name)) aval.Setter(ajson.at(Name).template as::type>()); -#define JSONCONS_N_GETTER_SETTER_NAME_AS_4(Getter, Setter, Name, Mode) Mode(JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name)) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_5(Getter, Setter, Name, Mode, Match) JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, , ) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(if (ajson.contains(Name)) aval.Setter(From(ajson.at(Name).template as::type>()));) - -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) ajson.try_emplace(Name, aval.Getter() ); -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_5(Getter, Setter, Name, Mode, Match) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, , ) -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(aval.Getter()) ); - -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_ALL_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_GETTER_SETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) aval.Setter(ajson.at(Name).template as::type>()); -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_4(Getter, Setter, Name, Mode) Mode(JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name)) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_5(Getter, Setter, Name, Mode, Match) JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, , ) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(aval.Setter(From(ajson.at(Name).template as::type>()));) - -#define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) -#define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) \ - ajson.try_emplace(Name, aval.Getter()); \ -else \ - {json_traits_helper::set_optional_json_member(Name, aval.Getter(), ajson);} -#define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_5(Getter, Setter, Name, Mode, Match) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, , ) -#define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) \ - ajson.try_emplace(Name, Into(aval.Getter())); \ -else \ - {json_traits_helper::set_optional_json_member(Name, Into(aval.Getter()), ajson);} - -#define JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(AsT,ToJ, NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \ -namespace jsoncons \ -{ \ - template \ - struct json_type_traits \ - { \ - using value_type = ValueType JSONCONS_GENERATE_TPL_ARGS(JSONCONS_GENERATE_TPL_ARG, NumTemplateParams); \ - using allocator_type = typename Json::allocator_type; \ - using char_type = typename Json::char_type; \ - using string_view_type = typename Json::string_view_type; \ - constexpr static size_t num_params = JSONCONS_NARGS(__VA_ARGS__); \ - constexpr static size_t num_mandatory_params1 = NumMandatoryParams1; \ - constexpr static size_t num_mandatory_params2 = NumMandatoryParams2; \ - static bool is(const Json& ajson) noexcept \ - { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_SETTER_NAME_IS,,,, __VA_ARGS__)\ - return true; \ - } \ - static value_type as(const Json& ajson) \ - { \ - if (!is(ajson)) JSONCONS_THROW(convert_error(convert_errc::conversion_failed, "Not a " # ValueType)); \ - value_type aval{}; \ - JSONCONS_VARIADIC_REP_N(AsT,,,, __VA_ARGS__) \ - return aval; \ - } \ - static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \ - { \ - Json ajson(json_object_arg, semantic_tag::none, alloc); \ - JSONCONS_VARIADIC_REP_N(ToJ,,,, __VA_ARGS__) \ - return ajson; \ - } \ - }; \ -} \ - /**/ - -#define JSONCONS_N_GETTER_SETTER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \ - JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_N_GETTER_SETTER_NAME_AS,JSONCONS_N_GETTER_SETTER_NAME_TO_JSON, 0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_N_GETTER_SETTER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \ - JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_N_GETTER_SETTER_NAME_AS,JSONCONS_N_GETTER_SETTER_NAME_TO_JSON, NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_ALL_GETTER_SETTER_NAME_TRAITS(ValueType, ...) \ - JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_NAME_AS,JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON, 0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_TPL_ALL_GETTER_SETTER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \ - JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_ALL_GETTER_SETTER_NAME_AS,JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON, NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \ - namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \ - /**/ - -#define JSONCONS_POLYMORPHIC_IS(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return true; -#define JSONCONS_POLYMORPHIC_IS_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return true; - -#define JSONCONS_POLYMORPHIC_AS(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return std::make_shared(ajson.template as()); -#define JSONCONS_POLYMORPHIC_AS_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return std::make_shared(ajson.template as()); - -#define JSONCONS_POLYMORPHIC_AS_UNIQUE_PTR(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return jsoncons::make_unique(ajson.template as()); -#define JSONCONS_POLYMORPHIC_AS_UNIQUE_PTR_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return jsoncons::make_unique(ajson.template as()); - -#define JSONCONS_POLYMORPHIC_AS_SHARED_PTR(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return std::make_shared(ajson.template as()); -#define JSONCONS_POLYMORPHIC_AS_SHARED_PTR_LAST(BaseClass, P2, P3, DerivedClass, Count) if (ajson.template is()) return std::make_shared(ajson.template as()); - -#define JSONCONS_POLYMORPHIC_TO_JSON(BaseClass, P2, P3, DerivedClass, Count) if (DerivedClass* p = dynamic_cast(ptr.get())) {return Json(*p);} -#define JSONCONS_POLYMORPHIC_TO_JSON_LAST(BaseClass, P2, P3, DerivedClass, Count) if (DerivedClass* p = dynamic_cast(ptr.get())) {return Json(*p);} - -#define JSONCONS_POLYMORPHIC_TRAITS(BaseClass, ...) \ -namespace jsoncons { \ - template \ - struct json_type_traits> { \ - static bool is(const Json& ajson) noexcept { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_IS, BaseClass,,, __VA_ARGS__)\ - return false; \ - } \ -\ - static std::shared_ptr as(const Json& ajson) { \ - if (!ajson.is_object()) return std::shared_ptr(); \ - JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_AS_SHARED_PTR, BaseClass,,, __VA_ARGS__)\ - return std::shared_ptr(); \ - } \ -\ - static Json to_json(const std::shared_ptr& ptr) { \ - if (ptr.get() == nullptr) {return Json::null();} \ - JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_TO_JSON, BaseClass,,, __VA_ARGS__)\ - return Json::null(); \ - } \ - }; \ - template \ - struct json_type_traits> { \ - static bool is(const Json& ajson) noexcept { \ - if (!ajson.is_object()) return false; \ - JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_IS, BaseClass,,, __VA_ARGS__)\ - return false; \ - } \ - static std::unique_ptr as(const Json& ajson) { \ - if (!ajson.is_object()) return std::unique_ptr(); \ - JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_AS_UNIQUE_PTR, BaseClass,,, __VA_ARGS__)\ - return std::unique_ptr(); \ - } \ - static Json to_json(const std::unique_ptr& ptr) { \ - if (ptr.get() == nullptr) {return Json::null();} \ - JSONCONS_VARIADIC_REP_N(JSONCONS_POLYMORPHIC_TO_JSON, BaseClass,,, __VA_ARGS__)\ - return Json::null(); \ - } \ - }; \ -} \ - /**/ - -#endif diff --git a/tests/CMakeLists.txt.orig b/tests/CMakeLists.txt.orig deleted file mode 100644 index 7707314b68..0000000000 --- a/tests/CMakeLists.txt.orig +++ /dev/null @@ -1,200 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2) - -if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - project(jsoncons-test) - - find_package(jsoncons REQUIRED CONFIG) - set(JSONCONS_INCLUDE_DIR ${jsoncons_INCLUDE_DIRS}) -endif () - -if(NOT CMAKE_BUILD_TYPE) -message(STATUS "Forcing tests build type to Release") -set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) -endif() - -include(CheckCXXCompilerFlag) - -string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE) - -################ -# ARM SETTINGS # -################ - -OPTION(CROSS_COMPILE_ARM "cross compile for ARM targets" OFF) -OPTION(JSONCONS_SANITIZE "sanitize" OFF) -option(JSONCONS_VALGRIND "Execute tests with valgrind" OFF) - -if(JSONCONS_VALGRIND) - find_program(CMAKE_MEMORYCHECK_COMMAND valgrind) - message(STATUS "Executing test suite with Valgrind (${CMAKE_MEMORYCHECK_COMMAND})") - set(memcheck_command "${CMAKE_MEMORYCHECK_COMMAND} ${CMAKE_MEMORYCHECK_COMMAND_OPTIONS} --error-exitcode=1 --leak-check=full") - separate_arguments(memcheck_command) -endif() - -include (CTest) - -# Note: to compile on ARM (or cross compile), you may need to add the following: -# -DTARGET_ARCH="armv8-a -mfpu=neon -mfloat-abi=softfp -target arm-linux-gnueabi" -set(TARGET_ARCH "native" CACHE STRING "Target architecture arguments") -set(ARM_ARCH_DIRECTORY "arm-linux-gnueabi" CACHE STRING "ARM arch header dir") -set(ARM_GCC_VER "4.7.3" CACHE STRING "ARM GCC header dir") - -# load per-platform configuration -include (${JSONCONS_PROJECT_DIR}/build_files/cmake/${CMAKE_SYSTEM_NAME}.cmake) - -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") - if (CROSS_COMPILE_ARM) - # We're cross-compiling with clang++ on Travis, this is all pretty specific and just for testing - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) - set(CMAKE_THREAD_LIBS_INIT) - - include_directories(/usr/${ARM_ARCH_DIRECTORY}/include/c++/${ARM_GCC_VER}/${ARM_ARCH_DIRECTORY}/) - include_directories(/usr/${ARM_ARCH_DIRECTORY}/include/c++/${ARM_GCC_VER}/) - include_directories(/usr/${ARM_ARCH_DIRECTORY}/include/) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${TARGET_ARCH} -Wunused-parameter -Wextra -Wreorder -std=c++11") - endif() -endif() -if (JSONCONS_SANITIZE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer") -endif() - -if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /bigobj") - set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO) -endif() - -set(CTEST_OUTPUT_ON_FAILURE ON) - -set(JSONCONS_TESTS_DIR ${JSONCONS_PROJECT_DIR}/tests) -set(JSONCONS_INCLUDE_DIR ${JSONCONS_PROJECT_DIR}/include) -set(JSONCONS_THIRD_PARTY_INCLUDE_DIR ${JSONCONS_PROJECT_DIR}/third_party) - -set(CATCH_INCLUDE_DIR ${JSONCONS_THIRD_PARTY_INCLUDE_DIR}/catch) -add_library(Catch INTERFACE) -target_include_directories (Catch INTERFACE ${CATCH_INCLUDE_DIR}) - -#file(GLOB_RECURSE JSONCONS_TESTS_SOURCES ${JSONCONS_TESTS_DIR}/*.cpp) -#message((${JSONCONS_TESTS_SOURCES})) - -set(JSONCONS_TESTS_SOURCES - ${JSONCONS_TESTS_DIR}/src/jsoncons_tests.cpp - ${JSONCONS_TESTS_DIR}/src/JSONTestSuite_tests.cpp - ${JSONCONS_TESTS_DIR}/src/bigint_tests.cpp - ${JSONCONS_TESTS_DIR}/bson/src/bson_cursor_tests.cpp - ${JSONCONS_TESTS_DIR}/bson/src/bson_encoder_tests.cpp - ${JSONCONS_TESTS_DIR}/bson/src/bson_reader_tests.cpp - ${JSONCONS_TESTS_DIR}/bson/src/bson_test_suite.cpp - ${JSONCONS_TESTS_DIR}/bson/src/encode_decode_bson_tests.cpp - ${JSONCONS_TESTS_DIR}/src/byte_string_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_bitset_traits_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_cursor_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_encoder_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_json_visitor2_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_reader_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/cbor_typed_array_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/decode_cbor_tests.cpp - ${JSONCONS_TESTS_DIR}/cbor/src/encode_cbor_tests.cpp - ${JSONCONS_TESTS_DIR}/src/converter_tests.cpp - ${JSONCONS_TESTS_DIR}/csv/src/csv_cursor_tests.cpp - ${JSONCONS_TESTS_DIR}/csv/src/csv_subfield_tests.cpp - ${JSONCONS_TESTS_DIR}/csv/src/csv_tests.cpp - ${JSONCONS_TESTS_DIR}/csv/src/encode_decode_csv_tests.cpp - ${JSONCONS_TESTS_DIR}/src/decode_traits_tests.cpp - ${JSONCONS_TESTS_DIR}/src/detail/optional_tests.cpp - ${JSONCONS_TESTS_DIR}/src/detail/span_tests.cpp - ${JSONCONS_TESTS_DIR}/src/detail/string_view_tests.cpp - ${JSONCONS_TESTS_DIR}/src/detail/string_wrapper_tests.cpp - ${JSONCONS_TESTS_DIR}/src/detail/to_integer_tests.cpp - ${JSONCONS_TESTS_DIR}/src/double_round_trip_tests.cpp - ${JSONCONS_TESTS_DIR}/src/double_to_string_tests.cpp - ${JSONCONS_TESTS_DIR}/src/dtoa_tests.cpp - ${JSONCONS_TESTS_DIR}/src/encode_decode_json_tests.cpp - ${JSONCONS_TESTS_DIR}/src/error_recovery_tests.cpp - ${JSONCONS_TESTS_DIR}/fuzz_regression/src/fuzz_regression_tests.cpp - ${JSONCONS_TESTS_DIR}/jmespath/src/jmespath_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_array_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_as_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_bitset_traits_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_checker_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_comparator_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_const_pointer_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_constructor_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_cursor_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_encoder_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_exception_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_filter_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_in_place_update_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_integer_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_less_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_line_split_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_literal_operator_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_object_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_options_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_parse_error_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_parser_position_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_parser_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_proxy_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_push_back_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_reader_exception_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_reader_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_storage_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_swap_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_traits_macro_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_traits_name_macro_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_traits_macro_functional_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_type_traits_container_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_type_traits_chrono_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_type_traits_chrono_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_type_traits_tests.cpp - ${JSONCONS_TESTS_DIR}/src/json_validation_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpatch/src/jsonpatch_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/JSONPathTestSuite_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/jsonpath_error_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/jsonpath_flatten_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/jsonpath_function_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/jsonpath_normalized_path_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/jsonpath_test_suite.cpp - ${JSONCONS_TESTS_DIR}/jsonpath/src/jsonpath_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpointer/src/jsonpointer_flatten_tests.cpp - ${JSONCONS_TESTS_DIR}/jsonpointer/src/jsonpointer_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/decode_msgpack_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/encode_msgpack_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/msgpack_bitset_traits_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/msgpack_cursor_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/msgpack_encoder_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/msgpack_tests.cpp - ${JSONCONS_TESTS_DIR}/msgpack/src/msgpack_timestamp_tests.cpp - ${JSONCONS_TESTS_DIR}/src/ojson_tests.cpp - ${JSONCONS_TESTS_DIR}/src/order_preserving_json_object_tests.cpp - ${JSONCONS_TESTS_DIR}/src/parse_string_tests.cpp - ${JSONCONS_TESTS_DIR}/src/encode_traits_tests.cpp - ${JSONCONS_TESTS_DIR}/src/short_string_tests.cpp - ${JSONCONS_TESTS_DIR}/src/staj_iterator_tests.cpp - ${JSONCONS_TESTS_DIR}/src/stateful_allocator_tests.cpp - ${JSONCONS_TESTS_DIR}/src/string_to_double_tests.cpp - ${JSONCONS_TESTS_DIR}/src/tests_main.cpp - ${JSONCONS_TESTS_DIR}/ubjson/src/decode_ubjson_tests.cpp - ${JSONCONS_TESTS_DIR}/ubjson/src/encode_ubjson_tests.cpp - ${JSONCONS_TESTS_DIR}/ubjson/src/ubjson_cursor_tests.cpp - ${JSONCONS_TESTS_DIR}/ubjson/src/ubjson_encoder_tests.cpp - ${JSONCONS_TESTS_DIR}/src/unicode_tests.cpp - ${JSONCONS_TESTS_DIR}/src/wjson_tests.cpp -) -set(JSONCONS_TARGET test_jsoncons) -add_executable(${JSONCONS_TARGET} EXCLUDE_FROM_ALL ${JSONCONS_TESTS_SOURCES} ${JSONCONS_HEADERS}) - -add_test(example_test ${JSONCONS_TARGET}) - -target_include_directories (${JSONCONS_TARGET} PUBLIC ${JSONCONS_INCLUDE_DIR} PUBLIC ${JSONCONS_TESTS_DIR} - PUBLIC ${JSONCONS_THIRD_PARTY_INCLUDE_DIR}) - -target_link_libraries(${JSONCONS_TARGET} Catch) - -if (CROSS_COMPILE_ARM) - add_custom_target(jtest COMMAND qemu-arm -L /usr/arm-linux-gnueabi/ test_jsoncons DEPENDS ${JSONCONS_TARGET}) -else() - add_custom_target(jtest COMMAND test_jsoncons DEPENDS ${JSONCONS_TARGET}) -endif() -