ladybird/Userland/Libraries/LibVT/Position.h
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

55 lines
1.1 KiB
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#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 };
};
}