|
ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
|
Sorted array for interval queries. More...
#include <SourceLocationIndex.h>
Public Member Functions | |
| IntervalTree (const IntervalTree &)=delete | |
| IntervalTree & | operator= (const IntervalTree &)=delete |
| void | insert (Interval interval) |
| Add interval to collection (not sorted yet). | |
| void | finalize () |
| Sort intervals by start position (call once after all inserts). | |
| std::vector< AstViewNode * > | query (unsigned line, unsigned column) const |
| Find all intervals containing a point. | |
| AstViewNode * | queryFirstContained (unsigned beginLine, unsigned beginColumn, unsigned endLine, unsigned endColumn) const |
| Find first interval fully contained within a range. | |
| std::size_t | size () const |
| Get total number of intervals. | |
Sorted array for interval queries.
Stores source ranges in a sorted vector for efficient point queries. Uses binary search for lookup.
Complexity:
Definition at line 63 of file SourceLocationIndex.h.
| void acav::IntervalTree::finalize | ( | ) |
Sort intervals by start position (call once after all inserts).
Definition at line 59 of file SourceLocationIndex.cpp.
| void acav::IntervalTree::insert | ( | Interval | interval | ) |
Add interval to collection (not sorted yet).
| interval | The source range and associated node |
Definition at line 55 of file SourceLocationIndex.cpp.
| std::vector< AstViewNode * > acav::IntervalTree::query | ( | unsigned | line, |
| unsigned | column ) const |
Find all intervals containing a point.
| line | Source line number (1-based) |
| column | Source column number (1-based) |
Definition at line 69 of file SourceLocationIndex.cpp.
| AstViewNode * acav::IntervalTree::queryFirstContained | ( | unsigned | beginLine, |
| unsigned | beginColumn, | ||
| unsigned | endLine, | ||
| unsigned | endColumn ) const |
Find first interval fully contained within a range.
| beginLine | Range start line (1-based) |
| beginColumn | Range start column (1-based) |
| endLine | Range end line (1-based) |
| endColumn | Range end column (1-based) |
Definition at line 98 of file SourceLocationIndex.cpp.
|
inline |
Get total number of intervals.
Definition at line 95 of file SourceLocationIndex.h.