2022-12-27 19:41:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-02-24 11:50:16 +01:00
|
|
|
#include "GameBase.hpp"
|
2022-02-24 12:09:21 +01:00
|
|
|
#include "pgnp.hpp"
|
2022-02-24 11:50:16 +01:00
|
|
|
|
2023-05-13 10:43:21 +02:00
|
|
|
/**
|
|
|
|
* @brief Used to open PGN files
|
|
|
|
*
|
|
|
|
*/
|
2022-02-24 11:50:16 +01:00
|
|
|
class PGNGameBase : public GameBase {
|
2022-02-24 15:22:56 +01:00
|
|
|
pgnp::PGN *pgn;
|
|
|
|
bool hasNextGame;
|
|
|
|
std::string file;
|
2022-02-24 12:09:21 +01:00
|
|
|
|
2022-02-24 11:50:16 +01:00
|
|
|
public:
|
|
|
|
PGNGameBase(std::string pgn_file);
|
2022-02-28 18:51:47 +01:00
|
|
|
~PGNGameBase();
|
2022-02-28 20:16:57 +01:00
|
|
|
std::shared_ptr<Game> GetGame(std::uint32_t id);
|
2022-02-24 15:22:56 +01:00
|
|
|
bool NextGame();
|
2022-02-28 20:16:57 +01:00
|
|
|
std::shared_ptr<Game> GetCurrentGame();
|
2022-02-24 15:22:56 +01:00
|
|
|
std::string GetTag(std::string tag);
|
2022-12-26 13:39:33 +01:00
|
|
|
void Save(std::vector<std::uint32_t> to_delete,
|
2022-12-27 15:58:16 +01:00
|
|
|
std::vector<std::string> databases_to_import,
|
2022-12-26 13:39:33 +01:00
|
|
|
std::vector<std::shared_ptr<Game>> games_to_import);
|
2022-02-24 15:22:56 +01:00
|
|
|
void Reset();
|
2022-02-28 20:30:57 +01:00
|
|
|
void Export(std::shared_ptr<GameBase> base);
|
2022-12-26 12:51:48 +01:00
|
|
|
std::string GetFormat() {return("PGN");};
|
|
|
|
std::string GetFilePath() {return(file);};
|
2022-03-01 15:58:02 +01:00
|
|
|
static std::string GetMovesPGN(HalfMove *m, bool needDots);
|
|
|
|
static std::string GetPGN(std::shared_ptr<Game> g);
|
2022-12-26 19:20:36 +01:00
|
|
|
static void CreateDatabaseFile(std::string path);
|
2022-02-24 11:50:16 +01:00
|
|
|
};
|