diff --git a/include/jsoncons/detail/span.hpp b/include/jsoncons/detail/span.hpp index be6c84a464..c5eb171744 100644 --- a/include/jsoncons/detail/span.hpp +++ b/include/jsoncons/detail/span.hpp @@ -31,7 +31,7 @@ namespace detail { public: using element_type = T; - using value_type = typename std::remove_volatile::type>::type; + using value_type = typename std::remove_const::type; using size_type = std::size_t; using difference_type = std::ptrdiff_t; using pointer = T*; diff --git a/include/jsoncons_ext/jsonpath/json_query.hpp b/include/jsoncons_ext/jsonpath/json_query.hpp index 5e940cc29d..d59216bbe2 100644 --- a/include/jsoncons_ext/jsonpath/json_query.hpp +++ b/include/jsoncons_ext/jsonpath/json_query.hpp @@ -62,7 +62,7 @@ namespace jsonpath { json_replace(Json& instance, const typename Json::string_view_type& path, T&& new_value, const custom_functions& funcs = custom_functions()) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -88,7 +88,7 @@ namespace jsonpath { Json& instance, const typename Json::string_view_type& path, T&& new_value, const custom_functions& funcs = custom_functions()) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -113,7 +113,7 @@ namespace jsonpath { json_replace(Json& instance, const typename Json::string_view_type& path , BinaryCallback callback, const custom_functions& funcs = custom_functions()) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -140,7 +140,7 @@ namespace jsonpath { Json& instance, const typename Json::string_view_type& path , BinaryCallback callback, const custom_functions& funcs = custom_functions()) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -166,7 +166,7 @@ namespace jsonpath { typename std::enable_if::value,void>::type json_replace(Json& instance, const typename Json::string_view_type& path , UnaryCallback callback) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; diff --git a/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp b/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp index bfc66bf008..14ff699edc 100644 --- a/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp +++ b/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp @@ -2484,12 +2484,13 @@ namespace detail { } // namespace detail template - struct jsonpath_traits + struct legacy_jsonpath_traits { using char_type = typename Json::char_type; using string_type = typename Json::string_type; using string_view_type = typename Json::string_view_type; - using value_type = typename std::remove_volatile::type>::type; + using element_type = Json; + using value_type = typename std::remove_cv::type; using reference = JsonReference; using const_reference = const value_type&; using pointer = typename std::conditional::type>::value, typename Json::const_pointer, typename Json::pointer>::type; @@ -2501,11 +2502,30 @@ namespace detail { using path_pointer = const path_node_type*; }; + template + struct jsonpath_traits + { + using char_type = typename Json::char_type; + using string_type = typename Json::string_type; + using string_view_type = typename Json::string_view_type; + using element_type = Json; + using value_type = typename std::remove_cv::type; + using reference = Json&; + using const_reference = const Json&; + using pointer = typename std::conditional::type>::value, typename Json::const_pointer, typename Json::pointer>::type; + using allocator_type = typename value_type::allocator_type; + using evaluator_type = typename jsoncons::jsonpath::detail::jsonpath_evaluator; + using path_node_type = path_node; + using json_location_type = json_location; + using path_expression_type = jsoncons::jsonpath::detail::path_expression; + using path_pointer = const path_node_type*; + }; + template > class jsonpath_expression { public: - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using allocator_type = typename jsonpath_traits_type::allocator_type; using evaluator_type = typename jsonpath_traits_type::evaluator_type; @@ -2587,7 +2607,7 @@ namespace detail { class update_expression { public: - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using allocator_type = typename jsonpath_traits_type::allocator_type; using evaluator_type = typename jsonpath_traits_type::evaluator_type; @@ -2690,7 +2710,7 @@ namespace detail { const typename Json::string_view_type& path, const custom_functions& functions = custom_functions()) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -2711,7 +2731,7 @@ namespace detail { const typename Json::string_view_type& path, const custom_functions& functions, std::error_code& ec) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::legacy_jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -2730,7 +2750,7 @@ namespace detail { auto make_update_expression(const typename Json::string_view_type& path, const jsoncons::jsonpath::custom_functions& funcs = jsoncons::jsonpath::custom_functions()) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference; @@ -2748,7 +2768,7 @@ namespace detail { const typename Json::string_view_type& path, const jsoncons::jsonpath::custom_functions& funcs, std::error_code& ec) { - using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; + using jsonpath_traits_type = jsoncons::jsonpath::jsonpath_traits; using value_type = typename jsonpath_traits_type::value_type; using reference = typename jsonpath_traits_type::reference;