edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
edbee::CharTextDocument Class Reference

A plain textdocument. A document with simple character-buffer implementation. More...

#include <chartextdocument.h>

+ Inheritance diagram for edbee::CharTextDocument:
+ Collaboration diagram for edbee::CharTextDocument:

Public Member Functions

 CharTextDocument (QObject *object)
 The main contstructor of the chartext document.
 
 CharTextDocument (TextEditorConfig *config=new TextEditorConfig(), QObject *object=nullptr)
 
virtual ~CharTextDocument ()
 The default constructor.
 
virtual TextBufferbuffer () const
 This method should return the active textbuffer.
 
virtual TextDocumentScopesscopes ()
 Should return the document-scopes of this document.
 
virtual TextCodecencoding ()
 This method returns the current encoding.
 
virtual void setEncoding (TextCodec *codec)
 Sets the encoding.
 
virtual const edbee::LineEndinglineEnding ()
 This method should return the current line ending.
 
virtual void setLineEnding (const edbee::LineEnding *lineEnding)
 Set the used line ending.
 
virtual TextLexertextLexer ()
 Should return the current document lexer.
 
virtual TextGrammarlanguageGrammar ()
 This method should return the current language grammar.
 
virtual void setLanguageGrammar (TextGrammar *grammar)
 Sets the language grammar.
 
virtual TextAutoCompleteProviderListautoCompleteProviderList ()
 Returns the the autocomplete provider list.
 
virtual TextUndoStacktextUndoStack ()
 returns the text undo stack
 
virtual TextEditorConfigconfig () const
 This method returns the configuration.
 
virtual ChangegiveChangeWithoutFilter (Change *change, int coalesceId)
 Gives a change to the undo stack without invoking the filter.
 
- Public Member Functions inherited from edbee::TextDocument
 TextDocument (QObject *parent=0)
 Constructs the textdocument.
 
virtual ~TextDocument ()
 Destroys the textdocument.
 
virtual void setLineDataFieldsPerLine (int count)
 This method can be used to change the number of reserved fields by the document Increasing the amount will result in a realoc Decreasting the fieldcount reults in the lost of the 'old' fields At least the 'PredefinedFieldCount' amont of fields are required.
 
virtual TextLineDataManagerlineDataManager ()
 this method can be used to give a 'custom' line data item to a given line
 
virtual void giveLineDataManager (TextLineDataManager *manager)
 
virtual void giveLineData (int line, int field, TextLineData *dataItem)
 This method gives a given data item to a text line.
 
virtual TextLineDatagetLineData (int line, int field)
 Returns the line specific data at the given line.
 
virtual void beginUndoGroup (ChangeGroup *group=0)
 Starts an undo group.
 
virtual void endUndoGroup (int coalesceId, bool flatten=false)
 Ends the current undo group.
 
virtual void endUndoGroupAndDiscard ()
 Ends the undo group and discards all recorded information Warning it does NOT undo all made changes!!!
 
virtual bool isUndoCollectionEnabled ()
 this method return true if the undo stack is enabled
 
virtual void setUndoCollectionEnabled (bool enabled)
 Enables or disables the collection of undo commands.
 
virtual bool isUndoRunning ()
 This method should return true if the current change is the cause of an undo operation.
 
virtual bool isRedoRunning ()
 Checks if currently an undo operation is running.
 
virtual bool isUndoOrRedoRunning ()
 Is it an undo or redo (which means all commands area already available)
 
virtual bool isPersisted ()
 Checks if the document is in a persited state.
 
virtual void setPersisted (bool enabled=true)
 Calc this method to mark current state as persisted.
 
virtual void setDocumentFilter (TextDocumentFilter *filter)
 Sets the document filter without tranfering the ownership.
 
virtual void giveDocumentFilter (TextDocumentFilter *filter)
 this method sets the document filter You can give a 0 pointer to delte the old filter!
 
virtual TextDocumentFilterdocumentFilter ()
 This method returns the document filter.
 
void beginChanges (TextEditorController *controller)
 Start the changes.
 
void replaceRangeSet (TextRangeSet &rangeSet, const QString &text, bool stickySelection=false)
 Replaces the given rangeset.
 
void replaceRangeSet (TextRangeSet &rangeSet, const QStringList &texts, bool stickySelection=false)
 replaces the given rangeset
 
void giveSelection (TextEditorController *controller, TextRangeSet *rangeSet)
 sets the selectioin for the current rangeset The selection may never be empty
 
void endChanges (int coalesceId)
 
ChangeexecuteAndGiveChange (Change *change, int coalesceId)
 call this method to execute a change. The change is first passed to the filter so the documentFilter can handle the processing of the change When not filter is active the 'execute' method is called on the change
 
void append (const QString &text, int coalesceId=0)
 Appends the given text to the document.
 
void replace (int offset, int length, const QString &text, int coalesceId=0)
 Appends the given text.
 
void setText (const QString &text)
 Changes the compelte document text.
 
void rawAppendBegin ()
 begins the raw append modes. In raw append mode data is directly streamed to the textdocument-buffer. No undo-data is collected and no events are fired
 
void rawAppendEnd ()
 When then raw appending is done. The events are fired that the document has been changed The undo-collection is enabled again.
 
void rawAppend (QChar c)
 Appends a single char in raw append mode.
 
void rawAppend (const QChar *chars, int length)
 Appends an array of characters.
 
int length ()
 Returns the length of the document in characters default implementation is to forward this call to the textbuffer.
 
int lineCount ()
 Returns the number of lines.
 
QChar charAt (int idx)
 Returns the character at the given position.
 
QChar charAtOrNull (int idx)
 returns the char at the given index if the index is valid else the null character is returned
 
int offsetFromLine (int line)
 Retrieves the character-offset of the given line.
 
int lineFromOffset (int offset)
 returns the line number which contains the given offset
 
int columnFromOffsetAndLine (int offset, int line=-1)
 return the column position for the given offset and line
 
int offsetFromLineAndColumn (int line, int column)
 Returns the character offset of the given line and column.
 
int lineLength (int line)
 Returns the length of the given line.
 
int lineLengthWithoutNewline (int line)
 returns the length of the given lilne without the newline
 
QString text ()
 Returns the document text as a QString.
 
QString textPart (int offset, int length)
 Returns the given part of the text.
 
QString lineWithoutNewline (int line)
 Returns the given line without the trailing
character.
 
QString line (int line)
 @pparam line the line number to retrieve
 

Protected Slots

virtual void textBufferChanged (const edbee::TextBufferChange &change, QString oldText=QString())
 This method replaces the given text via the undo-button.
 

Additional Inherited Members

- Signals inherited from edbee::TextDocument
void textAboutToBeChanged (edbee::TextBufferChange change)
 
void textChanged (edbee::TextBufferChange change, QString oldText=QString())
 
void persistedChanged (bool persisted)
 This signal is emitted if the persisted state is changed.
 
void languageGrammarChanged ()
 This signal is emitted if the grammar has been changed.
 
void lastScopedOffsetChanged (int previousOffset, int lastScopedOffset)
 this signal is emitted if the scoped range has been changed
 

Detailed Description

A plain textdocument. A document with simple character-buffer implementation.

Constructor & Destructor Documentation

◆ CharTextDocument() [1/2]

edbee::CharTextDocument::CharTextDocument ( QObject * object)

The main contstructor of the chartext document.

◆ CharTextDocument() [2/2]

edbee::CharTextDocument::CharTextDocument ( TextEditorConfig * config = new TextEditorConfig(),
QObject * object = nullptr )

◆ ~CharTextDocument()

edbee::CharTextDocument::~CharTextDocument ( )
virtual

The default constructor.

Member Function Documentation

◆ autoCompleteProviderList()

TextAutoCompleteProviderList * edbee::CharTextDocument::autoCompleteProviderList ( )
virtual

Returns the the autocomplete provider list.

Returns the autocmoplete provider list.

Implements edbee::TextDocument.

◆ buffer()

TextBuffer * edbee::CharTextDocument::buffer ( ) const
virtual

This method should return the active textbuffer.

Returns the active textbuffer.

Implements edbee::TextDocument.

◆ config()

TextEditorConfig * edbee::CharTextDocument::config ( ) const
virtual

This method returns the configuration.

Implements edbee::TextDocument.

◆ encoding()

virtual TextCodec * edbee::CharTextDocument::encoding ( )
inlinevirtual

This method returns the current encoding.

Implements edbee::TextDocument.

◆ giveChangeWithoutFilter()

Change * edbee::CharTextDocument::giveChangeWithoutFilter ( Change * change,
int coalesceId )
virtual

Gives a change to the undo stack without invoking the filter.

Parameters
changethe change to execute
coalesceIdthe coalescing identifier

Implements edbee::TextDocument.

◆ languageGrammar()

TextGrammar * edbee::CharTextDocument::languageGrammar ( )
virtual

This method should return the current language grammar.

returns the language grammar

Implements edbee::TextDocument.

◆ lineEnding()

virtual const edbee::LineEnding * edbee::CharTextDocument::lineEnding ( )
inlinevirtual

This method should return the current line ending.

Implements edbee::TextDocument.

◆ scopes()

virtual TextDocumentScopes * edbee::CharTextDocument::scopes ( )
inlinevirtual

Should return the document-scopes of this document.

Implements edbee::TextDocument.

◆ setEncoding()

virtual void edbee::CharTextDocument::setEncoding ( TextCodec * codec)
inlinevirtual

Sets the encoding.

Implements edbee::TextDocument.

◆ setLanguageGrammar()

void edbee::CharTextDocument::setLanguageGrammar ( TextGrammar * grammar)
virtual

Sets the language grammar.

Implements edbee::TextDocument.

◆ setLineEnding()

virtual void edbee::CharTextDocument::setLineEnding ( const edbee::LineEnding * lineEnding)
inlinevirtual

Set the used line ending.

Implements edbee::TextDocument.

◆ textBufferChanged

void edbee::CharTextDocument::textBufferChanged ( const edbee::TextBufferChange & change,
QString oldText = QString() )
protectedvirtualslot

This method replaces the given text via the undo-button.

◆ textLexer()

virtual TextLexer * edbee::CharTextDocument::textLexer ( )
inlinevirtual

Should return the current document lexer.

Implements edbee::TextDocument.

◆ textUndoStack()

virtual TextUndoStack * edbee::CharTextDocument::textUndoStack ( )
inlinevirtual

returns the text undo stack

Implements edbee::TextDocument.


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