Webserv
|
Base class for configuration blocks like 'server' and 'location'. More...
#include <Block.hpp>
Public Member Functions | |
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) |
Protected Attributes | |
DirectiveMap | directives_ |
Friends | |
class | DirectiveHandler |
Base class for configuration blocks like 'server' and 'location'.
This class provides a generic storage mechanism for configuration directives using a map, allowing for high extensibility.
|
virtual |
void config::Block::add | ( | std::string const & | key, |
std::string const & | value ) |
void config::Block::add | ( | std::string const & | key, |
StringVector const & | values ) |
StringVector const * config::Block::get | ( | std::string const & | key | ) | const |
Retrieves the arguments for a specific directive.
key | The name of the directive (e.g., "root"). |
DirectiveMap & config::Block::getDirectives | ( | ) |
Provides read-write access to the underlying directive map.
Provides read-write access to the underlying directive map. (Primarily for use by the ConfigBuilder).
DirectiveMap const & config::Block::getDirectives | ( | ) | const |
Provides read-only access to the underlying directive map.
std::string config::Block::getRoot | ( | ) | const |
A convenient, strongly-typed accessor for the 'root' directive.
bool config::Block::has | ( | std::string const & | key | ) | const |
Checks if a directive exists within the block.
StringVector & config::Block::operator[] | ( | std::string const & | key | ) |
StringVector const * config::Block::operator[] | ( | std::string const & | key | ) | const |
void config::Block::setRoot | ( | std::string const & | root | ) |
|
friend |
|
protected |