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

This textbuffer implementation uses QChars for storing the data. More...

#include <chartextbuffer.h>

+ Inheritance diagram for edbee::CharTextBuffer:
+ Collaboration diagram for edbee::CharTextBuffer:

Public Member Functions

 CharTextBuffer (QObject *parent=0)
 The constructor of the textbuffer. More...
 
virtual int length () const
 Returns the length of the buffer. More...
 
virtual QChar charAt (int offset) const
 Returns the character at the given character. More...
 
virtual QString textPart (int offset, int length) const
 Returns the text part. More...
 
virtual void replaceText (int offset, int length, const QChar *buffer, int bufferLength)
 replaces the given text More...
 
virtual int lineCount ()
 this method should return an array with all line offsets. A line offset pointsto the START of a line So it does NOT point to a newline character, but it points to the first character AFTER the newline character More...
 
virtual int lineFromOffset (int offset)
 Returns the line position at the given offset. More...
 
virtual int offsetFromLine (int line)
 This method returns the offset of the given line. More...
 
virtual void rawAppendBegin ()
 Starts raw data appending to the buffer. More...
 
virtual void rawAppend (QChar c)
 Append a single character to the buffer in raw mode. More...
 
virtual void rawAppend (const QChar *data, int dataLength)
 Appends a buffer of text to the document. More...
 
virtual void rawAppendEnd ()
 Ends the 'raw' appending of data. More...
 
virtual QChar * rawDataPointer ()
 This method returns the raw data pointer WARNING calling this method moves the gap of the gapvector to the end. Which could involve a lot of data moving. More...
 
LineOffsetVectorlineOffsetList ()
 
- Public Member Functions inherited from edbee::TextBuffer
 TextBuffer (QObject *parent=0)
 The textbuffer constructor. More...
 
virtual void replaceText (int offset, int length, const QString &text)
 Replace the given text. More...
 
QString text ()
 Returns the full text as a QString. More...
 
void setText (const QString &text)
 A convenient method for directly filling the textbuffer with the given content. More...
 
virtual int columnFromOffsetAndLine (int offset, int line=-1)
 this method translates the given position to a column number. More...
 
virtual void appendText (const QString &text)
 Appends the given text to the textbuffer. More...
 
virtual int offsetFromLineAndColumn (int line, int col)
 This method returns the offset from the give line and column If the column exceed the number of column the caret is placed just before the newline. More...
 
virtual QString line (int line)
 Returns the line at the given line position. This line INCLUDES the newline character (if it's there) More...
 
virtual QString lineWithoutNewline (int line)
 Returns the line without the newline character. More...
 
virtual int lineLength (int line)
 Returns the length of the given line. Also counting the trailing newline character if present. More...
 
virtual int lineLengthWithoutNewline (int line)
 Returns the length of the given line. Without counting a trailing newline character. More...
 
virtual void replaceText (const TextRange &range, const QString &text)
 replace the texts More...
 
virtual int findCharPos (int offset, int direction, const QString &chars, bool equals)
 See documentation at findCharPosWithinRange. More...
 
virtual int findCharPosWithinRange (int offset, int direction, const QString &chars, bool equals, int beginRange, int endRange)
 This method finds the find the first character position that equals the given char. More...
 
virtual int findCharPosOrClamp (int offset, int direction, const QString &chars, bool equals)
 See documentation at findCharPosWithinRange. This method searches a char position within the given rang (from the given ofset) More...
 
virtual int findCharPosWithinRangeOrClamp (int offset, int direction, const QString &chars, bool equals, int beginRange, int endRange)
 See documentation at findCharPosWithinRange. This method searches a char position within the given rang (from the given ofset) More...
 
virtual QString lineOffsetsAsString ()
 

Protected Slots

void emitTextChanged (edbee::TextBufferChange *change)
 

Additional Inherited Members

- Signals inherited from edbee::TextBuffer
void textAboutToBeChanged (edbee::TextBufferChange change)
 
void textChanged (edbee::TextBufferChange change)
 

Detailed Description

This textbuffer implementation uses QChars for storing the data.

Constructor & Destructor Documentation

◆ CharTextBuffer()

edbee::CharTextBuffer::CharTextBuffer ( QObject *  parent = 0)

The constructor of the textbuffer.

Parameters
areference to the parent

Member Function Documentation

◆ charAt()

QChar edbee::CharTextBuffer::charAt ( int  offset) const
virtual

Returns the character at the given character.

Parameters
offsetthe offset of the given character
Returns
the character at the given offset

Implements edbee::TextBuffer.

◆ emitTextChanged

void edbee::CharTextBuffer::emitTextChanged ( edbee::TextBufferChange change)
protectedslot

◆ length()

int edbee::CharTextBuffer::length ( ) const
virtual

Returns the length of the buffer.

Returns
the length of the given text

Implements edbee::TextBuffer.

◆ lineCount()

virtual int edbee::CharTextBuffer::lineCount ( )
inlinevirtual

this method should return an array with all line offsets. A line offset pointsto the START of a line So it does NOT point to a newline character, but it points to the first character AFTER the newline character

Implements edbee::TextBuffer.

◆ lineFromOffset()

int edbee::CharTextBuffer::lineFromOffset ( int  offset)
virtual

Returns the line position at the given offset.

Parameters
offsetthe offset to retreive the line from
Returns
the line from the given offset

Implements edbee::TextBuffer.

◆ lineOffsetList()

LineOffsetVector& edbee::CharTextBuffer::lineOffsetList ( )
inline
Todo:
: Temporary debug method. REMOVE!!

◆ offsetFromLine()

int edbee::CharTextBuffer::offsetFromLine ( int  line)
virtual

This method returns the offset of the given line.

Parameters
linthe line to retrieve the offset from
Returns
the offset of the given line

Implements edbee::TextBuffer.

◆ rawAppend() [1/2]

void edbee::CharTextBuffer::rawAppend ( QChar  c)
virtual

Append a single character to the buffer in raw mode.

Parameters
cthe character to append

Implements edbee::TextBuffer.

◆ rawAppend() [2/2]

void edbee::CharTextBuffer::rawAppend ( const QChar *  data,
int  dataLength 
)
virtual

Appends a buffer of text to the document.

Parameters
datathe data to append
dataLengththe number of bytes availble by the data pointer

Implements edbee::TextBuffer.

◆ rawAppendBegin()

void edbee::CharTextBuffer::rawAppendBegin ( )
virtual

Starts raw data appending to the buffer.

Implements edbee::TextBuffer.

◆ rawAppendEnd()

void edbee::CharTextBuffer::rawAppendEnd ( )
virtual

Ends the 'raw' appending of data.

Implements edbee::TextBuffer.

◆ rawDataPointer()

QChar * edbee::CharTextBuffer::rawDataPointer ( )
virtual

This method returns the raw data pointer WARNING calling this method moves the gap of the gapvector to the end. Which could involve a lot of data moving.

Implements edbee::TextBuffer.

◆ replaceText()

void edbee::CharTextBuffer::replaceText ( int  offset,
int  length,
const QChar *  buffer,
int  bufferLength 
)
virtual

replaces the given text

Parameters
offsetthe offset of the text to replace
lengththe length of the text to replace
buffera pointer to a buffer with data
bufferLenththe length of the buffer

Implements edbee::TextBuffer.

◆ textPart()

QString edbee::CharTextBuffer::textPart ( int  pos,
int  length 
) const
virtual

Returns the text part.

Parameters
posthe position of the given text
lengththe length of the text to get
Returns
returns a part of the text

buf_.data()

Implements edbee::TextBuffer.


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