blob: 3d7b5d3d6efd2f0ef750778a7311a53916ebaf4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include "GameBase.hpp"
#include "PGNGameBase.hpp"
std::shared_ptr<GameBase> 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<GameBase>(new PGNGameBase(dbpath));
}
return nullptr;
}
std::shared_ptr<Game> OpenGameX(const std::string &dbpath, long id){
std::shared_ptr<GameBase> base=OpenDatabase(dbpath);
return base->GetGame(id);
}
|