Skip to content

Commit

Permalink
path_node w string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Nov 7, 2023
1 parent e88cff6 commit 510d6cd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
22 changes: 11 additions & 11 deletions include/jsoncons_ext/jsonpath/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ namespace detail {
using value_type = Json;
using reference = JsonReference;
using value_pointer = typename std::conditional<std::is_const<typename std::remove_reference<JsonReference>::type>::value,typename Json::const_pointer,typename Json::pointer>::type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using path_pointer = const path_node_type*;

Expand Down Expand Up @@ -2130,7 +2130,7 @@ namespace detail {
using value_type = Json;
using reference = JsonReference;
using value_pointer = typename std::conditional<std::is_const<typename std::remove_reference<JsonReference>::type>::value,typename Json::const_pointer,typename Json::pointer>::type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using path_pointer = const path_node_type*;
private:
Expand Down Expand Up @@ -2160,7 +2160,7 @@ namespace detail {
using char_type = typename Json::char_type;
using string_type = typename Json::string_type;
using reference = JsonReference;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;

virtual ~node_receiver() noexcept = default;

Expand All @@ -2176,7 +2176,7 @@ namespace detail {
using reference = JsonReference;
using char_type = typename Json::char_type;
using string_type = typename Json::string_type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using path_value_pair_type = path_value_pair<Json,JsonReference>;

Expand All @@ -2202,7 +2202,7 @@ namespace detail {
using reference = JsonReference;
using char_type = typename Json::char_type;
using string_type = typename Json::string_type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using path_stem_value_pair_type = path_component_value_pair<Json,JsonReference>;

std::vector<path_stem_value_pair_type> nodes;
Expand All @@ -2222,7 +2222,7 @@ namespace detail {
using string_type = typename Json::string_type;
using reference = JsonReference;
using pointer = typename std::conditional<std::is_const<typename std::remove_reference<reference>::type>::value,typename Json::const_pointer,typename Json::pointer>::type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using path_stem_value_pair_type = path_component_value_pair<Json,JsonReference>;

allocator_type alloc_;
Expand Down Expand Up @@ -2319,7 +2319,7 @@ namespace detail {
using reference = JsonReference;
using pointer = typename std::conditional<std::is_const<typename std::remove_reference<JsonReference>::type>::value,typename Json::const_pointer,typename Json::pointer>::type;
using path_value_pair_type = path_value_pair<Json,JsonReference>;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using node_receiver_type = node_receiver<Json,JsonReference>;
using selector_type = jsonpath_selector<Json,JsonReference>;
Expand Down Expand Up @@ -2623,7 +2623,7 @@ namespace detail {
using reference = JsonReference;
using pointer = typename std::conditional<std::is_const<typename std::remove_reference<JsonReference>::type>::value,typename Json::const_pointer,typename Json::pointer>::type;
using path_value_pair_type = path_value_pair<Json,JsonReference>;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;

virtual ~expression_base() noexcept = default;

Expand Down Expand Up @@ -3004,7 +3004,7 @@ namespace detail {
using reference = JsonReference;
using char_type = typename Json::char_type;
using string_type = typename Json::string_type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
private:
allocator_type alloc_;
Expand Down Expand Up @@ -3040,7 +3040,7 @@ namespace detail {
using token_type = token<Json,JsonReference>;
using reference_arg_type = typename std::conditional<std::is_const<typename std::remove_reference<JsonReference>::type>::value,
const_reference_arg_t,reference_arg_t>::type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using selector_type = jsonpath_selector<Json,JsonReference>;
private:
Expand Down Expand Up @@ -3238,7 +3238,7 @@ namespace detail {
using token_type = token<Json,reference>;
using reference_arg_type = typename std::conditional<std::is_const<typename std::remove_reference<reference>::type>::value,
const_reference_arg_t,reference_arg_t>::type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using stack_item_type = value_or_pointer<Json,JsonReference>;
private:
std::vector<token_type> token_list_;
Expand Down
11 changes: 6 additions & 5 deletions include/jsoncons_ext/jsonpath/json_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ namespace jsonpath {

enum class path_node_kind { root, index, name };

template <class Json>
template <class CharT>
class path_node
{
friend class json_location<Json>;
template<class Json> friend class json_location;
//friend class json_location<Json>;
public:
using string_view_type = typename Json::string_view_type;
using char_type = typename string_view_type::value_type;
using string_view_type = jsoncons::basic_string_view<CharT>;
using char_type = CharT;
private:

char_type root_;
Expand Down Expand Up @@ -311,7 +312,7 @@ namespace jsonpath {
public:
using allocator_type = typename Json::allocator_type;
using string_type = typename Json::string_type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
private:
allocator_type alloc_;
std::vector<const path_node_type*> nodes_;
Expand Down
6 changes: 3 additions & 3 deletions include/jsoncons_ext/jsonpath/jsonpath_expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace detail {
using path_expression_type = path_expression<Json,JsonReference>;
using expression_type = expression<Json,JsonReference>;
using json_location_type = json_location<Json>;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using selector_type = jsonpath_selector<Json,JsonReference>;

private:
Expand Down Expand Up @@ -2496,7 +2496,7 @@ namespace detail {
using pointer = typename std::conditional<std::is_const<typename std::remove_reference<reference>::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<value_type, reference>;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using path_expression_type = jsoncons::jsonpath::detail::path_expression<value_type,reference>;
using path_pointer = const path_node_type*;
Expand All @@ -2515,7 +2515,7 @@ namespace detail {
using pointer = typename std::conditional<std::is_const<typename std::remove_reference<reference>::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<value_type, reference>;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;
using json_location_type = json_location<Json>;
using path_expression_type = jsoncons::jsonpath::detail::path_expression<value_type,reference>;
using path_pointer = const path_node_type*;
Expand Down
4 changes: 2 additions & 2 deletions include/jsoncons_ext/jsonpath/jsonpath_selector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace detail {
using reference = JsonReference;
using char_type = typename Json::char_type;
using string_type = typename Json::string_type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;

Json* val;

Expand All @@ -135,7 +135,7 @@ namespace detail {
using char_type = typename Json::char_type;
using string_view_type = typename Json::string_view_type;
using string_type = typename Json::string_type;
using path_node_type = path_node<Json>;
using path_node_type = path_node<typename Json::char_type>;

static const path_node_type& generate(dynamic_resources<Json,JsonReference>& resources,
const path_node_type& last,
Expand Down
2 changes: 1 addition & 1 deletion test/jsonpath/src/json_location_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <catch/catch.hpp>
#include <iostream>

using path_node = jsoncons::jsonpath::path_node<jsoncons::json>;
using path_node = jsoncons::jsonpath::path_node<char>;
using json_location = jsoncons::jsonpath::json_location<jsoncons::json>;

TEST_CASE("test json_location equals")
Expand Down

0 comments on commit 510d6cd

Please sign in to comment.