OChess v0.0.2
Programmer's Manual
GameBase.hpp
1#pragma once
2#include "game_tab/Game.hpp"
3#include <algorithm>
4#include <vector>
5
10class GameBase {
11
12public:
13 virtual std::shared_ptr<Game> GetGame(std::uint32_t id) = 0;
14 virtual void Save(std::vector<std::uint32_t> to_delete,
15 std::vector<std::string> databases_to_import,
16 std::vector<std::shared_ptr<Game>> games_to_import) = 0;
17 virtual std::shared_ptr<Game> GetCurrentGame() = 0;
18 virtual bool NextGame() = 0;
19 virtual std::string GetTag(std::string tag) = 0;
20 virtual void Reset() = 0;
21 virtual std::string GetFormat() = 0;
22 virtual std::string GetFilePath() = 0;
28 virtual void Export(std::shared_ptr<GameBase> base) = 0;
29
34};
35
42std::shared_ptr<GameBase> OpenDatabase(const std::string &dbpath, bool createIfNotExist=true);
50std::shared_ptr<Game> OpenGameX(const std::string &dbpath, long id);
57void SaveGame(const std::string &dbpath, std::shared_ptr<Game> g);
Represent the interface that each database type (such as PGNGameBase) must follow to be accessible in...
Definition: GameBase.hpp:10
virtual void Export(std::shared_ptr< GameBase > base)=0
Save the given base into current base format (export)