Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::TextPos Class Reference

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)
 

Constructor & Destructor Documentation

◆ TextPos() [1/3]

Qx::TextPos::TextPos ( )

Creates a null text position.

◆ TextPos() [2/3]

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)).

◆ TextPos() [3/3]

Qx::TextPos::TextPos ( Index32 line,
Index32 character )

Creates a text position that points to line and character.

Member Function Documentation

◆ character()

Index32 Qx::TextPos::character ( ) const

Returns the character that the text position is pointing to.

◆ isNull()

bool Qx::TextPos::isNull ( ) const

Returns true if the text position is null; otherwise returns false.

◆ line()

Index32 Qx::TextPos::line ( ) const

Returns the line that the text position is pointing to.

◆ operator<=>()

std::strong_ordering Qx::TextPos::operator<=> ( const TextPos & other) const
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

◆ operator==()

bool Qx::TextPos::operator== ( const TextPos & otherTextPos) const
defaultnoexcept

Returns true if the line and character of this text position are the same as in otherTextPos; otherwise returns false.

◆ setCharacter()

void Qx::TextPos::setCharacter ( Index32 character)

Sets the text position to point to character.

◆ setLine()

void Qx::TextPos::setLine ( Index32 line)

Sets the text position to point to line.


The documentation for this class was generated from the following files: