[Square] Initial implementation
This commit is contained in:
11
Square.hpp
11
Square.hpp
@@ -11,10 +11,9 @@ public:
|
||||
using Coordinate = unsigned;
|
||||
using Index = unsigned;
|
||||
using Optional = std::optional<Square>;
|
||||
|
||||
static Optional fromCoordinates(Coordinate file, Coordinate rank);
|
||||
static Optional fromIndex(Index index);
|
||||
static Optional fromName(const std::string& name);
|
||||
static Optional fromName(const std::string &name);
|
||||
|
||||
Coordinate file() const;
|
||||
Coordinate rank() const;
|
||||
@@ -32,12 +31,14 @@ public:
|
||||
private:
|
||||
|
||||
Square(Index index);
|
||||
|
||||
Index mIndex;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Square& square);
|
||||
std::ostream &operator<<(std::ostream &os, const Square &square);
|
||||
|
||||
// Necessary to support Square as the key in std::map.
|
||||
bool operator<(const Square& lhs, const Square& rhs);
|
||||
bool operator==(const Square& lhs, const Square& rhs);
|
||||
bool operator<(const Square &lhs, const Square &rhs);
|
||||
bool operator==(const Square &lhs, const Square &rhs);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user