mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 13:27:59 +03:00
intermediate changes
This commit is contained in:
@@ -23,19 +23,27 @@
|
||||
/* } */
|
||||
namespace config
|
||||
{
|
||||
void display(TOMLMap *config)
|
||||
void display(toml_node *config)
|
||||
{
|
||||
std::cout << ">>> printing config: <<<" << std::endl;
|
||||
if (config->get_type() != toml_node::MAPARRAY)
|
||||
throw std::logic_error("Attempting to display not map_array");
|
||||
|
||||
TOMLMapArray *root_map_array = config->getMapArray();
|
||||
TOMLMapArray::iterator root_it;
|
||||
TOMLMap::iterator it;
|
||||
for (it = config->begin(); it != config->end(); ++it)
|
||||
{
|
||||
std::cout << it->first
|
||||
<< ": "
|
||||
<< *(it->second->toString())
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
for (root_it = root_map_array->begin(); root_it != root_map_array->end(); ++root_it)
|
||||
{
|
||||
for (it = (*root_it)->begin(); it != (*root_it)->end(); ++it)
|
||||
{
|
||||
std::cout << it->first
|
||||
<< ": "
|
||||
<< *(it->second->toString())
|
||||
<< std::endl;
|
||||
}
|
||||
std::cout << "-------" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,5 +52,5 @@ void parse(void)
|
||||
std::string filename = "config/simple.toml";
|
||||
config::TOMLParser parser(filename);
|
||||
toml_node *root = parser.parse();
|
||||
config::display(root->getMap());
|
||||
config::display(root);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user