1#ifndef SOURCEMETA_CORE_JSONPOINTER_POSITION_H_
2#define SOURCEMETA_CORE_JSONPOINTER_POSITION_H_
4#ifndef SOURCEMETA_CORE_JSONPOINTER_EXPORT
5#include <sourcemeta/core/jsonpointer_export.h>
8#include <sourcemeta/core/json.h>
10#include <sourcemeta/core/jsonpointer_pointer.h>
16#include <unordered_map>
19namespace sourcemeta::core {
57 std::tuple<std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t>;
59 const std::uint64_t line,
const std::uint64_t column,
64 -> std::optional<Position>;
66 [[nodiscard]]
auto size() const -> std::
size_t;
81 std::optional<Position> position;
82 std::unordered_map<std::size_t, std::size_t> index_children;
83 std::unordered_map<std::string_view, std::size_t> property_children;
86 auto ensure_index() const ->
void;
92#pragma warning(disable : 4251)
94 std::vector<Event> events;
95 mutable bool indexed{
false};
96 mutable std::vector<TrieNode> trie;
98#pragma warning(default : 4251)
std::basic_string< Char, CharTraits, Allocator< Char > > String
The string type used by the JSON document.
Definition json_value.h:52
Type
The different types of a JSON instance.
Definition json_value.h:69
ParsePhase
The parsing phase of a JSON document.
Definition json_value.h:60
ParseContext
The context type for parse callbacks.
Definition json_value.h:92
auto size() const -> std::size_t
Get the number of tracked positions.
auto get(const Pointer &pointer) const -> std::optional< Position >
Get the position of the value at a given pointer.
auto to_json() const -> JSON
Serialise the tracked positions as a JSON document.
std::tuple< std::uint64_t, std::uint64_t, std::uint64_t, std::uint64_t > Position
The start and end line and column numbers of a value.
Definition jsonpointer_position.h:56
GenericPointer< JSON::String, PropertyHashJSON< JSON::String > > Pointer
The pointer type used to look up positions.
Definition jsonpointer_position.h:54