Qx v0.5.8
Qt Extensions Library
|
The TextPos class is used to represent an offset within a text file in terms of lines and characters.
#include <qx/io/qx-textpos.h>
Public Member Functions | |
TextPos () | |
TextPos (Extent e) | |
TextPos (Index32 line, Index32 character) | |
Index32 | character () const |
bool | isNull () const |
Index32 | line () const |
std::strong_ordering | operator<=> (const TextPos &other) const noexcept |
bool | operator== (const TextPos &other) const noexcept=default |
void | setCharacter (Index32 character) |
void | setLine (Index32 line) |
Qx::TextPos::TextPos | ( | ) |
Creates a null text position.
Qx::TextPos::TextPos | ( | Extent | e | ) |
Creates a text position at the given extent e.
Start creates a text position equivalent to TextPos(0,0)
, while End creates a text position equivalent to TextPos
(Index32(Qx::Last), Index32(Qx::Last)).
Creates a text position that points to line and character.
Index32 Qx::TextPos::character | ( | ) | const |
Returns the character that the text position is pointing to.
bool Qx::TextPos::isNull | ( | ) | const |
Returns true
if the text position is null; otherwise returns false
.
Index32 Qx::TextPos::line | ( | ) | const |
Returns the line that the text position is pointing to.
|
noexcept |
Performs a three-way comparison between this text position and other.
Returns:
<0
if this text position is less than other 0
if this text position is equal to other >0
if this text position is greater than other
|
defaultnoexcept |
Returns true
if the line and character of this text position are the same as in otherTextPos; otherwise returns false
.
void Qx::TextPos::setCharacter | ( | Index32 | character | ) |
Sets the text position to point to character.
void Qx::TextPos::setLine | ( | Index32 | line | ) |
Sets the text position to point to line.