Improve database management

This commit is contained in:
Loic Guegan 2022-12-26 19:20:36 +01:00
parent 5c8334af1d
commit 5691b7b30f
5 changed files with 26 additions and 1 deletions

View file

@ -22,4 +22,9 @@ public:
* @param base
*/
virtual void Export(std::shared_ptr<GameBase> base) = 0;
/**
* @brief An additionnal static method is expected with the following signature:
* static void CreateDatabaseFile(std::string path);
*/
};

View file

@ -28,6 +28,11 @@ std::string PGNGameBase::GetTag(std::string tag) {
return ("");
}
void PGNGameBase::CreateDatabaseFile(std::string path){
wxFile empty_pgn(path, wxFile::write);
empty_pgn.Close();
}
std::shared_ptr<Game> PGNGameBase::GetCurrentGame() {
pgnp::HalfMove *pgnp_moves = new pgnp::HalfMove();
pgn->GetMoves(pgnp_moves);

View file

@ -22,4 +22,5 @@ public:
std::string GetFilePath() {return(file);};
static std::string GetMovesPGN(HalfMove *m, bool needDots);
static std::string GetPGN(std::shared_ptr<Game> g);
static void CreateDatabaseFile(std::string path);
};