forked from qt-creator/qt-creator
Utils: Add equals operator to Utils::LineColumn
Change-Id: Iace2b192cadf94cb8228332165af8c8b75ea3a6c Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -32,12 +32,24 @@ namespace Utils {
|
|||||||
class LineColumn
|
class LineColumn
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
constexpr LineColumn() = default;
|
||||||
constexpr
|
constexpr
|
||||||
LineColumn(int line, int column)
|
LineColumn(int line, int column)
|
||||||
: line(line),
|
: line(line),
|
||||||
column(column)
|
column(column)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
bool isValid() const
|
||||||
|
{
|
||||||
|
return line >= 0 && column >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator==(LineColumn first, LineColumn second)
|
||||||
|
{
|
||||||
|
return first.isValid() && first.line == second.line && first.column == second.column;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
int line = -1;
|
int line = -1;
|
||||||
int column = -1;
|
int column = -1;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user