mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
49 lines
835 B
C++
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());
|
|
}
|