edbee - Qt Editor Library
Public Member Functions | Protected Member Functions | Friends | List of all members
edbee::LineOffsetVector Class Reference

This class implements the vector for storing the line numbers at certain offsets/ The class allows the 'gap' position to contain a delta offset. Which means that. More...

#include <lineoffsetvector.h>

+ Collaboration diagram for edbee::LineOffsetVector:

Public Member Functions

 LineOffsetVector ()
 a structure to describe the line change that happend More...
 
void applyChange (TextBufferChange change)
 
int at (int idx) const
 this method returns the line offset at the given line offset More...
 
int length () const
 
int findLineFromOffset (int offset)
 this method searches the line from the given offset More...
 
int offsetDelta ()
 
int offsetDeltaIndex ()
 
void appendOffset (int offset)
 This method appends an offset to the end of the list It simply applies the current offsetDelta because it will always be AFTER the current offsetDelta. More...
 
GapVector< int > offsetList ()
 
QString toUnitTestString ()
 This method returns the offset to string. More...
 
void initForUnitTesting (int offsetDelta, int offsetDeltaIndex,...)
 initializes the construct for unit testing More...
 

Protected Member Functions

int searchOffsetIgnoringOffsetDelta (int offset, int org_start, int org_end)
 This method returns the line from the start position. This method uses a binary search. Warning this method uses RAW values from the offsetList it does NOT take in account the offsetDelta. More...
 
void moveDeltaToIndex (int index)
 This method moves the delta to the given index. More...
 
void changeOffsetDelta (int index, int delta)
 This method moves the offset delta to the given location. More...
 

Friends

class LineOffsetVectorTest
 

Detailed Description

This class implements the vector for storing the line numbers at certain offsets/ The class allows the 'gap' position to contain a delta offset. Which means that.

all offsets after the gap are increased with the offsetDelta when searched. Inserting/deleting text this way usually only results in the changine of the offset delta. Which means speeeed

The line offset pointed at by each index is the first character in the given line.

Constructor & Destructor Documentation

◆ LineOffsetVector()

edbee::LineOffsetVector::LineOffsetVector ( )

a structure to describe the line change that happend

Member Function Documentation

◆ appendOffset()

void edbee::LineOffsetVector::appendOffset ( int  offset)

This method appends an offset to the end of the list It simply applies the current offsetDelta because it will always be AFTER the current offsetDelta.

◆ applyChange()

void edbee::LineOffsetVector::applyChange ( TextBufferChange  change)

◆ at()

int edbee::LineOffsetVector::at ( int  idx) const

this method returns the line offset at the given line offset

◆ changeOffsetDelta()

void edbee::LineOffsetVector::changeOffsetDelta ( int  index,
int  delta 
)
protected

This method moves the offset delta to the given location.

◆ findLineFromOffset()

int edbee::LineOffsetVector::findLineFromOffset ( int  offset)

this method searches the line from the given offset

◆ initForUnitTesting()

void edbee::LineOffsetVector::initForUnitTesting ( int  offsetDelta,
int  offsetDeltaIndex,
  ... 
)

initializes the construct for unit testing

Parameters
offsetDeltathe offsetDelta to use
offsetDeltaIndexthe offsetDeltaIndex to use
alist of integer offsets. Close the list with -1 !!!

◆ length()

int edbee::LineOffsetVector::length ( ) const

◆ moveDeltaToIndex()

void edbee::LineOffsetVector::moveDeltaToIndex ( int  index)
protected

This method moves the delta to the given index.

◆ offsetDelta()

int edbee::LineOffsetVector::offsetDelta ( )
inline

◆ offsetDeltaIndex()

int edbee::LineOffsetVector::offsetDeltaIndex ( )
inline

◆ offsetList()

GapVector<int> edbee::LineOffsetVector::offsetList ( )
inline
Todo:
: temporary method (remove)

◆ searchOffsetIgnoringOffsetDelta()

int edbee::LineOffsetVector::searchOffsetIgnoringOffsetDelta ( int  offset,
int  org_start,
int  org_end 
)
protected

This method returns the line from the start position. This method uses a binary search. Warning this method uses RAW values from the offsetList it does NOT take in account the offsetDelta.

◆ toUnitTestString()

QString edbee::LineOffsetVector::toUnitTestString ( )

This method returns the offset to string.

Friends And Related Function Documentation

◆ LineOffsetVectorTest

friend class LineOffsetVectorTest
friend

The documentation for this class was generated from the following files: