LeftHookRoll
An HTTP/1.0 compliant web server, as specified by RFC1945
Loading...
Searching...
No Matches
ConfigParser Class Reference

#include <ConfigParser.hpp>

Collaboration diagram for ConfigParser:

Classes

class  ConfigException
 

Public Member Functions

 ConfigParser (const std::string &filePath)
 
 ~ConfigParser ()
 
std::vector< ServerConfparse ()
 Parses the config file and returns one ServerConf per server block.
 

Private Member Functions

void _tokenize (const std::string &content)
 
const std::string & _peek () const
 
const std::string & _consume ()
 
void _expect (const std::string &token)
 
bool _atEnd () const
 
ServerConf _parseServerBlock ()
 
LocationConf _parseLocationBlock (const std::string &path)
 
void _parseListen (ServerConf &conf)
 
void _parseServerName (ServerConf &conf)
 
void _parseMaxBodySize (ServerConf &conf)
 
void _parseErrorPage (ServerConf &conf)
 
void _parseRoot (LocationConf &loc)
 
void _parseMethods (LocationConf &loc)
 
void _parseAutoIndex (LocationConf &loc)
 
void _parseIndex (LocationConf &loc)
 
void _parseUploadStore (LocationConf &loc)
 
void _parseReturn (LocationConf &loc)
 
void _parseCgiInterpreter (LocationConf &loc)
 
struct sockaddr_in _parseSockAddr (const std::string &listenValue)
 
size_t _parseBodySize (const std::string &value)
 
HTTPMethod _parseMethodToken (const std::string &token)
 
 ConfigParser (const ConfigParser &)
 
ConfigParseroperator= (const ConfigParser &)
 

Private Attributes

std::string _filePath
 
std::vector< std::string > _tokens
 
size_t _pos
 

Detailed Description

Definition at line 21 of file ConfigParser.hpp.

Constructor & Destructor Documentation

◆ ConfigParser() [1/2]

ConfigParser::ConfigParser ( const std::string &  filePath)
explicit

Definition at line 19 of file ConfigParser.cpp.

◆ ~ConfigParser()

ConfigParser::~ConfigParser ( )

Definition at line 22 of file ConfigParser.cpp.

◆ ConfigParser() [2/2]

ConfigParser::ConfigParser ( const ConfigParser )
private

Member Function Documentation

◆ parse()

std::vector< ServerConf > ConfigParser::parse ( )

Parses the config file and returns one ServerConf per server block.

Exceptions
ConfigExceptionon any syntax / validation error.

Definition at line 26 of file ConfigParser.cpp.

◆ _tokenize()

void ConfigParser::_tokenize ( const std::string &  content)
private

Definition at line 56 of file ConfigParser.cpp.

◆ _peek()

const std::string & ConfigParser::_peek ( ) const
private

Definition at line 102 of file ConfigParser.cpp.

◆ _consume()

const std::string & ConfigParser::_consume ( )
private

Definition at line 109 of file ConfigParser.cpp.

◆ _expect()

void ConfigParser::_expect ( const std::string &  token)
private

Definition at line 116 of file ConfigParser.cpp.

◆ _atEnd()

bool ConfigParser::_atEnd ( ) const
private

Definition at line 97 of file ConfigParser.cpp.

◆ _parseServerBlock()

ServerConf ConfigParser::_parseServerBlock ( )
private

Definition at line 124 of file ConfigParser.cpp.

◆ _parseLocationBlock()

LocationConf ConfigParser::_parseLocationBlock ( const std::string &  path)
private

Definition at line 153 of file ConfigParser.cpp.

◆ _parseListen()

void ConfigParser::_parseListen ( ServerConf conf)
private

Definition at line 184 of file ConfigParser.cpp.

◆ _parseServerName()

void ConfigParser::_parseServerName ( ServerConf conf)
private

Definition at line 191 of file ConfigParser.cpp.

◆ _parseMaxBodySize()

void ConfigParser::_parseMaxBodySize ( ServerConf conf)
private

Definition at line 198 of file ConfigParser.cpp.

◆ _parseErrorPage()

void ConfigParser::_parseErrorPage ( ServerConf conf)
private

Definition at line 205 of file ConfigParser.cpp.

◆ _parseRoot()

void ConfigParser::_parseRoot ( LocationConf loc)
private

Definition at line 217 of file ConfigParser.cpp.

◆ _parseMethods()

void ConfigParser::_parseMethods ( LocationConf loc)
private

Definition at line 224 of file ConfigParser.cpp.

◆ _parseAutoIndex()

void ConfigParser::_parseAutoIndex ( LocationConf loc)
private

Definition at line 235 of file ConfigParser.cpp.

◆ _parseIndex()

void ConfigParser::_parseIndex ( LocationConf loc)
private

Definition at line 248 of file ConfigParser.cpp.

◆ _parseUploadStore()

void ConfigParser::_parseUploadStore ( LocationConf loc)
private

Definition at line 255 of file ConfigParser.cpp.

◆ _parseReturn()

void ConfigParser::_parseReturn ( LocationConf loc)
private

Definition at line 262 of file ConfigParser.cpp.

◆ _parseCgiInterpreter()

void ConfigParser::_parseCgiInterpreter ( LocationConf loc)
private

Definition at line 275 of file ConfigParser.cpp.

◆ _parseSockAddr()

struct sockaddr_in ConfigParser::_parseSockAddr ( const std::string &  listenValue)
private

Definition at line 283 of file ConfigParser.cpp.

◆ _parseBodySize()

size_t ConfigParser::_parseBodySize ( const std::string &  value)
private

Definition at line 337 of file ConfigParser.cpp.

◆ _parseMethodToken()

HTTPMethod ConfigParser::_parseMethodToken ( const std::string &  token)
private

Definition at line 367 of file ConfigParser.cpp.

◆ operator=()

ConfigParser & ConfigParser::operator= ( const ConfigParser )
private

Member Data Documentation

◆ _filePath

std::string ConfigParser::_filePath
private

Definition at line 45 of file ConfigParser.hpp.

◆ _tokens

std::vector<std::string> ConfigParser::_tokens
private

Definition at line 46 of file ConfigParser.hpp.

◆ _pos

size_t ConfigParser::_pos
private

Definition at line 47 of file ConfigParser.hpp.


The documentation for this class was generated from the following files: