」 feat: Finished parsing (should be working)

This commit is contained in:
2025-03-26 08:48:33 +01:00
parent dbba3f0668
commit 1f18956cb6
11 changed files with 384 additions and 150 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */
/* Updated: 2025/03/24 10:48:37 by adjoly ### ########.fr */
/* Updated: 2025/03/26 08:31:41 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,31 +33,20 @@ class Route {
private:
bool _dirlist;
bool _cookies;
bool _uploads;
bool _redirect;
int32_t _max_body;
std::string _root;
std::string _upRoot;
std::string _up_root;
std::string _index;
std::map<std::string, std::string> *_cgi;
Logger *_log;
bool _methods[3]; ///> A methods boolean array which correspond to - 0: GET, 1: POST, 2: DELETE
std::map<int, std::string> *_err_pages; ///> An error pages map to map error specified in the config file
toml::ANode *_table;
/**
* @brief Can be used to access a value in the _table(ANode *) of a specific type
*
* @param The name of the value to get
* @param The type of the value to get
*
* @return The value got or not_nullptr
*/
void *accessValue(std::string, toml::nodeType);
bool _methods[3]; ///> A methods boolean array which correspond to - 0: GET,
///1: POST, 2: DELETE
toml::ANode *_table;
/**
* @brief Can be used to parse a table of cgi
@ -66,7 +55,8 @@ class Route {
*
* @return A pointer to a map of cgi
*/
std::map<std::string, std::string> *_parseCGI(std::map<std::string, toml::ANode *> *);
std::map<std::string, std::string> *
_parseCGI(toml::ANode *);
/**
* @brief Can be used to parse a table of error pages
@ -75,19 +65,20 @@ class Route {
*
* @return A pointer to a map of error pages
*/
std::map<int, std::string> *_parseErrPages(std::map<std::string, toml::ANode *> *);
std::map<int, std::string> *
_parseErrPages(std::map<std::string, toml::ANode *> *);
/**
* @brief Can be used to parse a array of methods
*
* @param The table to get the methods from
*/
void _parseMethods(std::vector<toml::ANode *> *);
void _parseMethods(std::vector<toml::ANode *> *);
/**
* @brief Can be used to sed err pages to the default error pages
*/
void _defaultErrPages(void);
void _defaultErrPages(void);
/**
* @brief Can be used to parse a string of a number with a size (ex. 10M)