Improve doxygen documentation

This commit is contained in:
Loic Guegan 2023-05-12 15:29:04 +02:00
parent a6bfdf40d5
commit 055410c0e0
6 changed files with 85 additions and 9 deletions

View file

@ -8,14 +8,41 @@
* See: https://github.com/lichess-org/chess-openings
*/
class Openings {
typedef std::vector<std::string> MoveList;
/// @brief Loaded tsv data format as a vector of tuples (<eco>,<name>,<pgn-moves-list>)
typedef std::vector<std::tuple<std::string,std::string,std::string>> Volume;
Volume A,B,C,D,E;
/**
* @brief Search opening name an ECO code based on the given \a moves
*
* @param moves Half moves that you want to search for the opening
* @param name Fill by the method if opening is found
* @param eco Fill by the method if opening is found
*/
void SearchOpening(const pgnp::HalfMove *moves,std::string &name, std::string &eco);
/**
* @brief Load a volume using tsv data (see openings.hpp)
*
* @param tsv data to load
* @param vol volume in which the data will be loaded
*/
void LoadVolume(const std::string &tsv, Volume *vol);
public:
/**
* @brief Guess the opening based on a list of SAN moves (PGN)
*
* @param SANMoves
* @param name
* @param eco
*/
void GuessOpening(const std::string &SANMoves, std::string &name, std::string &eco);
/**
* @brief Guess the opening based on a half moves (wrapper around ::SearchOpening)
*
* @param moves
* @param name
* @param eco
*/
void GuessOpening(const pgnp::HalfMove *moves, std::string &name, std::string &eco);
Openings();
};

View file

@ -41,17 +41,19 @@
class Game;
class GameBase;
/**
* @brief Attach informations to the application tabs
* @brief Used by each tab of the GUI to attach informations additional informations and features
*
*/
class TabInfos {
/// @brief Keep track of the number of opened tabs
static long tab_count;
public:
/// @brief Which type of tab is it?
typedef enum Type { GAME, BASE, ENGINE, NONE } Type;
Type type;
/// @brief Each tab has an associated unique id
long id;
/// @brief Specify to which tab id this tab is linked (e.g: database to linked to game tab)
/// @brief Specify to which tab id this tab is linked (e.g: database to linked to on of its opened game tab)
long linked_id;
/// @brief Set to true if this tab is attach to another one (c.f linked_id)
bool is_linked;
@ -60,8 +62,9 @@ public:
TabInfos(Type type_) : type(type_), id(tab_count), is_linked(false), is_dirty(false) { tab_count++; }
void Link(TabInfos *tab);
virtual void Refresh(){};
/// @brief Call when tab is linked to another one
/// @brief Callback that is called when the current tab is linked to another one
virtual void OnLink(){};
/// @brief Can be called to load preferences that have been modify in the application settings
virtual void ApplyPreferences() {};
virtual std::shared_ptr<Game> GetGame() = 0;
virtual std::shared_ptr<GameBase> GetBase() = 0;
@ -78,14 +81,19 @@ public:
Openings Book;
/// @brief Entry point of the application
virtual bool OnInit();
/// @brief Get a list of all the tabs opened in OChess
std::vector<TabInfos *> ListTabInfos();
/// @brief Trigger a wxWidget focus event on a specific tab
void FocusOnTab(TabInfos *);
/// @brief Open a new game tab linked to @a tabsrc that uses game @a g
void NewGame(TabInfos *tabsrc,std::shared_ptr<Game> g);
/// @brief Open a new game that uses game @a g
void NewGame(std::shared_ptr<Game> g);
/// @brief Singleton to get the opening book (see Openings)
Openings& GetBook();
};
wxDECLARE_APP(MyApp);
///@brief Abort ochess with a message
///@brief Abort OChess with a message
void Abort(std::string msg);