The Config Parser looks a lot better, cleaner, made a lot of decisions and added i think everything to the apropriate header files, now working on testing but since new install of Ubuntu testing make on something i expect is working, the main branch, so brb

This commit is contained in:
Me
2022-07-29 22:17:10 +02:00
parent 846c478142
commit 3ff62f5ddc
5 changed files with 152 additions and 91 deletions

View File

@@ -14,6 +14,7 @@
# define CONFIGPARSER_HPP
# include "Webserv.hpp" // easier to just do this?
// add includes properly
// This is gonna be temporary cuz i don't konw if i like it
@@ -44,7 +45,8 @@ public:
// ConfigParser & operator=(const ConfigParser& rhs);
// void parse(); // return void cuz throw exceptions.
std::vector<Server> * parse(); // const?
//std::vector<Server> * parse(); // const?
std::vector<ServerConfig> parse(); // const?
// other parses?
@@ -58,9 +60,20 @@ private:
// should this be in private since it always needs a path?
void _check_proper_line_end(size_t prev, size_t curr); // const?
ServerConfig _parse_server(size_t *start);
LocationConfig _parse_location(size_t *start);
int _check_for_semicolon(std::string line); // const?
void _set_server_values(ServerConfig *server, const std::string key, std::string value);
void _set_location_values(LocationConfig *location, const std::string key, std::string value);
std::string _get_first_word(size_t *curr); // const?
std::string _get_rest_of_line(size_t *curr); // const?
// why static? it's an enum...
static MethodType _str_to_method_type(std::string str);
// just for testing purposes
void _print_content() const;