Files
42_INT_12_webserv/srcs/ConfigParser.hpp

80 lines
1.9 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ConfigParser.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: me <erlazo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/11 23:01:41 by me #+# #+# */
/* Updated: 2022/07/27 19:27:57 by me ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CONFIGPARSER_HPP
# define CONFIGPARSER_HPP
# include "Webserv.hpp" // easier to just do this?
// 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
enum MethodType
{
GET,
POST,
DELETE,
INVALID,
};
class ConfigParser {
public:
// canonical
ConfigParser(const char* path); // a string?
~ConfigParser();
// ideally i wouldn't have one cuz it makes no sense, when would i use it?
// ConfigParser & operator=(const ConfigParser& rhs);
// void parse(); // return void cuz throw exceptions.
std::vector<Server> * parse(); // const?
// other parses?
private:
std::string _content;
// explicit?
// what exaclty does explicit do again?
ConfigParser(); // might need a path as arg?
// should this be in private since it always needs a path?
void _check_proper_line_end(size_t prev, size_t curr); // const?
int _check_for_semicolon(std::string line); // const?
// just for testing purposes
void _print_content() const;
};
#endif