Scid
4.7.0
|
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? | |
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."
str | the string containing the chars to be escaped. |
pos | start of the substring of str to be processed. |
Definition at line 453 of file pgn_lexer.h.
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.
unescape | if true converts \ to \ and " to ". |
str | the string to be normalized. |
pos | start of the substring of str that will be normalized. |
Definition at line 402 of file pgn_lexer.h.
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.
input | the memory range containing the PGN game. |
parser | will receive the tokens via visitPGN_* functions. Parsing is aborted if it returns false. |
Definition at line 371 of file pgn_lexer.h.
std::size_t pgn::trim | ( | TView & | str | ) |
Trim leading and trailing white spaces.
str | the string to trim. |
Definition at line 470 of file pgn_lexer.h.