mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 03:05:07 +00:00
27 lines
869 B
C++
27 lines
869 B
C++
#pragma once
|
|
|
|
class GTextPosition {
|
|
public:
|
|
GTextPosition() {}
|
|
GTextPosition(int line, int column)
|
|
: m_line(line)
|
|
, m_column(column)
|
|
{
|
|
}
|
|
|
|
bool is_valid() const { return m_line >= 0 && m_column >= 0; }
|
|
|
|
int line() const { return m_line; }
|
|
int column() const { return m_column; }
|
|
|
|
void set_line(int line) { m_line = line; }
|
|
void set_column(int column) { m_column = column; }
|
|
|
|
bool operator==(const GTextPosition& other) const { return m_line == other.m_line && m_column == other.m_column; }
|
|
bool operator!=(const GTextPosition& other) const { return m_line != other.m_line || m_column != other.m_column; }
|
|
bool operator<(const GTextPosition& other) const { return m_line < other.m_line || (m_line == other.m_line && m_column < other.m_column); }
|
|
|
|
private:
|
|
int m_line { -1 };
|
|
int m_column { -1 };
|
|
};
|