KTextEditor
include/ktexteditor/range.h
62 Q_DECL_CONSTEXPR Range(const Cursor &start, const Cursor &end) Q_DECL_NOEXCEPT : m_start(qMin(start, end)), m_end(qMax(start, end))
73 Q_DECL_CONSTEXPR Range(const Cursor &start, int width) Q_DECL_NOEXCEPT : m_start(qMin(start, Cursor(start.line(), start.column() + width))),
85 Q_DECL_CONSTEXPR Range(const Cursor &start, int endLine, int endColumn) Q_DECL_NOEXCEPT : m_start(qMin(start, Cursor(endLine, endColumn))),
91 * Constructor which creates a range from \e startLine, \e startColumn to \e endLine, \e endColumn.
98 Q_DECL_CONSTEXPR Range(int startLine, int startColumn, int endLine, int endColumn) Q_DECL_NOEXCEPT
127 return QLatin1Char('[') + m_start.toString() + QLatin1String(", ") + m_end.toString() + QLatin1Char(']');
367 return (line > start().line() || (line == start().line() && !start().column())) && line < end().line();
391 return (range.start() <= start()) ? (range.end() > start()) : (range.end() >= end()) ? (range.start() < end()) : contains(range);
447 return ((!isValid() || !range.isValid() || *this > range || *this < range)) ? invalid() : Range(qMax(start(), range.start()), qMin(end(), range.end()));
472 Q_DECL_CONSTEXPR inline friend Range operator+(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
500 Q_DECL_CONSTEXPR inline friend Range operator-(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
527 Q_DECL_CONSTEXPR inline friend Range operator&(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
554 Q_DECL_CONSTEXPR inline friend bool operator==(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
567 Q_DECL_CONSTEXPR inline friend bool operator!=(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
constexpr int numberOfLines() const Q_DECL_NOEXCEPT
Returns the number of lines separating the start() and end() positions.
Definition: include/ktexteditor/range.h:297
constexpr bool overlaps(const Range &range) const Q_DECL_NOEXCEPT
Check whether the this range overlaps with range.
Definition: include/ktexteditor/range.h:389
constexpr friend Range operator&(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Intersects r1 and r2.
Definition: include/ktexteditor/range.h:527
constexpr Range encompass(const Range &range) const Q_DECL_NOEXCEPT
Returns the smallest range which encompasses this range and the supplied range.
Definition: include/ktexteditor/range.h:458
friend Range & operator&=(Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Intersects r1 with r2 and assigns the result to r1.
Definition: include/ktexteditor/range.h:540
An object representing lines from a start line to an end line.
Definition: linerange.h:37
An object representing a section of text, from one Cursor to another.
Definition: include/ktexteditor/range.h:44
constexpr friend Range operator-(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Subtraction operator.
Definition: include/ktexteditor/range.h:500
static Range fromString(const QString &str) Q_DECL_NOEXCEPT
Returns a Range created from the string str containing the format "[(start-line, start-column),...
Definition: include/ktexteditor/range.h:137
constexpr friend bool operator<(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Less than operator.
Definition: include/ktexteditor/range.h:595
constexpr bool containsColumn(int column) const Q_DECL_NOEXCEPT
Check whether the range contains column.
Definition: include/ktexteditor/range.h:377
constexpr bool contains(const Range &range) const Q_DECL_NOEXCEPT
Check whether the this range wholly encompasses range.
Definition: include/ktexteditor/range.h:341
constexpr Cursor end() const Q_DECL_NOEXCEPT
Get the end position of this range.
Definition: include/ktexteditor/range.h:181
QString toString() const
Returns the cursor position as string in the format "start-line:start-column,endl-line:end-column".
Definition: include/ktexteditor/range.h:125
constexpr int columnWidth() const Q_DECL_NOEXCEPT
Returns the number of columns separating the start() and end() positions.
Definition: include/ktexteditor/range.h:308
void setEnd(const Cursor &end) Q_DECL_NOEXCEPT
Set the end cursor to end.
Definition: include/ktexteditor/range.h:252
Q_SCRIPTABLE Q_NOREPLY void start()
constexpr friend bool operator==(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Equality operator.
Definition: include/ktexteditor/range.h:554
constexpr LineRange toLineRange() const Q_DECL_NOEXCEPT
Convert this Range to a LineRange.
Definition: include/ktexteditor/range.h:191
constexpr friend bool operator!=(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Inequality operator.
Definition: include/ktexteditor/range.h:567
friend Range & operator-=(Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Subtraction assignment operator.
Definition: include/ktexteditor/range.h:513
constexpr Range(const Cursor &start, const Cursor &end) Q_DECL_NOEXCEPT
Constructor which creates a range from start to end.
Definition: include/ktexteditor/range.h:62
friend QDebug operator<<(QDebug s, const Range &range)
qDebug() stream operator.
Definition: include/ktexteditor/range.h:603
constexpr bool overlapsColumn(int column) const Q_DECL_NOEXCEPT
Check to see if this range overlaps column; that is, if column is between start()....
Definition: include/ktexteditor/range.h:416
constexpr bool isEmpty() const Q_DECL_NOEXCEPT
Returns true if this range contains no characters, ie.
Definition: include/ktexteditor/range.h:319
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
constexpr bool contains(const Cursor &cursor) const Q_DECL_NOEXCEPT
Check to see if cursor is contained within this range, ie >= start() and < end().
Definition: include/ktexteditor/range.h:353
void setRange(const Range &range) Q_DECL_NOEXCEPT
Set the start and end cursors to range.start() and range.end() respectively.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition: katetextblock.h:22
void setStart(const Cursor &start) Q_DECL_NOEXCEPT
Set the start cursor to start.
Definition: include/ktexteditor/range.h:236
constexpr bool isValid() const Q_DECL_NOEXCEPT
Validity check.
Definition: include/ktexteditor/range.h:107
constexpr friend Range operator+(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Addition operator.
Definition: include/ktexteditor/range.h:472
constexpr Cursor start() const Q_DECL_NOEXCEPT
Get the start position of this range.
Definition: include/ktexteditor/range.h:171
friend Range & operator+=(Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Addition assignment operator.
Definition: include/ktexteditor/range.h:485
constexpr bool onSingleLine() const Q_DECL_NOEXCEPT
Check whether this range is wholly contained within one line, ie.
Definition: include/ktexteditor/range.h:286
constexpr friend bool operator>(const Range &r1, const Range &r2) Q_DECL_NOEXCEPT
Greater than operator.
Definition: include/ktexteditor/range.h:581
constexpr Range(const Cursor &start, int endLine, int endColumn) Q_DECL_NOEXCEPT
Constructor which creates a range from start, to endLine, endColumn.
Definition: include/ktexteditor/range.h:85
constexpr Range intersect(const Range &range) const Q_DECL_NOEXCEPT
Intersects this range with another, returning the shared area of the two ranges.
Definition: include/ktexteditor/range.h:445
constexpr bool containsLine(int line) const Q_DECL_NOEXCEPT
Returns true if this range wholly encompasses line.
Definition: include/ktexteditor/range.h:365
constexpr static Range invalid() Q_DECL_NOEXCEPT
Returns an invalid range.
Definition: include/ktexteditor/range.h:115
constexpr bool boundaryAtCursor(const Cursor &cursor) const Q_DECL_NOEXCEPT
Check whether cursor is located at either of the start() or end() boundaries.
Definition: include/ktexteditor/range.h:430
constexpr bool overlapsLine(int line) const Q_DECL_NOEXCEPT
Check whether the range overlaps at least part of line.
Definition: include/ktexteditor/range.h:401
constexpr Range(const Cursor &start, int width) Q_DECL_NOEXCEPT
Constructor which creates a single-line range from start, extending width characters along the same l...
Definition: include/ktexteditor/range.h:73
char * toString(const EngineQuery &query)
constexpr Range(int startLine, int startColumn, int endLine, int endColumn) Q_DECL_NOEXCEPT
Constructor which creates a range from startLine, startColumn to endLine, endColumn.
Definition: include/ktexteditor/range.h:98
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 03:51:35 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 03:51:35 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.