Webserv
Loading...
Searching...
No Matches
DirectiveHandler.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "../ServerBlock.hpp"
6
7namespace config {
8
10public:
12
13 void process(ServerBlock &block, const std::string &key, const StringVector &args);
14 void process(ServerBlock &block, DirectiveMap const &map);
15 void process(LocationBlock &block, const std::string &key, const StringVector &args);
16 void process(LocationBlock &block, DirectiveMap const &map);
17
18private:
19 void handleListen(ServerBlock &server, const StringVector &args);
20 void handleRoot(Block &block, const StringVector &args);
21
22 typedef void (DirectiveHandler::*GenericHandler)(Block &, const StringVector &);
25
26 typedef std::map<std::string, GenericHandler> GenericHandlerMap;
27 typedef std::map<std::string, ServerHandler> ServerHandlerMap;
28 typedef std::map<std::string, LocationHandler> LocationHandlerMap;
29
33
38};
39
40} // namespace config
Base class for configuration blocks like 'server' and 'location'.
Definition Block.hpp:19
LocationHandlerMap locationHandlers_
Definition DirectiveHandler.hpp:32
std::map< std::string, ServerHandler > ServerHandlerMap
Definition DirectiveHandler.hpp:27
void(DirectiveHandler::* ServerHandler)(ServerBlock &, const StringVector &)
Definition DirectiveHandler.hpp:23
ServerHandlerMap serverHandlers_
Definition DirectiveHandler.hpp:31
DirectiveHandler & operator=(const DirectiveHandler &)
void process(ServerBlock &block, const std::string &key, const StringVector &args)
Definition DirectiveHandler.cpp:38
DirectiveHandler(const DirectiveHandler &)
std::map< std::string, GenericHandler > GenericHandlerMap
Definition DirectiveHandler.hpp:26
void(DirectiveHandler::* GenericHandler)(Block &, const StringVector &)
Definition DirectiveHandler.hpp:22
std::map< std::string, LocationHandler > LocationHandlerMap
Definition DirectiveHandler.hpp:28
void handleRoot(Block &block, const StringVector &args)
Definition DirectiveHandler.cpp:78
DirectiveHandler()
Definition DirectiveHandler.cpp:10
GenericHandlerMap genericHandlers_
Definition DirectiveHandler.hpp:30
~DirectiveHandler()
Definition DirectiveHandler.cpp:18
void handleListen(ServerBlock &server, const StringVector &args)
Definition DirectiveHandler.cpp:70
void(DirectiveHandler::* LocationHandler)(LocationBlock &, const StringVector &)
Definition DirectiveHandler.hpp:24
static DirectiveHandler & getInstance()
Definition DirectiveHandler.cpp:21
Represents a single 'location' block from the configuration file.
Definition LocationBlock.hpp:16
Represents a single 'server' block from the configuration file.
Definition ServerBlock.hpp:18
Definition ConfigException.hpp:6
std::vector< std::string > StringVector
Definition Block.hpp:9
std::map< std::string, StringVector > DirectiveMap
Definition Block.hpp:10