Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
pgn_move_string.h
Go to the documentation of this file.
1#ifndef PGN_MOVE_STRING_H
2#define PGN_MOVE_STRING_H
3
4#include "square.h"
5#include "piece_type.h"
6
7#include <optional>
8#include <string>
9//#include <vector>
10
16{
17public:
18 pgn_move_string(const std::string& pgn_str = "");
19
20 const auto& get() const noexcept { return m_pgn_str; }
21
22private:
23 std::string m_pgn_str;
24};
25
29std::optional<piece_type> get_piece_type(const pgn_move_string& pgn_str);
30
36std::optional<square> get_square(const pgn_move_string& pgn_str);
37
40std::optional<piece_type> get_promotion_type(const pgn_move_string& pgn_str);
41
47std::optional<square> get_to(const pgn_move_string& pgn_str);
48
49
52std::vector<chess_color> get_winner(const pgn_move_string& pgn_str);
53
56bool is_capture(const pgn_move_string& pgn_str);
57
59
60bool operator==(const pgn_move_string& lhs, const pgn_move_string& rhs) noexcept;
61
62std::ostream& operator<<(std::ostream& os, const pgn_move_string& s) noexcept;
63
64#endif // PGN_MOVE_STRING_H
A string that is a PGN notation string.
Definition pgn_move_string.h:16
const auto & get() const noexcept
Definition pgn_move_string.h:20
std::optional< square > get_square(const pgn_move_string &pgn_str)
Get the square from a string, if any.
Definition pgn_move_string.cpp:43
std::ostream & operator<<(std::ostream &os, const pgn_move_string &s) noexcept
Definition pgn_move_string.cpp:121
std::optional< piece_type > get_piece_type(const pgn_move_string &pgn_str)
Get a piece type for a string, if any.
Definition pgn_move_string.cpp:13
bool operator==(const pgn_move_string &lhs, const pgn_move_string &rhs) noexcept
Definition pgn_move_string.cpp:116
std::optional< piece_type > get_promotion_type(const pgn_move_string &pgn_str)
Get the type the piece is promoted to.
Definition pgn_move_string.cpp:31
std::optional< square > get_to(const pgn_move_string &pgn_str)
Get the square a piece is moving to, if any.
Definition pgn_move_string.cpp:55
std::vector< chess_color > get_winner(const pgn_move_string &pgn_str)
Get the winner from a notation.
Definition pgn_move_string.cpp:60
void test_pgn_move_string()
Definition pgn_move_string.cpp:69
bool is_capture(const pgn_move_string &pgn_str)
Conclude if the move is a capture from a PGN string E.g.
Definition chess_move.cpp:53