TOMLMap parser start

This commit is contained in:
Talyx
2022-01-23 17:37:50 +03:00
parent 9f0537c65e
commit deeed5de4f
4 changed files with 95 additions and 38 deletions

View File

@@ -2,6 +2,7 @@
#define SERVERCONFIG_HPP
#include "webserv.hpp"
#include "parse.hpp"
struct location
{
@@ -17,8 +18,10 @@ struct location
class ServerConfig
{
public:
int ret;
private:
// TOMLMap *_root;
TOMLMap *server;
std::string _serverName;
std::string _host;
int _port;
@@ -34,7 +37,7 @@ public:
void setClientBodySize(int);
void setErrorPages(std::map<int, std::string>);
void setLocations(std::vector<location>);
// void setRoot(TOMLMap *);
void setRoot(TOMLMap *);
std::string getServerName(void);
std::string getHost(void);
@@ -42,12 +45,21 @@ public:
int getClientBodySize(void);
std::vector<location> getLocations(void);
std::map<int, std::string> getErrorPages(void);
// TOMLMap *getRoot(void);
TOMLMap *getRoot(void);
public:
ServerConfig();
// ServerConfig(TOMLMap *root);
ServerConfig(TOMLMap *root);
private:
int identify(TOMLMap::iterator it);
int putBodySizeLimit(toml_node *);
int putErrorPage(toml_node *);
int putHost(toml_node *);
int putName(toml_node *);
int putPort(toml_node *);
int putLocation(toml_node *);
public:
void fillFields(void);
~ServerConfig();