/ webserv / practice / config / saved2 / JsonParser.hpp
JsonParser.hpp
 1  #ifndef __JSONPARSER_HPP__
 2  #define __JSONPARSER_HPP__
 3  
 4  #include <fstream>
 5  #include <iostream>
 6  #include <string>
 7  #include <cassert>
 8  
 9  #include "JsonData.hpp"
10  
11  class JsonParser
12  {
13  	private:
14  		JsonData*	_json;
15  
16  	public:
17  		JsonParser(void);
18  		~JsonParser(void);
19  
20  	public:
21  		JsonData*	getJson(void);
22  
23  	public:
24  		void								readFile(
25  												std::string const& filepath,
26  												std::string& output
27  											);
28  		std::pair<std::string, JsonData>	retriveKeyValuePair(
29  												std::string const& text,
30  												std::string::iterator& it
31  											);
32  		std::vector<JsonData>				parseArray(
33  												std::string const& text,
34  												std::string::iterator& it
35  											);
36  		JsonData							parseObject(
37  												std::string const& text,
38  												std::string::iterator& it
39  											);
40  		JsonData							parseJson(
41  												std::string const& filepath
42  											);
43  };
44  
45  #endif	/* __JSONPARSER_HPP__ */