Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
pgnmove.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: pgnmove.h
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#if !defined(PGNMOVE_H)
9#define PGNMOVE_H
10
11/**
12 * PgnMove is for user-interface only
13 */
14class bPgnMove {
15public:
16 explicit bPgnMove(bPgnMove const& pm) noexcept
17 : m_move{pm.m_move}
18 , m_evalstr{pm.m_evalstr}
19 {}
20 explicit bPgnMove(bPgnMove&& pm) noexcept
21 : m_move{std::move(pm.m_move)}
22 , m_evalstr{std::move(pm.m_evalstr)}
23 {}
24 explicit bPgnMove(bBoard const& b, bmove_t const bmt);
26 {}
27
28 // no copy or move ctor nor assignment defined
29 bPgnMove& operator=(bPgnMove const&) = delete;
31
32 inline bool operator==(std::string const& rhs) const
33 { return m_move == rhs; }
34
35 inline std::string const& getMoveEvalStr() const
36 { return m_evalstr; }
37
38 inline operator std::string() const
39 { return m_move; }
40
41private:
42 void ctor(bBoard const& b, bMove const& m); /// embedded base constructor
43
44 friend std::ostream& operator<<(std::ostream& os, bPgnMove const& m)
45 { os << m.m_move;
46 return os;
47 }
48
49 std::string const getPromotionDecorationStr(ppiece_t const piece) const;
50
51 std::string m_move;
52 std::string m_evalstr;
53};
54
55//-----------------------------------------------------------------------
56
58public:
60 : m_pmoves{}
61 {}
62 explicit bPgnMoveList(bBoard const& b);
64 { m_pmoves.clear();
65 }
66
67private:
68 friend std::ostream& operator<<(std::ostream& os, bPgnMoveList const& mpl);
69
70private:
71 std::vector<bPgnMove> m_pmoves;
72};
73
74#endif // defined PGNMOVE_H
75
76// eof
uint32_t bmove_t
Definition belofte.h:98
board
Definition board.h:45
Definition move.h:13
bPgnMove & operator=(bPgnMove &&)=delete
bool operator==(std::string const &rhs) const
Definition pgnmove.h:32
std::string const & getMoveEvalStr() const
Definition pgnmove.h:35
bPgnMove(bPgnMove &&pm) noexcept
Definition pgnmove.h:20
~bPgnMove()
Definition pgnmove.h:25
bPgnMove(bPgnMove const &pm) noexcept
Definition pgnmove.h:16
friend std::ostream & operator<<(std::ostream &os, bPgnMove const &m)
embedded base constructor
Definition pgnmove.h:44
bPgnMove & operator=(bPgnMove const &)=delete
friend std::ostream & operator<<(std::ostream &os, bPgnMoveList const &mpl)
Definition pgnmove.cpp:144
~bPgnMoveList()
Definition pgnmove.h:63
enum tPPiece ppiece_t
Definition piece.h:52