KTextEditor
utils/range.cpp
30 if (startIndex < 0 || endIndex < 0 || closeIndex < 0 || closeIndex < startIndex || endIndex < closeIndex || endIndex < startIndex) {
34 return Range(Cursor::fromString(str.mid(startIndex + 1, closeIndex - startIndex)), Cursor::fromString(str.mid(closeIndex + 2, endIndex - closeIndex - 2)));
103 if (startIndex < 0 || endIndex < 0 || commaIndex < 0 || commaIndex < startIndex || endIndex < commaIndex || endIndex < startIndex) {
110 const int start = str.mid(startIndex + 1, commaIndex - startIndex - 1).toString().toInt(&ok1); // FIXME KF6: Qt 5.15.2 and higher: remove .toString()
111 const int end = str.mid(commaIndex + 1, endIndex - commaIndex - 1).toString().toInt(&ok2); // FIXME KF6: Qt 5.15.2 and higher: remove .toString()
126 QByteArray ba = "Cursor[" + QByteArray::number(cursor.line()) + ", " + QByteArray::number(cursor.column()) + ']';
135 ba += QByteArray::number(range.start().line()) + ", " + QByteArray::number(range.start().column()) + " - ";
constexpr int column() const Q_DECL_NOEXCEPT
Retrieve the column on which this cursor is situated.
Definition: cursor.h:215
static Range fromString(QStringView str) Q_DECL_NOEXCEPT
Returns a Range created from the string str containing the format "[(start-line, start-column),...
Definition: utils/range.cpp:24
static Cursor fromString(QStringView str) Q_DECL_NOEXCEPT
Returns a Cursor created from the string str containing the format "(line, column)".
Definition: ktexteditor.cpp:51
Q_SCRIPTABLE Q_NOREPLY void start()
bool confineToRange(const Range &range) Q_DECL_NOEXCEPT
Confine this range if necessary to fit within range.
Definition: utils/range.cpp:52
QByteArray number(int n, int base)
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 Cursor end() const Q_DECL_NOEXCEPT
Get the end position of this range.
Definition: include/ktexteditor/range.h:183
bool expandToRange(const Range &range) Q_DECL_NOEXCEPT
Expand this range if necessary to contain range.
Definition: utils/range.cpp:69
char * toString(const T &value)
constexpr int start() const Q_DECL_NOEXCEPT
Get the start line of this line range.
Definition: linerange.h:105
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
static LineRange fromString(QStringView str) Q_DECL_NOEXCEPT
Returns a LineRange created from the string str containing the format "[start line,...
Definition: utils/range.cpp:96
constexpr Cursor start() const Q_DECL_NOEXCEPT
Get the start position of this range.
Definition: include/ktexteditor/range.h:173
constexpr int end() const Q_DECL_NOEXCEPT
Get the end line of this line range.
Definition: linerange.h:115
constexpr int line() const Q_DECL_NOEXCEPT
Retrieve the line on which this cursor is situated.
Definition: cursor.h:197
char * data()
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 03:58:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jun 27 2022 03:58:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.