Kate::TextRange

Search for usage in LXR

Kate::TextRange Class Referencefinal

#include <katetextrange.h>

Inheritance diagram for Kate::TextRange:

Public Member Functions

 TextRange (const TextRange &)=delete
 
 TextRange (TextBuffer *buffer, KTextEditor::Range range, InsertBehaviors insertBehavior, EmptyBehavior emptyBehavior=AllowEmpty)
 
 ~TextRange () override
 
const KTextEditor::Attribute::Ptrattribute () const override
 
bool attributeOnlyForViews () const override
 
KTextEditor::Documentdocument () const override
 
EmptyBehavior emptyBehavior () const override
 
const KTextEditor::MovingCursorend () const override
 
const TextCursorendInternal () const
 
KTextEditor::MovingRangeFeedbackfeedback () const override
 
bool hasAttribute () const
 
InsertBehaviors insertBehaviors () const override
 
 operator KTextEditor::Range () const
 
TextRangeoperator= (const TextRange &)=delete
 
void setAttribute (KTextEditor::Attribute::Ptr attribute) override
 
void setAttributeOnlyForViews (bool onlyForViews) override
 
void setEmptyBehavior (EmptyBehavior emptyBehavior) override
 
void setFeedback (KTextEditor::MovingRangeFeedback *feedback) override
 
void setInsertBehaviors (InsertBehaviors insertBehaviors) override
 
void setRange (KTextEditor::Cursor start, KTextEditor::Cursor end)
 
void setRange (KTextEditor::Range range) override
 
void setRange (KTextEditor::Range range, KTextEditor::Attribute::Ptr attribute) override
 
void setRange (KTextEditor::Range range, KTextEditor::Attribute::Ptr attribute, qreal zDepth) override
 
void setView (KTextEditor::View *view) override
 
void setZDepth (qreal zDepth) override
 
bool spansMultipleBlocks () const
 
const KTextEditor::MovingCursorstart () const override
 
const TextCursorstartInternal () const
 
KTextEditor::LineRange toLineRange () const
 
const KTextEditor::Range toRange () const
 
KTextEditor::Viewview () const override
 
qreal zDepth () const override
 
- Public Member Functions inherited from KTextEditor::MovingRange
 MovingRange (const MovingRange &)=delete
 
virtual ~MovingRange ()
 
bool isEmpty () const
 
 operator Range () const
 
MovingRangeoperator= (const MovingRange &)=delete
 
void setRange (Cursor start, Cursor end)
 
LineRange toLineRange () const Q_DECL_NOEXCEPT
 
const Range toRange () const
 
bool contains (const Range &range) const
 
bool contains (Cursor cursor) const
 
bool containsLine (int line) const
 
bool containsColumn (int column) const
 
bool overlaps (const Range &range) const
 
bool overlapsLine (int line) const
 
bool overlapsColumn (int column) const
 
bool onSingleLine () const
 
int numberOfLines () const Q_DECL_NOEXCEPT
 

Additional Inherited Members

- Public Types inherited from KTextEditor::MovingRange
enum  EmptyBehavior { AllowEmpty = 0x0 , InvalidateIfEmpty = 0x1 }
 
enum  InsertBehavior { DoNotExpand = 0x0 , ExpandLeft = 0x1 , ExpandRight = 0x2 }
 
typedef QFlags< InsertBehaviorInsertBehaviors
 
- Protected Member Functions inherited from KTextEditor::MovingRange
 MovingRange ()
 

Detailed Description

Class representing a 'clever' text range.

It will automagically move if the text inside the buffer it belongs to is modified. By intention no subclass of KTextEditor::Range, must be converted manually. A TextRange is allowed to be empty. If you call setInvalidateIfEmpty(true), a TextRange will become automatically invalid as soon as start() == end() position holds.

Definition at line 35 of file katetextrange.h.

Constructor & Destructor Documentation

◆ TextRange() [1/2]

Kate::TextRange::TextRange ( TextBuffer * buffer,
KTextEditor::Range range,
InsertBehaviors insertBehavior,
EmptyBehavior emptyBehavior = AllowEmpty )

Construct a text range.

A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters
bufferparent text buffer
rangeThe initial text range assumed by the new range.
insertBehaviorDefine whether the range should expand when text is inserted adjacent to the range.
emptyBehaviorDefine whether the range should invalidate itself on becoming empty.

Definition at line 16 of file katetextrange.cpp.

◆ TextRange() [2/2]

Kate::TextRange::TextRange ( const TextRange & )
delete

No copy constructor, don't allow this to be copied.

◆ ~TextRange()

Kate::TextRange::~TextRange ( )
override

Destruct the text block.

Definition at line 36 of file katetextrange.cpp.

Member Function Documentation

◆ attribute()

const KTextEditor::Attribute::Ptr & Kate::TextRange::attribute ( ) const
inlineoverridevirtual

Gets the active Attribute for this range.

Returns
a pointer to the active attribute

Implements KTextEditor::MovingRange.

Definition at line 240 of file katetextrange.h.

◆ attributeOnlyForViews()

bool Kate::TextRange::attributeOnlyForViews ( ) const
inlineoverridevirtual

Is this range's attribute only visible in views, not for example prints? Default is false.

Returns
range visible only for views

Implements KTextEditor::MovingRange.

Definition at line 287 of file katetextrange.h.

◆ document()

KTextEditor::Document * Kate::TextRange::document ( ) const
overridevirtual

Gets the document to which this range is bound.

Returns
a pointer to the document

Implements KTextEditor::MovingRange.

Definition at line 300 of file katetextrange.cpp.

◆ emptyBehavior()

EmptyBehavior Kate::TextRange::emptyBehavior ( ) const
inlineoverridevirtual

Will this range invalidate itself if it becomes empty?

Returns
behavior on becoming empty

Implements KTextEditor::MovingRange.

Definition at line 90 of file katetextrange.h.

◆ end()

const KTextEditor::MovingCursor & Kate::TextRange::end ( ) const
inlineoverridevirtual

Retrieve end cursor of this range, read-only.

Returns
end cursor

Implements KTextEditor::MovingRange.

Definition at line 173 of file katetextrange.h.

◆ endInternal()

const TextCursor & Kate::TextRange::endInternal ( ) const
inline

Nonvirtual version of end(), which is faster.

Returns
end cursor

Definition at line 182 of file katetextrange.h.

◆ feedback()

KTextEditor::MovingRangeFeedback * Kate::TextRange::feedback ( ) const
inlineoverridevirtual

Gets the active MovingRangeFeedback for this range.

Returns
a pointer to the active MovingRangeFeedback

Implements KTextEditor::MovingRange.

Definition at line 268 of file katetextrange.h.

◆ hasAttribute()

bool Kate::TextRange::hasAttribute ( ) const
inline
Returns
whether a nonzero attribute is set. This is faster than checking attribute(), because the reference-counting is omitted.

Definition at line 249 of file katetextrange.h.

◆ insertBehaviors()

KTextEditor::MovingRange::InsertBehaviors Kate::TextRange::insertBehaviors ( ) const
overridevirtual

Get current insert behaviors.

Returns
current insert behaviors

Implements KTextEditor::MovingRange.

Definition at line 79 of file katetextrange.cpp.

◆ operator KTextEditor::Range()

Kate::TextRange::operator KTextEditor::Range ( ) const
inline

Convert this clever range into a dumb one.

Equal to toRange, allowing to use implicit conversion.

Returns
normal range

Definition at line 210 of file katetextrange.h.

◆ operator=()

TextRange & Kate::TextRange::operator= ( const TextRange & )
delete

No assignment operator, no copying around.

◆ setAttribute()

void Kate::TextRange::setAttribute ( KTextEditor::Attribute::Ptr attribute)
overridevirtual

Sets the currently active attribute for this range.

This will trigger update of the relevant view parts.

Parameters
attributeAttribute to assign to this range. If null, simply removes the previous Attribute.

Implements KTextEditor::MovingRange.

Definition at line 233 of file katetextrange.cpp.

◆ setAttributeOnlyForViews()

void Kate::TextRange::setAttributeOnlyForViews ( bool onlyForViews)
overridevirtual

Set if this range's attribute is only visible in views, not for example prints.

Parameters
onlyForViewsattribute only valid for views

Implements KTextEditor::MovingRange.

Definition at line 278 of file katetextrange.cpp.

◆ setEmptyBehavior()

void Kate::TextRange::setEmptyBehavior ( EmptyBehavior emptyBehavior)
overridevirtual

Set if this range will invalidate itself if it becomes empty.

Parameters
emptyBehaviorbehavior on becoming empty

Implements KTextEditor::MovingRange.

Definition at line 94 of file katetextrange.cpp.

◆ setFeedback()

void Kate::TextRange::setFeedback ( KTextEditor::MovingRangeFeedback * feedback)
overridevirtual

Sets the currently active MovingRangeFeedback for this range.

This will trigger evaluation if feedback must be send again (for example if mouse is already inside range).

Parameters
feedbackMovingRangeFeedback to assign to this range. If null, simply removes the previous MovingRangeFeedback.

Implements KTextEditor::MovingRange.

Definition at line 260 of file katetextrange.cpp.

◆ setInsertBehaviors()

void Kate::TextRange::setInsertBehaviors ( InsertBehaviors insertBehaviors)
overridevirtual

Set insert behaviors.

Parameters
insertBehaviorsnew insert behaviors

Implements KTextEditor::MovingRange.

Definition at line 62 of file katetextrange.cpp.

◆ setRange() [1/4]

void Kate::TextRange::setRange ( KTextEditor::Cursor start,
KTextEditor::Cursor end )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Set the range of this range A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters
startnew start for this clever range
endnew end for this clever range

Definition at line 117 of file katetextrange.h.

◆ setRange() [2/4]

void Kate::TextRange::setRange ( KTextEditor::Range range)
overridevirtual

Set the range of this range.

A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters
rangenew range for this clever range

Implements KTextEditor::MovingRange.

Definition at line 110 of file katetextrange.cpp.

◆ setRange() [3/4]

void Kate::TextRange::setRange ( KTextEditor::Range range,
KTextEditor::Attribute::Ptr attribute )
overridevirtual

Set the range of this range and the connected attribute.

Avoids internal overhead of separate setting that.

A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters
rangenew range for this clever range
attributeAttribute to assign to this range. If null, simply removes the previous Attribute.
Since
6.0

Implements KTextEditor::MovingRange.

Definition at line 169 of file katetextrange.cpp.

◆ setRange() [4/4]

void Kate::TextRange::setRange ( KTextEditor::Range range,
KTextEditor::Attribute::Ptr attribute,
qreal zDepth )
overridevirtual

Set the range of this range and the connected attribute and Z-depth.

Avoids internal overhead of separate setting that.

A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters
rangenew range for this clever range
attributeAttribute to assign to this range. If null, simply removes the previous Attribute.
zDepthnew Z-depth of this range
Since
6.0

Implements KTextEditor::MovingRange.

Definition at line 176 of file katetextrange.cpp.

◆ setView()

void Kate::TextRange::setView ( KTextEditor::View * view)
overridevirtual

Sets the currently active view for this range.

This will trigger update of the relevant view parts, if the view changed. Set view before the attribute, that will avoid not needed redraws.

Parameters
viewView to assign to this range. If null, simply removes the previous view.

Implements KTextEditor::MovingRange.

Definition at line 216 of file katetextrange.cpp.

◆ setZDepth()

void Kate::TextRange::setZDepth ( qreal zDepth)
overridevirtual

Set the current Z-depth of this range.

Ranges with smaller Z-depth than others will win during rendering. This will trigger update of the relevant view parts, if the depth changed. Set depth before the attribute, that will avoid not needed redraws. Default is 0.0.

Parameters
zDepthnew Z-depth of this range

Implements KTextEditor::MovingRange.

Definition at line 284 of file katetextrange.cpp.

◆ spansMultipleBlocks()

bool Kate::TextRange::spansMultipleBlocks ( ) const
inline

Definition at line 321 of file katetextrange.h.

◆ start()

const KTextEditor::MovingCursor & Kate::TextRange::start ( ) const
inlineoverridevirtual

Retrieve start cursor of this range, read-only.

Returns
start cursor

Implements KTextEditor::MovingRange.

Definition at line 155 of file katetextrange.h.

◆ startInternal()

const TextCursor & Kate::TextRange::startInternal ( ) const
inline

Non-virtual version of start(), which is faster.

Returns
start cursor

Definition at line 164 of file katetextrange.h.

◆ toLineRange()

KTextEditor::LineRange Kate::TextRange::toLineRange ( ) const
inline

Hides parent's impl of toLineRange() and uses non-virtual functions internally.

Definition at line 190 of file katetextrange.h.

◆ toRange()

const KTextEditor::Range Kate::TextRange::toRange ( ) const
inline

Convert this clever range into a dumb one.

Returns
normal range

Definition at line 199 of file katetextrange.h.

◆ view()

KTextEditor::View * Kate::TextRange::view ( ) const
inlineoverridevirtual

Gets the active view for this range.

Might be already invalid, internally only used for pointer comparisons.

Returns
a pointer to the active view

Implements KTextEditor::MovingRange.

Definition at line 220 of file katetextrange.h.

◆ zDepth()

qreal Kate::TextRange::zDepth ( ) const
inlineoverridevirtual

Gets the current Z-depth of this range.

Ranges with smaller Z-depth than others will win during rendering. Default is 0.0.

Returns
current Z-depth of this range

Implements KTextEditor::MovingRange.

Definition at line 305 of file katetextrange.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.