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