|
Webserv
|
Base class for configuration blocks like 'server' and 'location'. More...
#include <Block.hpp>
Public Member Functions | |
| Block (std::string const &name) | |
| Block (const Block &other) | |
| Block & | operator= (const Block &other) |
| virtual | ~Block () |
| bool | has (std::string const &key) const |
| Checks if a directive exists within the block. | |
| ArgumentVector const & | get (std::string const &key) const |
| Safely gets the values for a directive. | |
| Block & | add (std::string const &key, std::vector< std::string > const &) |
| Adds a directive with multiple values. | |
| Block & | add (std::string const &key, std::string const &) |
| Block & | add (std::string const &key, std::string const &, std::string const &) |
| Block & | add (std::string const &key, ParsedDirectiveArgs const &args) |
| Block & | add (std::string const &key, ArgumentVector const &values) |
| Block & | add (std::string const &key, ArgumentPtr value) |
| Block & | add (std::string const &key, size_t value) |
| std::vector< std::string > | getRawValues (std::string const &key) const |
| std::string | getFirstRawValue (std::string const &key) const |
| std::vector< std::string > | get (std::string const &key, http::Request const &req) const |
| std::string | getFirstEvaluatedString (std::string const &key, http::Request const &req) const |
| std::string const & | name () const |
| Gets the name of the block. | |
| std::string | root () const |
| Gets the root path directive. | |
| std::vector< std::string > | indexFiles () const |
| Gets the index files directive. | |
| Block & | root (std::string const &) |
| Sets the root directive using a fluent interface. | |
| size_t | maxBodySize () const |
| Block & | maxBodySize (size_t) |
Protected Attributes | |
| std::string | name_ |
| The name of the block (e.g., "server", "location"). | |
| DirectiveMap | directives_ |
| Map storing directive names and their values. | |
Friends | |
| class | DirectiveHandler |
| std::ostream & | operator<< (std::ostream &o, Block const &b) |
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.
|
explicit |
| config::Block::Block | ( | const Block & | other | ) |
|
virtual |
| Block & config::Block::add | ( | std::string const & | key, |
| ArgumentPtr | value ) |
| Block & config::Block::add | ( | std::string const & | key, |
| ArgumentVector const & | values ) |
| Block & config::Block::add | ( | std::string const & | key, |
| ParsedDirectiveArgs const & | args ) |
| Block & config::Block::add | ( | std::string const & | key, |
| size_t | value ) |
| Block & config::Block::add | ( | std::string const & | key, |
| std::string const & | value ) |
| Block & config::Block::add | ( | std::string const & | key, |
| std::string const & | v1, | ||
| std::string const & | v2 ) |
| Block & config::Block::add | ( | std::string const & | key, |
| std::vector< std::string > const & | value ) |
Adds a directive with multiple values.
| key | The name of the directive. |
| values | A vector of string values. |
| ArgumentVector const & config::Block::get | ( | std::string const & | key | ) | const |
Safely gets the values for a directive.
Retrieves the arguments for a specific directive.
| key | The name of the directive. |
| std::out_of_range | If the directive is not found. |
| key | The name of the directive (e.g., "root"). |
| std::vector< std::string > config::Block::get | ( | std::string const & | key, |
| http::Request const & | req ) const |
| std::string config::Block::getFirstEvaluatedString | ( | std::string const & | key, |
| http::Request const & | req ) const |
| std::string config::Block::getFirstRawValue | ( | std::string const & | key | ) | const |
| std::vector< std::string > config::Block::getRawValues | ( | std::string const & | key | ) | const |
| bool config::Block::has | ( | std::string const & | key | ) | const |
Checks if a directive exists within the block.
| key | The name of the directive to check. |
| std::vector< std::string > config::Block::indexFiles | ( | ) | const |
Gets the index files directive.
| size_t config::Block::maxBodySize | ( | ) | const |
| Block & config::Block::maxBodySize | ( | size_t | size | ) |
| std::string const & config::Block::name | ( | ) | const |
Gets the name of the block.
| std::string config::Block::root | ( | ) | const |
Gets the root path directive.
| Block & config::Block::root | ( | std::string const & | root | ) |
Sets the root directive using a fluent interface.
| path | The root path to set. |
|
friend |
|
friend |
|
protected |
Map storing directive names and their values.
|
protected |
The name of the block (e.g., "server", "location").