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

This is a set of scoped textranges. This set is used to remember parsed language ranges. More...

#include <textdocumentscopes.h>

+ Inheritance diagram for edbee::MultiLineScopedTextRangeSet:
+ Collaboration diagram for edbee::MultiLineScopedTextRangeSet:

Public Member Functions

 MultiLineScopedTextRangeSet (TextDocument *textDocument, TextDocumentScopes *textDocumentScopes)
 A multilinescoped textrange set. More...
 
virtual ~MultiLineScopedTextRangeSet ()
 the destructor of the multiline scoped rangeset More...
 
void reset ()
 Completely empties the scope list. More...
 
virtual int rangeCount () const
 Returns the number of ranges. More...
 
virtual TextRangerange (int idx)
 returns the given textrange More...
 
virtual const TextRangeconstRange (int idx) const
 returns the cont range More...
 
virtual void addRange (int anchor, int caret)
 This method adds a range with the default scope. More...
 
virtual void addRange (const TextRange &range)
 adds the given range More...
 
virtual void removeRange (int idx)
 ' removes the given scope More...
 
virtual void clear ()
 removes all scopes More...
 
virtual void toSingleRange ()
 
virtual void sortRanges ()
 This method sorts all ranges. More...
 
virtual MultiLineScopedTextRangescopedRange (int idx)
 this method returns the scoped range More...
 
virtual MultiLineScopedTextRangeaddRange (int anchor, int caret, const QString &name, TextGrammarRule *rule)
 Adds a textrange with the given name. More...
 
void removeAndInvalidateRangesAfterOffset (int offset)
 This method removes all ranges after a given offset. This means it will remove all complete ranges after the given offset. Ranges that start before the offset and end after the offset are 'invalidated' which means the end offset is placed to the end of the document. More...
 
void giveScopedTextRange (MultiLineScopedTextRange *textScope)
 This method gives the scoped text range to this object. More...
 
void processChangesIfRequired (bool joinBorders)
 This method process the changes if required. More...
 
QString toString ()
 convert the found ranges to strings More...
 
TextDocumentScopestextDocumentScopes ()
 Returns a reference to the textdocument scopes. More...
 
- Public Member Functions inherited from edbee::TextRangeSetBase
 TextRangeSetBase (TextDocument *doc)
 
virtual ~TextRangeSetBase ()
 
TextRangelastRange ()
 this method returns the last range More...
 
TextRangefirstRange ()
 the first range More...
 
int rangeIndexAtOffset (int offset)
 This method returns the range index at the given offset. More...
 
bool rangesBetweenOffsets (int offsetBegin, int offsetEnd, int &firstIndex, int &lastIndex)
 returns the range indices that are being overlapped by the given offsetBegin and offsetEnd More...
 
bool rangesBetweenOffsetsExlusiveEnd (int offsetBegin, int offsetEnd, int &firstIndex, int &lastIndex)
 returns the range indices that are being overlapped by the given offsetBegin and offsetEnd More...
 
bool rangesAtLine (int line, int &firstIndex, int &lastIndex)
 Returns the range indices that are being used on the given line. More...
 
bool hasSelection ()
 This method checks if there's a selection available A selection is an range with a different anchor then it's caret. More...
 
bool equals (TextRangeSetBase &sel)
 This method checks if two selections are equal. More...
 
void replaceAll (const TextRangeSetBase &base)
 Replaces all ranges with the supplied ranges. More...
 
QString getSelectedText ()
 This method returns all selected text For every filled selection range a line is returned. More...
 
QString getSelectedTextExpandedToFullLines ()
 Returns ALL lines that are touched by the selection. This means Full lines are always returned. More...
 
QString rangesAsString () const
 This method converts the selection ranges as a string, in the format: anchor>caret,anchor>caret. More...
 
void beginChanges ()
 This method starts the changes. More...
 
void endChanges ()
 
void endChangesWithoutProcessing ()
 Ends the changes without processing. WARNING, you should ONLY call this method if the operation you performed kept the rangeset in a valid state. This (at least) means the ranges need to be sorted. More...
 
bool changing () const
 Checks if the current rangeset is in a changing state. More...
 
void resetAnchors ()
 This method resets all anchors to the positions of the carets. More...
 
void clearSelection ()
 This method moves all carets to the anchor positions. More...
 
void addTextRanges (const TextRangeSetBase &sel)
 An union operation This method adds all text selection-items. Merges all ranges. More...
 
void substractTextRanges (const TextRangeSetBase &sel)
 The difference operation This method substracts the text-selection from the current selection. More...
 
void substractRange (int min, int max)
 This method substracts a single range from the ranges list. More...
 
void expandToFullLines (int amount)
 Expands the selection so it selects full lines. More...
 
void expandToWords (const QString &whitespace, const QStringList &characterGroups)
 Expands the selection to full words. More...
 
void selectWordAt (int offset, const QString &whitespace, const QStringList &characterGroups)
 Selects the word at the given offset. More...
 
void toggleWordSelectionAt (int offset, const QString &whitespace, const QStringList &characterGroups)
 Toggles a word selection at the given location The idea is the following, double-click an empty place to select the wordt at the given location Double click an existing selection to remove the selection (and caret) More...
 
void moveCarets (int amount)
 This method moves the carets by character. More...
 
void moveCaretsOrDeselect (int amount)
 This method moves the carets or deslects the given character. More...
 
void moveCaretsByCharGroup (int amount, const QString &whitespace, const QStringList &charGroups)
 This method moves the carets. More...
 
void moveCaretsToLineBoundary (int direction, const QString &whitespace)
 Moves al carets to the given line boundary (line-boundary automaticly switches between column 0 and first non-whitespace character) More...
 
void moveCaretsByLine (int amount)
 
void changeSpatial (int pos, int length, int newLength, bool sticky=false, bool performDelete=false)
 This method adds (or removes) the given spatial length at the given location. More...
 
void setRange (int anchor, int caret, int index=0)
 This mehtod sets the first range item. More...
 
void setRange (const TextRange &range, int index=0)
 Sets the range at the given index. Make sure the given index exists!! More...
 
TextDocumenttextDocument () const
 Returns the associated textdocument. More...
 
void mergeOverlappingRanges (bool joinBorders)
 This method merges overlapping ranges. More...
 

Additional Inherited Members

- Protected Attributes inherited from edbee::TextRangeSetBase
TextDocumenttextDocumentRef_
 The reference to the textbuffer. More...
 
int changing_
 A (integer) boolean for handling changes between beginChagnes and endChanges. More...
 

Detailed Description

This is a set of scoped textranges. This set is used to remember parsed language ranges.

Constructor & Destructor Documentation

◆ MultiLineScopedTextRangeSet()

edbee::MultiLineScopedTextRangeSet::MultiLineScopedTextRangeSet ( TextDocument textDocument,
TextDocumentScopes textDocumentScopes 
)

A multilinescoped textrange set.

◆ ~MultiLineScopedTextRangeSet()

edbee::MultiLineScopedTextRangeSet::~MultiLineScopedTextRangeSet ( )
virtual

the destructor of the multiline scoped rangeset

Member Function Documentation

◆ addRange() [1/3]

void edbee::MultiLineScopedTextRangeSet::addRange ( int  anchor,
int  caret 
)
virtual

This method adds a range with the default scope.

Implements edbee::TextRangeSetBase.

◆ addRange() [2/3]

void edbee::MultiLineScopedTextRangeSet::addRange ( const TextRange range)
virtual

adds the given range

Implements edbee::TextRangeSetBase.

◆ addRange() [3/3]

MultiLineScopedTextRange & edbee::MultiLineScopedTextRangeSet::addRange ( int  anchor,
int  caret,
const QString &  name,
TextGrammarRule rule 
)
virtual

Adds a textrange with the given name.

◆ clear()

void edbee::MultiLineScopedTextRangeSet::clear ( )
virtual

removes all scopes

Implements edbee::TextRangeSetBase.

◆ constRange()

const TextRange & edbee::MultiLineScopedTextRangeSet::constRange ( int  idx) const
virtual

returns the cont range

Implements edbee::TextRangeSetBase.

◆ giveScopedTextRange()

void edbee::MultiLineScopedTextRangeSet::giveScopedTextRange ( MultiLineScopedTextRange textScope)

This method gives the scoped text range to this object.

◆ processChangesIfRequired()

void edbee::MultiLineScopedTextRangeSet::processChangesIfRequired ( bool  joinBorders)
virtual

This method process the changes if required.

Reimplemented from edbee::TextRangeSetBase.

◆ range()

TextRange & edbee::MultiLineScopedTextRangeSet::range ( int  idx)
virtual

returns the given textrange

Implements edbee::TextRangeSetBase.

◆ rangeCount()

int edbee::MultiLineScopedTextRangeSet::rangeCount ( ) const
virtual

Returns the number of ranges.

Implements edbee::TextRangeSetBase.

◆ removeAndInvalidateRangesAfterOffset()

void edbee::MultiLineScopedTextRangeSet::removeAndInvalidateRangesAfterOffset ( int  offset)

This method removes all ranges after a given offset. This means it will remove all complete ranges after the given offset. Ranges that start before the offset and end after the offset are 'invalidated' which means the end offset is placed to the end of the document.

◆ removeRange()

void edbee::MultiLineScopedTextRangeSet::removeRange ( int  idx)
virtual

' removes the given scope

Implements edbee::TextRangeSetBase.

◆ reset()

void edbee::MultiLineScopedTextRangeSet::reset ( )

Completely empties the scope list.

◆ scopedRange()

MultiLineScopedTextRange & edbee::MultiLineScopedTextRangeSet::scopedRange ( int  idx)
virtual

this method returns the scoped range

◆ sortRanges()

void edbee::MultiLineScopedTextRangeSet::sortRanges ( )
virtual

This method sorts all ranges.

Implements edbee::TextRangeSetBase.

◆ textDocumentScopes()

TextDocumentScopes * edbee::MultiLineScopedTextRangeSet::textDocumentScopes ( )

Returns a reference to the textdocument scopes.

◆ toSingleRange()

void edbee::MultiLineScopedTextRangeSet::toSingleRange ( )
virtual

< NOT IMPLEMENTED

Implements edbee::TextRangeSetBase.

◆ toString()

QString edbee::MultiLineScopedTextRangeSet::toString ( )

convert the found ranges to strings


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