mirror of
https://gitlab.com/manzerbredes/pgnp.git
synced 2025-04-07 02:26:25 +02:00
Update README.md
This commit is contained in:
parent
4f1d7c5247
commit
d4df0dac1d
1 changed files with 18 additions and 8 deletions
26
README.md
26
README.md
|
@ -5,10 +5,13 @@ PGN specification can be found [here](https://www.chessclub.com/help/PGN-spec).
|
||||||
|
|
||||||
# How to use it ?
|
# How to use it ?
|
||||||
PGNP can be used as a shared library in your project.
|
PGNP can be used as a shared library in your project.
|
||||||
You only need to include the header file and linking the .so file to your
|
You only need to include `pgnp.hpp` and linking the .so file to your
|
||||||
executable.
|
executable.
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
|
Somewhere at the beginning of the file:
|
||||||
|
|
||||||
|
#include "pgnp.hpp"
|
||||||
Load PGN from file:
|
Load PGN from file:
|
||||||
|
|
||||||
pgnp::PGN pgn;
|
pgnp::PGN pgn;
|
||||||
|
@ -29,7 +32,7 @@ Load PGN from string:
|
||||||
}
|
}
|
||||||
Various API calls:
|
Various API calls:
|
||||||
|
|
||||||
pgn.HasTag("Round"); // Check if tag exists
|
bool hasRound=pgn.HasTag("Round"); // Check if tag exists
|
||||||
try {
|
try {
|
||||||
pgn.STRCheck(); // Perform a Seven Tag Roster check
|
pgn.STRCheck(); // Perform a Seven Tag Roster check
|
||||||
}
|
}
|
||||||
|
@ -40,11 +43,18 @@ Various API calls:
|
||||||
std::string tagValue=GetTagValue("Date"); // Get the value of a tag
|
std::string tagValue=GetTagValue("Date"); // Get the value of a tag
|
||||||
Access to moves:
|
Access to moves:
|
||||||
|
|
||||||
pgnp::HalfMove *move=new pgnp::HalfMove();
|
pgnp::HalfMove *moves=new pgnp::HalfMove();
|
||||||
pgn.GetMoves(move); // Get the tree of half moves (do not forget to call "delete move")
|
pgn.GetMoves(moves); // Get the tree of half moves (do not forget to call "delete move" later on)
|
||||||
int length=move->GetLength(); // Get the number of half moves in the move MainLine
|
int length=moves->GetLength(); // Get the number of half moves in the move MainLine
|
||||||
// Public members:
|
// Public members:
|
||||||
// move->variations contains variations of the current move
|
// moves->variations contains variations of the current move
|
||||||
// move->isBlack boolean that says if current half move is for the black side
|
// moves->isBlack boolean that says if current half move is for the black side
|
||||||
// Check pgnp.hpp for more infos for other field (comments, count, etc.)
|
// Check pgnp.hpp for more infos for the other fields (comments, count, etc.)
|
||||||
|
|
||||||
|
# CMake Integration
|
||||||
|
By using the `add_subdirectory()` on this repository you will be able to use the following cmake calls in you project:
|
||||||
|
|
||||||
|
include_directories(${PGNP_INCLUDE_DIR})
|
||||||
|
target_link_libraries(<YOUR_TARGET> pgnp)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue