TOMLMap parser startv1

This commit is contained in:
Talyx
2022-01-23 19:39:34 +03:00
parent ccccaf4f3c
commit 1011162680
2 changed files with 10 additions and 8 deletions

View File

@@ -33,7 +33,6 @@ void Server::readConfig(void)
while (it != arr->end())
{
_configs.push_back(new ServerConfig(*it));
std::cout << "biba\n";
++it;
}

View File

@@ -88,32 +88,34 @@ void ServerConfig::setRoot(TOMLMap * data)
int ServerConfig::putBodySizeLimit(toml_node *node)
{
std::cout << TURGUOISE << node << ZERO_C << std::endl;
if (node->get_type() != toml_node::e_type::NUM)
return (1);
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
return (0);
}
int ServerConfig::putErrorPage(toml_node *node)
{
std::cout << TURGUOISE << node << ZERO_C << std::endl;
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
return (0);
}
int ServerConfig::putHost(toml_node *node)
{
std::cout << TURGUOISE << node << ZERO_C << std::endl;
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
return (0);
}
int ServerConfig::putName(toml_node *node)
{
std::cout << TURGUOISE << node << ZERO_C << std::endl;
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
return (0);
}
int ServerConfig::putPort(toml_node *node)
{
std::cout << TURGUOISE << node << ZERO_C << std::endl;
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
return (0);
}
int ServerConfig::putLocation(toml_node *node)
{
std::cout << TURGUOISE << node << ZERO_C << std::endl;
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
return (0);
}
@@ -125,7 +127,7 @@ int ServerConfig::identify(TOMLMap::iterator it)
putErrorPage(it->second);
else if (it->first == "host")
putHost(it->second);
else if (it->first == "loacation")
else if (it->first == "location")
putLocation(it->second);
else if (it->first == "name")
putName(it->second);
@@ -144,6 +146,7 @@ void ServerConfig::fillFields(void)
block = server->begin();
while (block != server->end() && ret == 0)
{
std::cout << GREEN << block->first << ZERO_C << std::endl;
ret = identify(block);
++block;
}