Skip to content

Commit

Permalink
basic_path_node
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Nov 10, 2023
1 parent 967e5e0 commit ba836c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/jsoncons_ext/jsonpath/json_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,13 @@ namespace jsonpath {
private:
allocator_type alloc_;
std::vector<path_element_type> elements_;
const path_node_type* base_node_;
public:
using iterator = typename std::vector<path_element_type>::iterator;
using const_iterator = typename std::vector<path_element_type>::const_iterator;

basic_json_location(const path_node_type& node, const allocator_type& alloc = allocator_type())
: alloc_(alloc), elements_(node.size(), path_element_type{})
: alloc_(alloc), elements_(node.size(), path_element_type{}), base_node_(std::addressof(node))
{
std::size_t len = node.size();

Expand Down Expand Up @@ -297,6 +298,11 @@ namespace jsonpath {
return elements_.back();
}

const basic_path_node<char_type>& base_node() const
{
return base_node_;
}

string_type to_string() const
{
string_type buffer(alloc_);
Expand Down

0 comments on commit ba836c0

Please sign in to comment.