mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
LibVT: Rename VT::BufferPosition to VT::Position and move to own file
This commit is contained in:
parent
e8eadd19a5
commit
4fb02c78a9
4 changed files with 59 additions and 53 deletions
48
Libraries/LibVT/Position.h
Normal file
48
Libraries/LibVT/Position.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
#pragma once
|
||||
|
||||
namespace VT {
|
||||
|
||||
class Position {
|
||||
public:
|
||||
Position() {}
|
||||
Position(int row, int column)
|
||||
: m_row(row)
|
||||
, m_column(column)
|
||||
{
|
||||
}
|
||||
|
||||
bool is_valid() const { return m_row >= 0 && m_column >= 0; }
|
||||
int row() const { return m_row; }
|
||||
int column() const { return m_column; }
|
||||
|
||||
bool operator<(const Position& other) const
|
||||
{
|
||||
return m_row < other.m_row || (m_row == other.m_row && m_column < other.m_column);
|
||||
}
|
||||
|
||||
bool operator<=(const Position& other) const
|
||||
{
|
||||
return *this < other || *this == other;
|
||||
}
|
||||
|
||||
bool operator>=(const Position& other) const
|
||||
{
|
||||
return !(*this < other);
|
||||
}
|
||||
|
||||
bool operator==(const Position& other) const
|
||||
{
|
||||
return m_row == other.m_row && m_column == other.m_column;
|
||||
}
|
||||
|
||||
bool operator!=(const Position& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_row { -1 };
|
||||
int m_column { -1 };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue