Cute Chess 0.1
square.h
1/*
2 This file is part of Cute Chess.
3 Copyright (C) 2008-2018 Cute Chess authors
4
5 Cute Chess is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Cute Chess is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef SQUARE_H
20#define SQUARE_H
21
22#include <QString>
23
24namespace Chess {
25
33class LIB_EXPORT Square
34{
35 public:
37 enum Color
38 {
42 };
43
45 Square();
47 Square(int file, int rank);
48
50 bool operator==(const Square& other) const;
52 bool operator!=(const Square& other) const;
53
55 bool isValid() const;
56
58 int file() const;
60 int rank() const;
62 Color color() const;
63
65 void setFile(int file);
67 void setRank(int rank);
68
69 private:
70 int m_file;
71 int m_rank;
72};
73
74} // namespace Chess
75#endif // SQUARE_H
A generic chess square type consisting of a file and a rank.
Definition square.h:34
Square()
Definition square.cpp:24
Color
Definition square.h:38
@ NoColor
Color for invalid squares.
Definition square.h:41
@ Light
Light-colored square.
Definition square.h:39
@ Dark
Dark-colored square.
Definition square.h:40