nis-util  1.0.D108
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
configuration_section Class Reference

#include <section.h>

Public Types

typedef boost::shared_ptr
< configuration_section
pointer
typedef configuration_item::level_t level_t

Public Member Functions

virtual ~configuration_section ()
rcstring get_string_value (const rcstring &item_name) const
bool get_bool_value (const rcstring &item_name) const
long get_long_value (const rcstring &item_name) const
void set (const configuration_item::pointer &item)
bool is_set (const rcstring &item_name) const
void print (void) const

Static Public Member Functions

static pointer create (const rcstring &name)

Private Types

typedef std::map< rcstring,
configuration_item::pointer
items_t

Private Member Functions

 configuration_section (const rcstring &name)
 configuration_section ()
 configuration_section (const configuration_section &rhs)
configuration_sectionoperator= (const configuration_section &rhs)

Private Attributes

rcstring name
items_t items

Detailed Description

The configuration_section class is used to represent one section of a configuration file, filled with configuration_item instances.

Definition at line 33 of file section.h.


Member Typedef Documentation

Definition at line 125 of file section.h.

Definition at line 38 of file section.h.

Definition at line 36 of file section.h.


Constructor & Destructor Documentation

The destructor.

Definition at line 22 of file section.cc.

The constructor. It is private on purpose, use the create class method instead.

Parameters:
nameThe name of the section.

Definition at line 27 of file section.cc.

The default constructor. Do not use.

The copy constructor. Do not use.

Parameters:
rhsThe right hand side of the initialization.

Member Function Documentation

The create class method is used to create new dynamically allocated instances of this class.

Parameters:
nameThe name of the section.

Definition at line 34 of file section.cc.

bool configuration_section::get_bool_value ( const rcstring item_name) const

The get_bool_value method is used ot obtain the boolean value of the named configuration item.

Parameters:
item_nameThe name of the item of interest.
Returns:
the item value, or false if the item is not set

Definition at line 61 of file section.cc.

long configuration_section::get_long_value ( const rcstring item_name) const

The get_long_value method is used ot obtain the integer value of the named configuration item.

Parameters:
item_nameThe name of the item of interest.
Returns:
the item value, or 0 if the item is not set

Definition at line 73 of file section.cc.

The get_string_value method is used ot obtain the string value of the named configuration item.

Parameters:
item_nameThe name of the item of interest.
Returns:
the item value, or the empty string if the item is not set

Definition at line 49 of file section.cc.

bool configuration_section::is_set ( const rcstring item_name) const

The is_set method may be used to determine whether or not a particular configuration item is available.

Parameters:
item_nameThe name of the item of interest.

Definition at line 41 of file section.cc.

configuration_section& configuration_section::operator= ( const configuration_section rhs) [private]

The assignment operator. Do not use.

Parameters:
rhsThe right hand side of the assignment.
void configuration_section::print ( void  ) const

The print method is used to print the configuration data in stdout. Mostly useful for debugging.

Definition at line 26 of file print.cc.

The set method is used to set a configuration item. If we already have a value for that name, it will only be replaced if it has a higher priority.

Definition at line 85 of file section.cc.


Field Documentation

The items instance variable is used to remember the the set of configuration items defined for this section.

Definition at line 131 of file section.h.

The name instance variable is used to remember the name of this section.

Definition at line 123 of file section.h.


The documentation for this class was generated from the following files: