Webserv
|
Represents a single 'server' block from the configuration file. More...
#include <ServerBlock.hpp>
Public Member Functions | |
ServerBlock () | |
bool | hasLocation (LocationBlock const &) |
void | addLocation (LocationBlock const &) |
void | setListen (std::string const &listenArg) |
Parses a listen directive string and sets the address and port. | |
LocationBlock const * | getLocation (std::string const &name) const |
Retrieves the configuration for a specific location path. | |
LocationBlockMap const & | locations () const |
LocationBlockMap & | locations () |
int | getPort () const |
std::string const & | getAddress () const |
Public Member Functions inherited from config::Block | |
virtual | ~Block () |
bool | has (std::string const &key) const |
Checks if a directive exists within the block. | |
StringVector const * | operator[] (std::string const &key) const |
StringVector & | operator[] (std::string const &key) |
void | add (std::string const &key, StringVector const &values) |
void | add (std::string const &key, std::string const &value) |
DirectiveMap const & | getDirectives () const |
Provides read-only access to the underlying directive map. | |
DirectiveMap & | getDirectives () |
Provides read-write access to the underlying directive map. | |
StringVector const * | get (std::string const &key) const |
Retrieves the arguments for a specific directive. | |
std::string | getRoot () const |
A convenient, strongly-typed accessor for the 'root' directive. | |
void | setRoot (std::string const &root) |
Private Attributes | |
int | port_ |
std::string | address_ |
LocationBlockMap | locations_ |
Additional Inherited Members | |
Protected Attributes inherited from config::Block | |
DirectiveMap | directives_ |
Represents a single 'server' block from the configuration file.
This class is a strongly-typed container for all the directives and nested location blocks defined within a single server context. It holds settings like the listening port, server names, and a collection of LocationBlock objects.
config::ServerBlock::ServerBlock | ( | ) |
void config::ServerBlock::addLocation | ( | LocationBlock const & | b | ) |
|
inline |
LocationBlock const * config::ServerBlock::getLocation | ( | std::string const & | name | ) | const |
Retrieves the configuration for a specific location path.
name | The request path (URI) to match against a location block. |
|
inline |
bool config::ServerBlock::hasLocation | ( | LocationBlock const & | b | ) |
|
inline |
|
inline |
void config::ServerBlock::setListen | ( | std::string const & | listenArg | ) |
Parses a listen directive string and sets the address and port.
listenArg | The raw string argument from the config file (e.g., "8080", "127.0.0.1:80"). |
ConfigError | if the argument is invalid. |
|
private |
|
private |
|
private |