From bff58bad9225f7784e43fc72e5a73495ede42f1b Mon Sep 17 00:00:00 2001 From: adjoly Date: Mon, 14 Apr 2025 13:37:25 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20remove?= =?UTF-8?q?=20useless=20=5Ftable=20in=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/config/Config.hpp | 3 +-- src/config/Config.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/config/Config.hpp b/includes/config/Config.hpp index a7b2b60..b1bbe47 100644 --- a/includes/config/Config.hpp +++ b/includes/config/Config.hpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/14 12:20:06 by adjoly #+# #+# */ -/* Updated: 2025/04/14 12:55:46 by adjoly ### ########.fr */ +/* Updated: 2025/04/14 13:36:42 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,7 +27,6 @@ class Config { std::vector *getServers(void) { return _servers; } private: - toml::ANode *_table; Logger *_log; std::vector *_servers; }; diff --git a/src/config/Config.cpp b/src/config/Config.cpp index 277313f..35eaec6 100644 --- a/src/config/Config.cpp +++ b/src/config/Config.cpp @@ -6,10 +6,11 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */ -/* Updated: 2025/04/14 13:32:56 by adjoly ### ########.fr */ +/* Updated: 2025/04/14 13:36:46 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ +#include "node/ANode.hpp" #include using namespace webserv::config; @@ -18,23 +19,23 @@ Config::Config(std::string &filename) { toml::Toml *file = new toml::Toml(filename); file->parse(); - _table = file->getParsedFile(); + toml::ANode *table = file->getParsedFile(); bool found = false; - void *logFile = _table->access("log_file", toml::STRING, found); + void *logFile = table->access("log_file", toml::STRING, found); if (found == true && logFile != not_nullptr) { _log = new Logger(*static_cast(logFile)); } else { _log = new Logger(); } - std::map *node = _table->getTable(); + std::map *node = table->getTable(); for (std::map::iterator it = node->begin(); it != node->end(); it++) { Server *srv = new Server(it->second, _log); _servers->push_back(srv); } - delete _table; + delete table; delete file; }