Files
webserv/src/config/parse.cpp
2022-01-08 00:05:08 +03:00

49 lines
835 B
C++

#include "webserv.hpp"
#include <map>
#include <vector>
#include <fstream>
#include <cstdlib>
#include <iostream>
#include <exception>
#include "TOMLNode.hpp"
#include "TOMLParser.hpp"
#include "Tokenizer.hpp"
/* struct location */
/* { */
/* std::string location; */
/* std::string root; */
/* } */
/* class config */
/* { */
/* std::string name; */
/* } */
namespace config
{
void display(TOMLMap *config)
{
std::cout << ">>> printing config: <<<" << std::endl;
TOMLMap::iterator it;
for (it = config->begin(); it != config->end(); ++it)
{
std::cout << it->first
<< ": "
<< *(it->second->toString())
<< std::endl;
}
}
}
void parse(void)
{
std::string filename = "config/simple.toml";
config::TOMLParser parser(filename);
toml_node *root = parser.parse();
config::display(root->getMap());
}