aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-01-26 21:31:40 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-01-26 21:31:40 +0100
commit92350c7cc996d52046906d89a45b67c2a64b1945 (patch)
treeba20d299be17cc3147ceea93549e6940291594a1
parentbd98bcb93196c8fab6a2d6a797d85fc37c16b7ea (diff)
Update readme
-rw-r--r--README.md30
1 files changed, 10 insertions, 20 deletions
diff --git a/README.md b/README.md
index 2de279d..e1717a0 100644
--- a/README.md
+++ b/README.md
@@ -8,8 +8,8 @@ PGN specification can be found [here](https://www.chessclub.com/help/PGN-spec).
# Features
- Basic PGN parsing (tags, move, comments, variations, NAG, etc.)
-- Merged PGN files parsing (several games in one file)
-- Handle very large file (max is 2^(sizeof(unsigned long long)*8) bytes)
+- Parse PGN files that contains multiple games
+- Handle very large files: up to 2^(sizeof(unsigned long long)*8) bytes
- Efficiency
# How to use it ?
@@ -21,21 +21,11 @@ executable.
Somewhere at the beginning of the file:
#include "pgnp.hpp"
-Load PGN from file:
+Load PGN from file/string:
pgnp::PGN pgn;
try {
- pgn.FromFile("pgn.txt");
- pgn.ParseNextGame();
- }
- catch(...){
- // Handle exceptions
- }
-Load PGN from string:
-
- pgnp::PGN pgn;
- pgn.FromString("YOUR PGN CONTENT HERE");
- try {
+ pgn.FromFile("pgn.txt"); // Or pgn.FromString("YOUR PGN CONTENT HERE");
pgn.ParseNextGame();
}
catch(...){
@@ -43,27 +33,27 @@ Load PGN from string:
}
Various API calls:
- bool hasRound=pgn.HasTag("Round"); // Check if tag exists
+ bool hasRound=pgn.HasTag("Round"); // Check if a tag exists
try {
pgn.STRCheck(); // Perform a Seven Tag Roster check
}
catch(...){
// Handle exceptions
}
- std::vector<std::string> tags=pgn.GetTagList(); // Get a list of tags
- std::string tagValue=GetTagValue("Date"); // Get the value of a tag
+ std::vector<std::string> tags=pgn.GetTagList(); // Get the list of tags in current game
+ std::string tagValue=GetTagValue("Date"); // Get the value of a tag in current game
Access to moves:
pgnp::HalfMove *moves=new pgnp::HalfMove();
- pgn.GetMoves(moves); // Get the tree of half moves (do not forget to call "delete move" later on)
- int length=moves->GetLength(); // Get the number of half moves in the move MainLine
+ pgn.GetMoves(moves); // Get the tree of half moves
+ int length=moves->GetLength(); // Get the number of half move in the current MainLine
// Public members:
// moves->variations contains variations of the current move
// moves->isBlack boolean that says if current half move is for the black side
// 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:
+By using the `add_subdirectory()` directive on this repository, you will be able to use the following cmake calls in your project:
include_directories(${PGNP_INCLUDE_DIR})
target_link_libraries(<YOUR_TARGET> pgnp)