Webserv
Loading...
Searching...
No Matches
config::ServerConfig Class Reference

A strongly-typed data container for a server block's configuration. More...

#include <ServerConfig.hpp>

Public Member Functions

 ServerConfig ()
 ServerConfig (char const *fpath, bool perform_fs_checks=true)
 ServerConfig (std::string const &content, bool perform_fs_checks=true)
ServerBlock const * getServer (int port, std::string const &server_name) const
 Retrieves the server configuration that best matches a port and server name.
void addServer (ServerBlock const &)
ServerBlockMap const & getServersMap () const

Private Member Functions

void build (std::string const &content, bool perform_fs_checks)

Private Attributes

ServerBlockMap servers_

Detailed Description

A strongly-typed data container for a server block's configuration.

This class holds the final, validated settings for a single 'server' block after all parsing and semantic validation is complete. It is the definitive configuration used by the webserver at runtime.

Constructor & Destructor Documentation

◆ ServerConfig() [1/3]

config::ServerConfig::ServerConfig ( )

◆ ServerConfig() [2/3]

config::ServerConfig::ServerConfig ( char const * fpath,
bool perform_fs_checks = true )

◆ ServerConfig() [3/3]

config::ServerConfig::ServerConfig ( std::string const & content,
bool perform_fs_checks = true )

Member Function Documentation

◆ addServer()

void config::ServerConfig::addServer ( ServerBlock const & server)

◆ build()

void config::ServerConfig::build ( std::string const & content,
bool perform_fs_checks )
private

◆ getServer()

ServerBlock const * config::ServerConfig::getServer ( int port,
std::string const & server_name ) const

Retrieves the server configuration that best matches a port and server name.

Parameters
portThe port number of the incoming connection.
server_nameThe server name requested by the client.
Returns
A const pointer to the matched ServerBlock, or NULL if no match is found.

◆ getServersMap()

ServerBlockMap const & config::ServerConfig::getServersMap ( ) const

Member Data Documentation

◆ servers_

ServerBlockMap config::ServerConfig::servers_
private

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