-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSONParser.h
More file actions
62 lines (47 loc) · 1.18 KB
/
Copy pathJSONParser.h
File metadata and controls
62 lines (47 loc) · 1.18 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef JSONPARSER_H
#define JSONPARSER_H
#include "eraGame.h"
#include "Board.h"
#include <cctype>
#include <utility>
class JSONParser
{
private:
//enum for type tokens, will be needed for further parsing
enum class tokenType
{
error,
eof,
bracketOpen,
bracketClose,
quote,
string,
comma,
colon
};
struct Token
{
tokenType inputTokenType;
std::string inputTokenValue;
};
Token currentToken;
//input to JSONparser, this will be parsed
std::string input;
int parserIndex;
//result pair, output of this JSONparser
std::vector<std::pair<std::string, std::string>> resultPairs;
void getToken(void);
public:
JSONParser() {parserIndex = 0;}
JSONParser(const std::string &chosenInput) {input = chosenInput; parserIndex = 0;}
bool checkIfBinaryString(const std::string &);
bool checkIfFieldString(const std::string &);
bool isTokenString(char tokenString);
bool parse(void);
void setInput(const std::string &);
std::vector<std::pair<std::string, std::string> > getResult(void);
bool getPlacingStone(std::string &);
bool getChosingField(std::string &);
bool getGameStatus(std::string &);
};
#endif