|
| Range () |
|
| Range (const Cursor &start, const Cursor &end) |
|
| Range (const Cursor &start, int width) |
|
| Range (const Cursor &start, int endLine, int endColumn) |
|
| Range (int startLine, int startColumn, int endLine, int endColumn) |
|
| Range (const Range ©) |
|
virtual | ~Range () |
|
Range | encompass (const Range &range) const |
|
Range | intersect (const Range &range) const |
|
virtual bool | isSmartRange () const |
|
virtual bool | isValid () const |
|
Range & | operator= (const Range &rhs) |
|
virtual SmartRange * | toSmartRange () const |
|
|
The following functions provide access to, and manipulation of, the range's position.
|
Cursor & | start () |
|
const Cursor & | start () const |
|
Cursor & | end () |
|
const Cursor & | end () const |
|
void | setBothLines (int line) |
|
void | setBothColumns (int column) |
|
virtual void | setRange (const Range &range) |
|
void | setRange (const Cursor &start, const Cursor &end) |
|
virtual bool | expandToRange (const Range &range) |
|
virtual bool | confineToRange (const Range &range) |
|
bool | onSingleLine () const |
|
int | numberOfLines () const |
|
int | columnWidth () const |
|
bool | isEmpty () const |
|
|
The following functions perform checks against this range in comparison to other lines, columns, cursors, and ranges.
|
bool | contains (const Range &range) const |
|
bool | contains (const 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 |
|
int | positionRelativeToCursor (const Cursor &cursor) const |
|
int | positionRelativeToLine (int line) const |
|
bool | boundaryAtCursor (const Cursor &cursor) const |
|
bool | boundaryOnLine (int line) const |
|
bool | boundaryOnColumn (int column) const |
|
|
bool | operator!= (const Range &r1, const Range &r2) |
|
Range | operator& (const Range &r1, const Range &r2) |
|
Range & | operator&= (Range &r1, const Range &r2) |
|
Range | operator+ (const Range &r1, const Range &r2) |
|
Range & | operator+= (Range &r1, const Range &r2) |
|
Range | operator- (const Range &r1, const Range &r2) |
|
Range & | operator-= (Range &r1, const Range &r2) |
|
bool | operator< (const Range &r1, const Range &r2) |
|
QDebug | operator<< (QDebug s, const Range &range) |
|
bool | operator== (const Range &r1, const Range &r2) |
|
bool | operator> (const Range &r1, const Range &r2) |
|
An object representing a section of text, from one Cursor to another.
A Range is a basic class which represents a range of text with two Cursors, from a start() position to an end() position.
For simplicity and convenience, ranges always maintain their start position to be before or equal to their end position. Attempting to set either the start or end of the range beyond the respective end or start will result in both values being set to the specified position. In the constructor, the start and end will be swapped if necessary.
If you want additional functionality such as the ability to maintain position in a document, see MovingRange.
- See also
- MovingRange
- Author
- Hamish Rodda <rodda.nosp@m.@kde.nosp@m..org>
Definition at line 54 of file range.h.
Cursor & KTextEditor::Range::end |
( |
| ) |
|
Get the end position of this range.
This will always be >= start().
This non-const function allows direct manipulation of the end position, while still retaining notification support.
If end is set to a position before start, start will be moved to the same position as end, as ranges are not allowed to have start() > end().
- Note
- If you want to change both start() and end() simultaneously, you should use setRange(), for several reasons:
- otherwise, the rule preventing start() > end() may alter your intended change
- any notifications needed will be performed multiple times for no benefit
- Returns
- a reference to the end position of this range.
Definition at line 306 of file range.cpp.
int Range::positionRelativeToCursor |
( |
const Cursor & |
cursor | ) |
const |
Determine where cursor
is positioned in relationship to this range.
Equivalency (a return value of 0) is returned when cursor
is contained within the range, not when overlapped - i.e., cursor
may be on a line which is also partially occupied by this range, but the position may not be eqivalent. For overlap checking, use positionRelativeToLine().
- Parameters
-
- Returns
- -1 if before, +1 if after, and 0 if
cursor
is contained within the range.
- See also
- positionRelativeToLine()
Definition at line 259 of file range.cpp.
int Range::positionRelativeToLine |
( |
int |
line | ) |
const |
Determine where line
is positioned in relationship to this range.
Equivalency (a return value of 0) is returned when line
is overlapped within the range, not when contained - i.e., this range may not cover an entire line, but line's
position will still be eqivalent. For containment checking, use positionRelativeToCursor().
- Parameters
-
- Returns
- -1 if before, +1 if after, and 0 if
line
is overlapped by this range.
- See also
- positionRelativeToCursor()
Definition at line 270 of file range.cpp.
Cursor & KTextEditor::Range::start |
( |
| ) |
|
Get the start position of this range.
This will always be <= end().
This non-const function allows direct manipulation of the start position, while still retaining notification support.
If start is set to a position after end, end will be moved to the same position as start, as ranges are not allowed to have start() > end().
- Note
- If you want to change both start() and end() simultaneously, you should use setRange(), for several reasons:
- otherwise, the rule preventing start() > end() may alter your intended change
- any notifications needed will be performed multiple times for no benefit
- Returns
- a reference to the start position of this range.
Definition at line 296 of file range.cpp.