aboutsummaryrefslogtreecommitdiff
path: root/src/pgnp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pgnp.hpp')
-rw-r--r--src/pgnp.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pgnp.hpp b/src/pgnp.hpp
index a89de73..0e9c7a5 100644
--- a/src/pgnp.hpp
+++ b/src/pgnp.hpp
@@ -2,6 +2,7 @@
#include <exception>
#include <fstream>
#include <iostream>
+#include <sstream>
#include <streambuf>
#include <string>
#include <unordered_map>
@@ -24,6 +25,7 @@ public:
HalfMove();
~HalfMove();
+ /// @brief Get number of HalfMove in the MailLine
int GetLength();
/// @brief Dump move and all its variations
void Dump();
@@ -66,6 +68,21 @@ struct UnexpectedEOF : public std::exception {
const char *what() const throw() { return "Unexpected end of pgn file"; }
};
+struct InvalidTagName : public std::exception {
+ const char *what() const throw() { return "Invalid tag name"; }
+};
+
+struct UnexpectedCharacter : public std::exception {
+ std::string msg;
+ UnexpectedCharacter(char actual, char required, int loc) {
+ std::stringstream ss;
+ ss << "Expected \'" << required << "\' at location " << loc
+ << " but read \'" << actual << "\'";
+ msg = ss.str();
+ }
+ const char *what() const throw() { return msg.c_str(); }
+};
+
struct STRCheckFailed : public std::exception {
const char *what() const throw() {
return "Seven Tag Roster compliance check failed";