clang
7.0.0
|
DeltaTree - a multiway search tree (BTree) structure with some fancy features. More...
#include "clang/Rewrite/Core/DeltaTree.h"
Public Member Functions | |
DeltaTree () | |
DeltaTree (const DeltaTree &RHS) | |
DeltaTree & | operator= (const DeltaTree &)=delete |
~DeltaTree () | |
int | getDeltaAt (unsigned FileIndex) const |
getDeltaAt - Return the accumulated delta at the specified file offset. More... | |
void | AddDelta (unsigned FileIndex, int Delta) |
AddDelta - When a change is made that shifts around the text buffer, this method is used to record that info. More... | |
DeltaTree - a multiway search tree (BTree) structure with some fancy features.
B-Trees are generally more memory and cache efficient than binary trees, because they store multiple keys/values in each node. This implements a key/value mapping from index to delta, and allows fast lookup on index. However, an added (important) bonus is that it can also efficiently tell us the full accumulated delta for a specific file offset as well, without traversing the whole tree.
Definition at line 26 of file DeltaTree.h.
DeltaTree::DeltaTree | ( | ) |
Definition at line 391 of file DeltaTree.cpp.
DeltaTree::DeltaTree | ( | const DeltaTree & | RHS | ) |
Definition at line 395 of file DeltaTree.cpp.
References getRoot().
DeltaTree::~DeltaTree | ( | ) |
Definition at line 402 of file DeltaTree.cpp.
References getRoot().
void DeltaTree::AddDelta | ( | unsigned | FileIndex, |
int | Delta | ||
) |
AddDelta - When a change is made that shifts around the text buffer, this method is used to record that info.
It inserts a delta of 'Delta' into the current DeltaTree at offset FileIndex.
Definition at line 456 of file DeltaTree.cpp.
References getRoot().
Referenced by clang::RewriteBuffer::InsertTextAfter().
int DeltaTree::getDeltaAt | ( | unsigned | FileIndex | ) | const |
getDeltaAt - Return the accumulated delta at the specified file offset.
This includes all insertions or delections that occurred before the specified file index.
Definition at line 409 of file DeltaTree.cpp.
References getRoot(), Node, and clang::Result.
Referenced by clang::RewriteBuffer::InsertTextAfter().