edbee - Qt Editor Library
chartextbuffer.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 #include "edbee/util/gapvector.h"
11 
12 namespace edbee {
13 
14 
16 class CharTextBuffer : public TextBuffer
17 {
18 public:
19  CharTextBuffer( QObject* parent=0);
20 
21  virtual int length() const;
22  virtual QChar charAt( int offset ) const;
23  virtual QString textPart( int offset, int length ) const;
24 
25  virtual void replaceText( int offset, int length, const QChar* buffer, int bufferLength );
26 
27  virtual int lineCount() { return lineOffsetList_.length(); }
28 
29  virtual int lineFromOffset( int offset );
30  virtual int offsetFromLine( int line );
31 
32  virtual void rawAppendBegin();
33  virtual void rawAppend( QChar c );
34  virtual void rawAppend( const QChar* data, int dataLength );
35  virtual void rawAppendEnd();
36 
37  virtual QChar* rawDataPointer();
38 
40  LineOffsetVector& lineOffsetList() { return lineOffsetList_; }
41 
42 protected slots:
43 
45 
46 private:
47  QCharGapVector buf_;
48  LineOffsetVector lineOffsetList_;
49 
50  int rawAppendStart_;
51  int rawAppendLineStart_;
52 
53 };
54 
55 } // edbee
virtual int length() const
Returns the length of the buffer.
Definition: chartextbuffer.cpp:28
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition: textbuffer.h:45
virtual int lineFromOffset(int offset)
Returns the line position at the given offset.
Definition: chartextbuffer.cpp:101
This textbuffer implementation uses QChars for storing the data.
Definition: chartextbuffer.h:16
LineOffsetVector & lineOffsetList()
Definition: chartextbuffer.h:40
virtual QChar * rawDataPointer()
This method returns the raw data pointer WARNING calling this method moves the gap of the gapvector t...
Definition: chartextbuffer.cpp:180
This class implements the vector for storing the line numbers at certain offsets/ The class allows th...
Definition: lineoffsetvector.h:26
virtual void replaceText(int offset, int length, const QChar *buffer, int bufferLength)
replaces the given text
Definition: chartextbuffer.cpp:66
virtual void rawAppend(QChar c)
Append a single character to the buffer in raw mode.
Definition: chartextbuffer.cpp:145
virtual int offsetFromLine(int line)
This method returns the offset of the given line.
Definition: chartextbuffer.cpp:112
virtual QChar charAt(int offset) const
Returns the character at the given character.
Definition: chartextbuffer.cpp:37
virtual void rawAppendBegin()
Starts raw data appending to the buffer.
Definition: chartextbuffer.cpp:125
virtual void rawAppendEnd()
Ends the 'raw' appending of data.
Definition: chartextbuffer.cpp:152
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
virtual QString textPart(int offset, int length) const
Returns the text part.
Definition: chartextbuffer.cpp:49
virtual int lineCount()
this method should return an array with all line offsets. A line offset pointsto the START of a line ...
Definition: chartextbuffer.h:27
This class represents the textbuffer of the editor.
Definition: textbuffer.h:68
int length() const
Definition: lineoffsetvector.cpp:94
virtual QString line(int line)
Returns the line at the given line position. This line INCLUDES the newline character (if it's there)...
Definition: textbuffer.cpp:161
The character vecor to use.
Definition: gapvector.h:411
CharTextBuffer(QObject *parent=0)
The constructor of the textbuffer.
Definition: chartextbuffer.cpp:18
void emitTextChanged(edbee::TextBufferChange *change)