edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lineoffsetvector.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QVector>
9
10#include "gapvector.h"
11
12
13namespace edbee {
14
16
17
18
27public:
29// struct LineChange {
30// int line; ///< the first line that's going to be replaced
31// int lineCount; ///< the number of lines that are replaced
32// int newLineCount; ///< the number of lines added/removed
33// int offsetDelta; ///< the change in offset
34// QVector<int> newOffsets; ///< the new offsets
35// };
36
37
39
40 void applyChange( TextBufferChange change );
41
42 int at( int idx ) const;
43 int length() const;
44
45 int findLineFromOffset( int offset );
46
47 int offsetDelta() { return offsetDelta_; }
48 int offsetDeltaIndex() { return offsetDeltaIndex_; }
49
50 void appendOffset( int offset );
51
53 GapVector<int> offsetList() { return offsetList_; }
54
55protected:
56 int searchOffsetIgnoringOffsetDelta(int offset, int org_start, int org_end );
57
58 void moveDeltaToIndex( int index );
59 void changeOffsetDelta( int index, int delta );
60
61public:
62 QString toUnitTestString();
63 void initForUnitTesting( int offsetDelta, int offsetDeltaIndex, ... );
64
65
66private:
67
68 GapVector<int> offsetList_;
69 int offsetDelta_;
70 int offsetDeltaIndex_;
71
72
74
75
76};
77
78} // edbee
This class is used to define a gap vector. A Gapvector is split in 2 parts. where the gap is moved to...
Definition gapvector.h:19
int offsetDeltaIndex()
Definition lineoffsetvector.h:48
int at(int idx) const
this method returns the line offset at the given line offset
Definition lineoffsetvector.cpp:83
GapVector< int > offsetList()
Definition lineoffsetvector.h:53
int findLineFromOffset(int offset)
this method searches the line from the given offset
Definition lineoffsetvector.cpp:99
LineOffsetVector()
a structure to describe the line change that happend
Definition lineoffsetvector.cpp:13
friend class LineOffsetVectorTest
Definition lineoffsetvector.h:73
int offsetDelta()
Definition lineoffsetvector.h:47
int length() const
Definition lineoffsetvector.cpp:92
void applyChange(TextBufferChange change)
Definition lineoffsetvector.cpp:23
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition textbuffer.h:45
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20