chess-move-interface/src/HalfMove.hpp

50 lines
1.1 KiB
C++
Raw Normal View History

2022-01-26 20:50:24 +01:00
#pragma once
#include "Types.hpp"
2022-01-25 10:53:10 +01:00
#include <sstream>
#include <string>
#include <vector>
namespace pgnp {
/**
* Most members are public for conveniance sake
*/
class HalfMove {
private:
/// @brief Recursive dump
std::string NestedDump(HalfMove *, int);
public:
/// @brief Contains current move count
int count;
/// @brief Is this move for black
bool isBlack;
/// @brief The SAN move
std::string move;
/// @brief Comment associated to the move
std::string comment;
std::string NAG;
2022-01-25 10:53:10 +01:00
/// @brief Next HalfMove link to this line
HalfMove *MainLine;
/// @brief Next HalfMove links to variation of this line
std::vector<HalfMove *> variations;
HalfMove();
~HalfMove();
/// @brief Get number of HalfMove in the MailLine
int GetLength();
/// @brief Dump move and all its variations
std::string Dump();
/// @brief Perform a deep copy of a HalfMove
void Copy(HalfMove *copy);
2022-01-26 20:50:24 +01:00
/// @brief Get HalfMove located x down the MainLine
HalfMove *GetHalfMoveAt(int);
2022-01-25 14:53:34 +01:00
};
struct HalfMoveOutOfRange : public std::exception {
2022-01-26 20:50:24 +01:00
const char *what() const throw() {
return "HalfMove distance is out of range";
}
2022-01-25 10:53:10 +01:00
};
} // namespace pgnp