aboutsummaryrefslogtreecommitdiff
path: root/src/pgnp.hpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-01-23 20:57:28 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-01-23 20:57:28 +0100
commitfd78f92863361a3b25808f2ca988f820f2d35618 (patch)
tree1133469354ae661a9d2f8f40f5009b0ed5c5886f /src/pgnp.hpp
Create project
Diffstat (limited to 'src/pgnp.hpp')
-rw-r--r--src/pgnp.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/pgnp.hpp b/src/pgnp.hpp
new file mode 100644
index 0000000..25e74c8
--- /dev/null
+++ b/src/pgnp.hpp
@@ -0,0 +1,46 @@
+#include <unordered_map>
+#include <string>
+#include <fstream>
+#include <streambuf>
+#include <iostream>
+#include <exception>
+
+namespace pgnp {
+
+
+ typedef struct HalfMove {
+
+ } HalfMove;
+
+
+ class PGN {
+ private:
+ std::unordered_map<std::string,std::string> tags;
+ HalfMove moves;
+ std::string pgn_content;
+
+ public:
+ void FromFile(std::string);
+ void FromString(std::string);
+
+
+ private:
+
+ /// @brief Populate @a tags with by parsing the one starting at location in argument
+ int ParseNextTag(int);
+
+ /// @brief Get the next non-blank char location starting from location in argument
+ int NextNonBlank(int);
+ };
+
+
+
+ struct UnexpectedEOF : public std::exception
+ {
+ const char * what () const throw ()
+ {
+ return "Unexpected end of pgn file";
+ }
+ };
+
+}