Core: Add compare function to Search::TextPosition and TextRange

Change-Id: Ia41fb1f2855745075ab7364916ecd69ce4d11401
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2018-11-28 07:56:06 +01:00
parent 7e45ccc99b
commit bc5c21c212

View File

@@ -45,6 +45,9 @@ public:
int line = -1; // (0 or -1 for no line number) int line = -1; // (0 or -1 for no line number)
int column = -1; // 0-based starting position for a mark (-1 for no mark) int column = -1; // 0-based starting position for a mark (-1 for no mark)
int offset = -1; int offset = -1;
bool operator<(const TextPosition &other)
{ return line < other.line || (line == other.line && column < other.column); }
}; };
class TextRange class TextRange
@@ -79,6 +82,9 @@ public:
TextPosition begin; TextPosition begin;
TextPosition end; TextPosition end;
bool operator<(const TextRange &other)
{ return begin < other.begin; }
}; };
} // namespace Search } // namespace Search