8#include "interval_tree.hpp"
11using IntervalTree = lib_interval_tree::interval_tree<IntervalType, EntityHooks>;
17 operator uint64_t()
const {
22 return (
static_cast<uint64_t
>(
line) << 32) |
column;
38 auto it =
tree.insert({start, end});
39 it.node()->payload = entity;
57 std::optional<uint64_t> highestStart = std::nullopt;
58 std::shared_ptr<bpp::bpp_entity> innermostEntity;
59 tree.overlap_find_all({point, point}, [&](
auto const& it) {
62 if (!highestStart.has_value() || it->low() > highestStart) {
63 highestStart = it->low();
64 innermostEntity = it.node()->payload;
68 return innermostEntity;
74 std::shared_ptr<bpp::bpp_entity>
find(uint32_t line, uint32_t column) {
lib_interval_tree::interval_tree< IntervalType, EntityHooks > IntervalTree
Definition EntityMap.h:11
Definition EntityMap.h:29
IntervalTree tree
Definition EntityMap.h:31
void insert(FilePosition start, FilePosition end, const std::shared_ptr< bpp::bpp_entity > &entity)
Add an entity to the entity map.
Definition EntityMap.h:37
std::shared_ptr< bpp::bpp_entity > find(uint32_t line, uint32_t column)
Find the active code entity at a specific line and column.
Definition EntityMap.h:74
std::shared_ptr< bpp::bpp_entity > find(FilePosition point)
Definition EntityMap.h:42
Definition EntityMap.h:13
uint32_t line
Definition EntityMap.h:14
FilePosition(uint32_t line, uint32_t column)
Definition EntityMap.h:25
uint32_t column
Definition EntityMap.h:15