working map_array parser??

This commit is contained in:
3lswear
2022-01-18 01:51:17 +03:00
parent 9c19e936b6
commit e7470e9124
3 changed files with 170 additions and 65 deletions

View File

@@ -24,27 +24,20 @@
namespace config
{
void display(toml_node *root_node)
void display(TOMLMap *root_map)
{
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 (root_it = root_map_array->begin(); root_it != root_map_array->end(); ++root_it)
for (it = root_map->begin(); it != root_map->end(); ++it)
{
for (it = (*root_it)->begin(); it != (*root_it)->end(); ++it)
{
std::cout << it->first
<< ": "
<< *(it->second->toString())
<< std::endl;
}
std::cout << "-------" << std::endl;
std::cout << it->first
<< ": "
<< *(it->second->toString())
<< std::endl;
}
std::cout << "-------" << std::endl;
}
}
@@ -52,6 +45,6 @@ void parse(void)
{
std::string filename = "config/simple.toml";
config::TOMLParser parser(filename);
toml_node *root = parser.parse();
TOMLMap *root = parser.parse();
config::display(root);
}