conf::ConfBlock Class Reference

Class implementing a block directive type. More...

#include <directives.h>

Inheritance diagram for conf::ConfBlock:

conf::ConfDir conf::ConfBoolBlock conf::ConfHostPort conf::ConfRules modules::ConfModule xlog::LogRules

List of all members.

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 ConfBlockoperator= (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

Confm_conf
 Created parser -- 0 until first successful call to begin().


Detailed Description

This class implements a type of directive taking a block of directives as its value.

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.


Member Function Documentation

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.

virtual bool conf::ConfBlock::add ( Conf conf,
Conf new_conf 
) [protected, pure virtual]

This function must be overriden in derived classes to add directives to the given Conf object.

Parameters:
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.
Returns:
true if initialization went well. Else it returns false and an error message should have been logged through conf.error().

Implemented in conf::ConfHostPort, xlog::LogRules, and modules::ConfModule.

virtual bool conf::ConfBlock::apply_changes ( Conf conf  )  [inline, protected, virtual]

This function is called automatically by end() whenever the configuration is reloaded. Use it to apply changes to the program if necessary.

Returns:
true if successful, false otherwise (which will make end() return false too.)


The documentation for this class was generated from the following file:
Generated on Fri Apr 18 22:03:28 2008 for Epona API by  doxygen 1.5.3