#include "GameBase.hpp" #include "PGNGameBase.hpp" std::shared_ptr OpenDatabase(const std::string &dbpath, bool createIfNotExist){ wxFileName file(dbpath); wxString ext = file.GetExt().Lower(); bool create=(createIfNotExist && !file.Exists()); if (ext == "pgn") { if(create) PGNGameBase::CreateDatabaseFile(dbpath); return std::shared_ptr(new PGNGameBase(dbpath)); } return nullptr; } std::shared_ptr OpenGameX(const std::string &dbpath, long id){ std::shared_ptr base=OpenDatabase(dbpath); return base->GetGame(id); }