File indexing completed on 2024-05-12 04:04:14

0001 /*
0002     This file is part of Knights, a chess board for KDE SC 4.
0003     SPDX-FileCopyrightText: 2009, 2010, 2011 Miha Čančula <miha@noughmad.eu>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef KNIGHTS_POS_H
0009 #define KNIGHTS_POS_H
0010 
0011 #include <QPair>
0012 #include <QChar>
0013 namespace Knights {
0014 
0015 class Pos : public QPair<int, int> {
0016 public:
0017     Pos();
0018     Pos ( const int& t1, const int& t2 );
0019     explicit Pos (const QString &);
0020     ~Pos();
0021 
0022     static QChar row ( int num );
0023     static int numFromRow ( const QChar& row );
0024 
0025     QString string() const;
0026     bool isValid() const;
0027 
0028     const Pos& operator+= ( const Pos& other );
0029 
0030 private:
0031     static const QString rowNames;
0032 };
0033 
0034 Pos operator+ ( const Pos& one, const Pos& other );
0035 Pos operator- ( const Pos& one, const Pos& other );
0036 Pos operator* ( int m, const Pos& other );
0037 Pos operator/ ( const Pos& other, int m );
0038 }
0039 QDebug operator<< ( QDebug debug, const Knights::Pos &pos );
0040 
0041 #endif // KNIGHTS_POS_H