aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-05-12 15:29:04 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-05-12 15:29:04 +0200
commit055410c0e0c1297612ce9677331d012af2226fac (patch)
tree6c3789e5d263ad0eec280ce34cdac392a0313436 /src
parenta6bfdf40d50c58e9d7337fc0047d2708d5c2b506 (diff)
Improve doxygen documentation
Diffstat (limited to 'src')
-rw-r--r--src/Openings.hpp29
-rw-r--r--src/ochess.hpp16
2 files changed, 40 insertions, 5 deletions
diff --git a/src/Openings.hpp b/src/Openings.hpp
index adf05c1..f3dfb6d 100644
--- a/src/Openings.hpp
+++ b/src/Openings.hpp
@@ -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();
}; \ No newline at end of file
diff --git a/src/ochess.hpp b/src/ochess.hpp
index 8366926..a8f96a0 100644
--- a/src/ochess.hpp
+++ b/src/ochess.hpp
@@ -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);