1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

LibGUI: Move GTextRange and GTextPosition to their own header files

This commit is contained in:
Andreas Kling 2019-10-27 11:23:53 +01:00
parent db5178fb8f
commit de2b25e2c1
3 changed files with 91 additions and 80 deletions

View file

@ -0,0 +1,27 @@
#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 };
};