Fixed the includes

This commit is contained in:
Me
2022-07-31 16:53:22 +02:00
parent d4a001e8ba
commit 19f7493aac
8 changed files with 36 additions and 41 deletions

View File

@@ -240,7 +240,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
else
{
std::vector<std::string> tmp2 = ::split(tmp_val[0], ':');
if (!(isNumeric(tmp2[1])))
if (!(::isNumeric(tmp2[1])))
throw std::invalid_argument("value not a number");
// not sure if this is what we want, means there's only 1 host per
@@ -262,7 +262,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
else if (key == "client_body_limit" && size == 1)
{
//std::cout << "made it\n";
if (!(isNumeric(tmp_val[0])))
if (!(::isNumeric(tmp_val[0])))
throw std::invalid_argument("value not a number");
server->client_body_limit = atoi(tmp_val[0].c_str());
}
@@ -299,7 +299,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
if (tmp_val.size() != 2)
throw std::invalid_argument("wrong number of values");
// and tmp_val[0] should be a number and tmp_val[1] a string?
if (!(isNumeric(tmp_val[0])))
if (!(::isNumeric(tmp_val[0])))
throw std::invalid_argument("value not a number");
// something about using access() to see if

View File

@@ -13,26 +13,19 @@
#ifndef CONFIGPARSER_HPP
# define CONFIGPARSER_HPP
# include "Webserv.hpp" // easier to just do this?
# include "ServerConfig.hpp"
// add includes properly
# include "LocationConfig.hpp"
# include "MethodType.hpp"
# include "utils.hpp"
// This is gonna be temporary cuz i don't konw if i like it
#define MAX_REQUEST_SIZE 2048
#define MAX_URI_SIZE 64
#define BSIZE 1024
/*
// this can't be here...
enum MethodType
{
GET,
POST,
DELETE,
INVALID,
};
*/
# include <map>
# include <vector>
# include <exception> // exception, what
# include <stdexcept> // runtime_error, invalid_argument
# include <string> // string
# include <cstdlib> // atoi (athough it's already cover by <string>)
# include <iostream> // cout, cin
# include <fstream> // ifstream
class ConfigParser {
@@ -84,7 +77,6 @@ private:
// why static? it's an enum...
static MethodType _str_to_method_type(std::string str);
// just for testing purposes
};

View File

@@ -1,7 +1,7 @@
#include "Webserv.hpp"
#include "ConfigParser.hpp"

View File

@@ -13,12 +13,12 @@
#ifndef LOCATIONCONFIG_HPP
# define LOCATIONCONFIG_HPP
// includes
// add includes properly
# include <string>
# include <vector>
# include "MethodType.hpp"
# include <map>
# include "Webserv.hpp"
# include <vector>
# include <string>
// again, struct instead?
class LocationConfig
@@ -38,8 +38,6 @@ public:
};
#endif

View File

@@ -13,12 +13,14 @@
#ifndef SERVERCONFIG_HPP
# define SERVERCONFIG_HPP
// add includes properly...
# include "Webserv.hpp"
# include "MethodType.hpp"
//# include "ConfigParser.hpp"
# include "LocationConfig.hpp"
# include <map>
# include <vector>
# include <string> // string
# include <iostream> // cout, cin
// a class that's all public? just so we have options?
class ServerConfig
{

View File

@@ -27,12 +27,13 @@
# include "Client.hpp"
# include "ServerConfig.hpp"
# include "utils.hpp"
// TODO: A virer
# include "ConfigParser.hpp"
# include "LocationConfig.hpp"
# include "MethodType.hpp"
# include "utils.hpp"
//# include "ConfigParser.hpp"
//# include "LocationConfig.hpp"
//# include "MethodType.hpp"
//# include "utils.hpp"
// TODO: A virer
extern bool g_run;

View File

@@ -3,6 +3,7 @@
#include <exception>
#include <stdexcept>
#include "Webserv.hpp"
#include "ConfigParser.hpp"
int main(int ac, char **av)
{

View File

@@ -5,10 +5,11 @@
# include <vector>
# include <string>
# include <sstream>
# include <cstdlib> // atoi (athough it's already cover by <string>)
std::vector<std::string> split(std::string input, char delimiter);
bool isNumeric(std::string str);
bool isNumeric_btw(int low, int high, std::string str);
char* itoa(int n);
std::vector<std::string> split(std::string input, char delimiter);
bool isNumeric(std::string str);
bool isNumeric_btw(int low, int high, std::string str);
char* itoa(int n);
#endif