HooverChessUtils_PgnReader 0.9.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
hoover_chess_utils::pgn_reader::PgnParser_NullActions Class Reference

PGN parser null semantic actions. This is useful only for testing and documentation purposes. More...

#include <pgnparser.h>

Public Member Functions

void gameStart ()
 Called on game start before anything else.
 
void pgnTag (const std::string_view &key, const std::string_view &value)
 Called on PGN tag pair.
 
void moveTextSection ()
 Called between the end of the tag pair section and the beginning of the move text section.
 
void comment (const std::string_view &str)
 Called on comment.
 
void nag (std::uint8_t nagNum)
 Called on numeric annotation glyph.
 
void moveNum (std::uint32_t moveNum)
 Called on move number.
 
void movePawn (SquareSet srcMask, Square dst)
 Pawn advancing move (non-promoting)
 
void movePawnCapture (SquareSet srcMask, Square dst)
 Pawn capturing move (non-promoting)
 
void movePawnPromo (SquareSet srcMask, Square dst, Piece promo)
 Pawn advancing move (promoting)
 
void movePawnPromoCapture (SquareSet srcMask, Square dst, Piece promo)
 Pawn capturing move (promoting)
 
void moveKnight (SquareSet srcMask, Square dst, bool capture)
 Knight move.
 
void moveBishop (SquareSet srcMask, Square dst, bool capture)
 Bishop move.
 
void moveRook (SquareSet srcMask, Square dst, bool capture)
 Rook move.
 
void moveQueen (SquareSet srcMask, Square dst, bool capture)
 Queen move.
 
void moveKing (SquareSet srcMask, Square dst, bool capture)
 King move.
 
void moveShortCastle ()
 Short castling move.
 
void moveLongCastle ()
 Long castling move.
 
void variationStart ()
 Beginning of a recursive annotation variation (RAV)
 
void variationEnd ()
 End of a recursive annotation variation (RAV)
 
void gameTerminated (PgnResult result)
 Called on game end.
 
void endOfPGN ()
 Called at the end of the PGN after everything else.
 

Detailed Description

PGN parser null semantic actions. This is useful only for testing and documentation purposes.

The overall sequence of the callbacks is as follows:

  1. gameStart() – invoked at the beginning of each game
  2. pgnTag() – invoked once per PGN tag pair
    • Any number of comments may precede a PGN tag pair
    • Escapes of tag pair values are processed before the callback is invoked
  3. moveTextSection() – after PGN tag section and before the first move
    • Note that the any comments between the last PGN tag and the first move are deferred after this callback
  4. Move numbers, moves, NAGs, comments, variations
  5. gameTerminated() – game end with a result. No other callbacks related to the game can occur.
  6. endOfPGN() – invoked at the end of the PGN file
  7. Possible trailing comments

Member Function Documentation

◆ comment()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::comment ( const std::string_view &  str)
inline

Called on comment.

Parameters
[in]strComment string. May be multiline string for multiline block comments.
Remarks
On ordering of comments and other callbacks:
  • PGN comments before the first PGN tag pair: callbacks after gameStart().
  • PGN comments between the last PGN tag pair and the first move: callbacks after moveTextSection().
  • PGN comments after game termination marker (game result):

◆ endOfPGN()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::endOfPGN ( )
inline

Called at the end of the PGN after everything else.

◆ gameStart()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::gameStart ( )
inline

Called on game start before anything else.

◆ gameTerminated()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::gameTerminated ( PgnResult  result)
inline

Called on game end.

Parameters
[in]resultResult of the game

◆ moveBishop()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveBishop ( SquareSet  srcMask,
Square  dst,
bool  capture 
)
inline

Bishop move.

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]captureWhether the move is a capture
Remarks

◆ moveKing()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveKing ( SquareSet  srcMask,
Square  dst,
bool  capture 
)
inline

King move.

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]captureWhether the move is a capture
Remarks

◆ moveKnight()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveKnight ( SquareSet  srcMask,
Square  dst,
bool  capture 
)
inline

Knight move.

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]captureWhether the move is a capture
Remarks

◆ moveLongCastle()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveLongCastle ( )
inline

Long castling move.

◆ moveNum()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveNum ( std::uint32_t  moveNum)
inline

Called on move number.

Parameters
[in]moveNumMove number
Remarks
There is no white/black indication in the PGN import format, as the periods after the move number are ignored.

◆ movePawn()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawn ( SquareSet  srcMask,
Square  dst 
)
inline

Pawn advancing move (non-promoting)

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
Remarks

◆ movePawnCapture()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawnCapture ( SquareSet  srcMask,
Square  dst 
)
inline

Pawn capturing move (non-promoting)

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
Remarks

◆ movePawnPromo()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawnPromo ( SquareSet  srcMask,
Square  dst,
Piece  promo 
)
inline

Pawn advancing move (promoting)

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]promoPromotion piece
Remarks

◆ movePawnPromoCapture()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::movePawnPromoCapture ( SquareSet  srcMask,
Square  dst,
Piece  promo 
)
inline

Pawn capturing move (promoting)

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]promoPromotion piece
Remarks

◆ moveQueen()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveQueen ( SquareSet  srcMask,
Square  dst,
bool  capture 
)
inline

Queen move.

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]captureWhether the move is a capture
Remarks

◆ moveRook()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveRook ( SquareSet  srcMask,
Square  dst,
bool  capture 
)
inline

Rook move.

Parameters
[in]srcMaskSet of allowed squares as specified by the move
[in]dstDestination square
[in]captureWhether the move is a capture
Remarks

◆ moveShortCastle()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveShortCastle ( )
inline

Short castling move.

◆ moveTextSection()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::moveTextSection ( )
inline

Called between the end of the tag pair section and the beginning of the move text section.

◆ nag()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::nag ( std::uint8_t  nagNum)
inline

Called on numeric annotation glyph.

Parameters
[in]nagNumGlyph number
See also
https://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#c10

◆ pgnTag()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::pgnTag ( const std::string_view &  key,
const std::string_view &  value 
)
inline

Called on PGN tag pair.

Parameters
[in]keyPGN tag key
[in]valuePGN tag value (escapes processed)

◆ variationEnd()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::variationEnd ( )
inline

End of a recursive annotation variation (RAV)

◆ variationStart()

void hoover_chess_utils::pgn_reader::PgnParser_NullActions::variationStart ( )
inline

Beginning of a recursive annotation variation (RAV)


The documentation for this class was generated from the following file: