aboutsummaryrefslogtreecommitdiff
path: root/src/pgnp.hpp
blob: 25e74c81146e20d5e055a2ca4159ef9548eaa2dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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";
        }
    };

}