Scid  4.7.0
Functions
pgn Namespace Reference

Functions

template<typename TVisitor >
std::pair< std::size_t, bool > parse_game (pgn_impl::InputMemory input, TVisitor &&parser)
 Read a PGN game from memory, grouping characters in tokens and dispatching them to a PGN parser. More...
 
template<bool unescape = false, typename TString >
std::size_t normalize (TString &str, std::size_t pos)
 Normalize white spaces and converts Latin-1 chars to UTF-8 sequences. More...
 
template<typename TString >
void escape_string (TString &str, std::size_t pos)
 Escape quote and backslash chars according to the PGN standard: "A quote inside a string is represented by the backslash immediately followed by a quote. More...
 
template<typename TView >
std::size_t trim (TView &str)
 Trim leading and trailing white spaces. More...
 
 ChooseColor type name
 
 ConfigMenus ?lang?
 
 PgnClipboardCopy
 
 OpenClose
 
 contextMenu win x y
 
 deleteVar
 
 firstVar
 
 mainVar
 
 ShowBoard win moveTag xc yc
 
 HideBoard
 
 ResetColors
 
 Refresh ?pgnNeedsUpdate?
 

Function Documentation

◆ ChooseColor()

pgn::ChooseColor   type name  

Definition at line 8 of file pgn.tcl.

◆ ConfigMenus()

pgn::ConfigMenus   ?lang?  

Definition at line 16 of file pgn.tcl.

◆ contextMenu()

pgn::contextMenu   win x y  

Definition at line 184 of file pgn.tcl.

◆ deleteVar()

pgn::deleteVar

Definition at line 239 of file pgn.tcl.

◆ escape_string()

template<typename TString >
void pgn::escape_string ( TString &  str,
std::size_t  pos 
)

Escape quote and backslash chars according to the PGN standard: "A quote inside a string is represented by the backslash immediately followed by a quote.

A backslash inside a string is represented by two adjacent backslashes."

Parameters
strthe string containing the chars to be escaped.
posstart of the substring of str to be processed.

Definition at line 453 of file pgn_lexer.h.

◆ firstVar()

pgn::firstVar

Definition at line 245 of file pgn.tcl.

◆ HideBoard()

pgn::HideBoard

Definition at line 307 of file pgn.tcl.

◆ mainVar()

pgn::mainVar

Definition at line 251 of file pgn.tcl.

◆ normalize()

template<bool unescape = false, typename TString >
std::size_t pgn::normalize ( TString &  str,
std::size_t  pos 
)

Normalize white spaces and converts Latin-1 chars to UTF-8 sequences.

The original PGN standard used a subset of ISO 8859/1 (Latin 1): "Code value from 0 to 126 are the standard ASCII character set." "Code value from 127 to 191 are not used for PGN data representation." "Code value from 192 to 255 are mostly alphabetic printing characters with various diacritical marks; their use is encouraged for those languages that require such characters." However this do not allow internationalization for comments and names (players, sites, etc...); the common UTF-8 is a superior alternative.

Parameters
unescapeif true converts \ to \ and " to ".
strthe string to be normalized.
posstart of the substring of str that will be normalized.
Returns
the number of '
' chars in str.

Definition at line 402 of file pgn_lexer.h.

◆ OpenClose()

pgn::OpenClose

Definition at line 62 of file pgn.tcl.

◆ parse_game()

template<typename TVisitor >
std::pair<std::size_t, bool> pgn::parse_game ( pgn_impl::InputMemory  input,
TVisitor &&  parser 
)

Read a PGN game from memory, grouping characters in tokens and dispatching them to a PGN parser.

Parameters
inputthe memory range containing the PGN game.
parserwill receive the tokens via visitPGN_* functions. Parsing is aborted if it returns false.
Returns
a std::pair containing the number of chars parsed, and true if at least a tag-pair token or a symbol token was dispatched.

Definition at line 371 of file pgn_lexer.h.

◆ PgnClipboardCopy()

pgn::PgnClipboardCopy

Definition at line 42 of file pgn.tcl.

◆ Refresh()

pgn::Refresh   ?pgnNeedsUpdate?  

Definition at line 333 of file pgn.tcl.

◆ ResetColors()

pgn::ResetColors

Definition at line 317 of file pgn.tcl.

◆ ShowBoard()

pgn::ShowBoard   win moveTag xc yc  

Definition at line 262 of file pgn.tcl.

◆ trim()

template<typename TView >
std::size_t pgn::trim ( TView &  str)

Trim leading and trailing white spaces.

Parameters
strthe string to trim.
Returns
the number of '
' chars in str.

Definition at line 470 of file pgn_lexer.h.