10 #include <QSharedData> 11 #include <QExplicitlySharedDataPointer> 16 class TextBufferChange;
19 class LineOffsetVector;
53 int offset()
const {
return d_->offset_; }
54 int length()
const {
return d_->length_; }
55 const QChar*
newText()
const {
return d_->newText_; }
57 int line()
const {
return d_->line_; }
59 inline int newLineCount()
const {
return d_->newLineOffsets_.size(); }
64 QExplicitlySharedDataPointer<TextBufferChangeData> d_;
78 virtual int length()
const = 0;
81 virtual QChar charAt(
int offset )
const = 0;
84 virtual QString textPart(
int offset,
int length )
const = 0;
88 virtual void replaceText(
int offset,
int length,
const QChar* buffer,
int bufferLength ) = 0;
92 virtual int lineCount() = 0;
93 virtual int lineFromOffset(
int offset ) = 0;
94 virtual int offsetFromLine(
int line ) = 0;
99 virtual void rawAppendBegin() = 0;
102 virtual void rawAppend( QChar c ) = 0;
105 virtual void rawAppend(
const QChar* data,
int dataLength ) = 0;
112 virtual void rawAppendEnd() = 0;
117 virtual QChar* rawDataPointer() = 0;
123 virtual void replaceText(
int offset,
int length,
const QString& text );
126 void setText(
const QString& text );
127 virtual int columnFromOffsetAndLine(
int offset,
int line=-1 );
128 virtual void appendText(
const QString& text );
129 virtual int offsetFromLineAndColumn(
int line,
int col );
130 virtual QString line(
int line);
131 virtual QString lineWithoutNewline(
int line );
133 virtual int lineLength(
int line);
134 virtual int lineLengthWithoutNewline(
int line);
135 virtual void replaceText(
const TextRange& range,
const QString& text );
137 virtual int findCharPos(
int offset,
int direction,
const QString& chars,
bool equals );
138 virtual int findCharPosWithinRange(
int offset,
int direction,
const QString& chars,
bool equals,
int beginRange,
int endRange );
139 virtual int findCharPosOrClamp(
int offset,
int direction,
const QString& chars,
bool equals );
140 virtual int findCharPosWithinRangeOrClamp(
int offset,
int direction,
const QString& chars,
bool equals,
int beginRange,
int endRange );
142 virtual QString lineOffsetsAsString();
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition: textbuffer.h:45
const QChar * newText_
The reference to a new text.
Definition: textbuffer.h:31
TextBufferChangeData(TextBuffer *buffer, int off, int len, const QChar *text, int textlen)
Initializes the textbuffer change.
Definition: textbuffer.cpp:18
int line_
The line number were the change occured.
Definition: textbuffer.h:35
int line() const
Definition: textbuffer.h:57
This class implements the vector for storing the line numbers at certain offsets/ The class allows th...
Definition: lineoffsetvector.h:26
int offset_
The offset in the buffer.
Definition: textbuffer.h:29
int offset() const
Definition: textbuffer.h:53
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
const QChar * newText() const
Definition: textbuffer.h:55
const QVector< int > & newLineOffsets() const
Definition: textbuffer.h:60
Definition: textbuffer.h:22
int length() const
Definition: textbuffer.h:54
int lineCount() const
Definition: textbuffer.h:58
int length_
The number of chars to replaced.
Definition: textbuffer.h:30
This class represents the textbuffer of the editor.
Definition: textbuffer.h:68
int lineCount_
the number of lines that are involved.
Definition: textbuffer.h:36
int newTextLength_
The length of this text.
Definition: textbuffer.h:32
A single text region A region constists of an anchor and a caret: The anchor defines the 'start' of t...
Definition: textrange.h:29
int newLineCount() const
Definition: textbuffer.h:59
QVector< int > newLineOffsets_
A list of new line offset.
Definition: textbuffer.h:37
int newTextLength() const
Definition: textbuffer.h:56