#include "pgnp.hpp" #include #define IS_BLANK(c) (c==' ' || c=='\n' || c=='\t') #define IS_EOF(loc) (loc>=pgn_content.size()) #define EOF_CHECK(loc) {if(IS_EOF(loc)) throw UnexpectedEOF();} namespace pgnp { void PGN::FromFile(std::string filepath){ std::ifstream file(filepath); std::string content((std::istreambuf_iterator(file)), std::istreambuf_iterator()); FromString(content); } void PGN::FromString(std::string pgn_content){ this->pgn_content=pgn_content; int loc=0; while(!IS_EOF(loc)) { char c=pgn_content[loc]; if(!IS_BLANK(c)){ switch (c) { case '[': loc=ParseNextTag(loc); break; } } loc++; } /*for (auto const& [key, val] : tags){ std::cout << key <<"="<