Ported ICSAPI.
[tagua.git] / src / hlvariant / chess / san.h
blobdbca9eff5c836177aa1aef77b4b06f97e0545fe0
1 #ifndef HLVARIANT__CHESS__SAN_H
2 #define HLVARIANT__CHESS__SAN_H
4 #include <iostream>
6 #include <QRegExp>
8 #include "export.h"
9 #include "point.h"
11 namespace HLVariant {
12 namespace Chess {
14 class TAGUA_EXPORT SAN {
15 friend std::ostream& operator<<(std::ostream& os, const SAN& move);
17 static QRegExp pattern;
18 static QRegExp kingCastlingPattern;
19 static QRegExp queenCastlingPattern;
20 static QRegExp nonePattern;
22 public:
23 enum CastlingType {
24 NoCastling,
25 KingSide,
26 QueenSide
29 SAN();
31 static int getType(const QString& letter);
33 void load(const QString&, int& offset, int ysize);
34 void load(const QString&, int ysize);
36 Point from, to;
37 int type;
38 int promotion;
39 CastlingType castling;
40 bool drop;
42 inline bool invalid() const { return (to == Point::invalid()) && (castling == NoCastling); }
43 inline bool valid() const { return !invalid(); }
46 } // namespace Chess
47 } // namespace HLVariant
49 #endif // HLVARIANT__CHESS__SAN_H