mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Update BaseTab implementation
This commit is contained in:
parent
bdfc577a3b
commit
32a0b3e31f
7 changed files with 56 additions and 12 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
#include "BaseTab.hpp"
|
||||||
|
#include <wx/filename.h>
|
||||||
|
|
||||||
|
BaseTab::BaseTab(wxFrame *parent)
|
||||||
|
: BasePanelBF(parent), TabInfos(TabInfos::BASE), base(NULL) {
|
||||||
|
LoadFile("/home/loic/text.PGn");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTab::ApplyPreferences() {}
|
||||||
|
|
||||||
|
void BaseTab::LoadFile(std::string path) {
|
||||||
|
wxFileName file(path);
|
||||||
|
wxString ext = file.GetExt().Lower();
|
||||||
|
if (ext == "pgn") {
|
||||||
|
base = new PGNGameBase(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base != NULL) {
|
||||||
|
while(base->HasNextGame()){
|
||||||
|
Game *g=base->GetNextGame();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,13 @@
|
||||||
|
|
||||||
|
#include "ochess.hpp"
|
||||||
#include "BasePanelBF.h"
|
#include "BasePanelBF.h"
|
||||||
|
#include "gamebase/GameBase.hpp"
|
||||||
|
#include "gamebase/PGNGameBase.hpp"
|
||||||
|
|
||||||
class BaseTab : public BasePanelBF, public TabInfos {
|
class BaseTab : public BasePanelBF, public TabInfos {
|
||||||
|
GameBase *base;
|
||||||
public:
|
public:
|
||||||
BaseTab(wxFrame *parent) : BasePanelBF(parent),TabInfos(TabInfos::BASE) {}
|
BaseTab(wxFrame *parent);
|
||||||
void ApplyPreferences(){
|
void ApplyPreferences();
|
||||||
|
void LoadFile(std::string path);
|
||||||
}
|
|
||||||
};
|
};
|
|
@ -1 +0,0 @@
|
||||||
#include "GameBase.hpp"
|
|
|
@ -1,5 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class GameBase {
|
|
||||||
|
|
||||||
};
|
|
10
src/base_tab/gamebase/GameBase.hpp
Normal file
10
src/base_tab/gamebase/GameBase.hpp
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
#include "game_tab/Game.hpp"
|
||||||
|
|
||||||
|
class GameBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual bool HasNextGame() = 0;
|
||||||
|
virtual Game *GetGame(std::uint32_t id) = 0;
|
||||||
|
virtual Game *GetNextGame() = 0;
|
||||||
|
};
|
5
src/base_tab/gamebase/PGNGameBase.cpp
Normal file
5
src/base_tab/gamebase/PGNGameBase.cpp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#include "PGNGameBase.hpp"
|
||||||
|
|
||||||
|
PGNGameBase::PGNGameBase(std::string pgn_file) {
|
||||||
|
|
||||||
|
}
|
10
src/base_tab/gamebase/PGNGameBase.hpp
Normal file
10
src/base_tab/gamebase/PGNGameBase.hpp
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include "GameBase.hpp"
|
||||||
|
|
||||||
|
class PGNGameBase : public GameBase {
|
||||||
|
public:
|
||||||
|
PGNGameBase(std::string pgn_file);
|
||||||
|
|
||||||
|
bool HasNextGame() { return (false); }
|
||||||
|
Game *GetGame(std::uint32_t id) { return (new Game()); };
|
||||||
|
Game *GetNextGame() { return (new Game()); };
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue