#pragma once #include "game_tab/Game.hpp" #include #include /** * @brief Represent the interface that each database type (such as PGNGameBase) must follow * to be accessible in OChess. */ class GameBase { public: virtual std::shared_ptr GetGame(std::uint32_t id) = 0; virtual void Save(std::vector to_delete, std::vector databases_to_import, std::vector> games_to_import) = 0; virtual std::shared_ptr GetCurrentGame() = 0; virtual bool NextGame() = 0; virtual std::string GetTag(std::string tag) = 0; virtual void Reset() = 0; virtual std::string GetFormat() = 0; virtual std::string GetFilePath() = 0; /** * @brief Save the given base into current base format (export) * * @param base */ virtual void Export(std::shared_ptr base) = 0; /** * @brief An additionnal static method is expected with the following signature: * static void CreateDatabaseFile(std::string path); */ }; /** * @brief Open a data * * @param dbpath * @return std::shared_ptr */ std::shared_ptr OpenDatabase(const std::string &dbpath, bool createIfNotExist=true); /** * @brief Single game open * * @param dbpath * @param id * @return std::shared_ptr */ std::shared_ptr OpenGameX(const std::string &dbpath, long id); void SaveGame(const std::string &dbpath, std::shared_ptr g);