From d0b60db4b281d30df90c22c4684efdcabd340368 Mon Sep 17 00:00:00 2001 From: Daniel Parker Date: Wed, 15 Nov 2023 16:24:59 -0500 Subject: [PATCH] expr.select_paths --- .../jsoncons_ext/jsonpath/json_location.hpp | 27 +++++++++++++++++++ include/jsoncons_ext/jsonpath/json_query.hpp | 1 + test/CMakeLists.txt | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/jsoncons_ext/jsonpath/json_location.hpp b/include/jsoncons_ext/jsonpath/json_location.hpp index 3838aec43..22b754c89 100644 --- a/include/jsoncons_ext/jsonpath/json_location.hpp +++ b/include/jsoncons_ext/jsonpath/json_location.hpp @@ -245,6 +245,33 @@ namespace jsonpath { } }; + + template + std::size_t delete(Json& instance, const basic_json_location& location) + { + std::size_t count = 0; + + Json* p_current = std::addressof(instance); + for (const auto& element : location) + { + switch (element.element_kind()) + { + case location_element_kind::name: + if (current.is_object()) + { + + } + break; + case location_element_kind::index: + break; + default: + break; + } + } + return count; + } + + using json_location = basic_json_location; using wjson_location = basic_json_location; using path_element = basic_path_element>; diff --git a/include/jsoncons_ext/jsonpath/json_query.hpp b/include/jsoncons_ext/jsonpath/json_query.hpp index b730917eb..029b448aa 100644 --- a/include/jsoncons_ext/jsonpath/json_query.hpp +++ b/include/jsoncons_ext/jsonpath/json_query.hpp @@ -9,6 +9,7 @@ #include #include +#include namespace jsoncons { namespace jsonpath { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d76552b08..1246b26a4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -93,7 +93,7 @@ add_executable(unit_tests jsonpath/src/jsonpath_json_query_tests.cpp jsonpath/src/jsonpath_make_expression_tests.cpp jsonpath/src/jsonpath_json_replace_tests.cpp - jsonpath/src/jsonpath_select_path_tests.cpp + jsonpath/src/jsonpath_select_paths_tests.cpp jsonpath/src/jsonpath_test_suite.cpp jsonpath/src/jsonpath_stateful_allocator_tests.cpp jsonpointer/src/jsonpointer_flatten_tests.cpp