#include <directives.h>
Public Member Functions | |
ConfBlock (std::string const &name, bool reloadable=true) | |
Constructor setting directive name and reloadability. | |
ConfBlock (ConfBlock const &cd) | |
Copy constructor. | |
virtual | ~ConfBlock () |
Destructor. | |
virtual ConfBlock & | operator= (ConfBlock const &right) |
Assignment operator. | |
virtual bool | operator== (ConfBlock const &) const |
== operator | |
virtual bool | begin (Conf &conf) |
Begin parsing. | |
virtual bool | set (Conf &conf, unsigned short count, std::string const params[]) |
Parses the block. | |
virtual bool | end (Conf &conf) |
End parsing. | |
virtual Conf const * | sub () const |
Implements ConfDir::sub(). | |
Protected Member Functions | |
virtual bool | add (Conf &conf, Conf &new_conf)=0 |
Adds directives to a Conf object. | |
virtual bool | apply_changes (Conf &conf) |
Applies changes. | |
Protected Attributes | |
Conf * | m_conf |
Created parser -- 0 until first successful call to begin(). |
It can't be used directly; instead, you must create a derived class that will override the add() function to add new directives to the Conf object that is created in the begin() function.
In your derived classes, you'll generally want to aggregate the directives objects too. That'll allow you to use the ConfBlock class with the ConfArray template class.
virtual bool conf::ConfBlock::operator== | ( | ConfBlock const & | ) | const [inline, virtual] |
This operator is provided in order to use the ConfArray template class. It always return false though (how the heck would we check reliably that two directives have the same value?! We don't even know if they _have_ a value! ;)
virtual bool conf::ConfBlock::begin | ( | Conf & | conf | ) | [virtual] |
Creates the conf parser, deleting the old parser if necessary, then calls add() to initialize the list of directives, then Conf::begin() to initialize it and sets the m_conf object to the newly-created object.
Reimplemented from conf::ConfDir.
Reimplemented in conf::ConfBoolBlock, and conf::ConfRules.
virtual bool conf::ConfBlock::set | ( | Conf & | conf, | |
unsigned short | count, | |||
std::string const | params[] | |||
) | [virtual] |
Parses the block of directives in params[0].
Reimplemented from conf::ConfDir.
Reimplemented in conf::ConfBoolBlock.
virtual bool conf::ConfBlock::end | ( | Conf & | conf | ) | [virtual] |
Calls apply_changes() and m_conf->end().
Reimplemented from conf::ConfDir.
This function must be overriden in derived classes to add directives to the given Conf object.
conf | The Conf object that called the ConfBlock::begin() function. DO NOT add directives to this object! ;) | |
new_conf | The Conf object to which you must add the directives. |
Implemented in conf::ConfHostPort, xlog::LogRules, and modules::ConfModule.
virtual bool conf::ConfBlock::apply_changes | ( | Conf & | conf | ) | [inline, protected, virtual] |