feisty meow concerns codebase  2.140
configuration::table_configurator Class Reference

Supports the configurator interface using a collection of string tables. More...

#include <table_configurator.h>

Inheritance diagram for configuration::table_configurator:
Collaboration diagram for configuration::table_configurator:

Public Member Functions

 table_configurator (treatment_of_defaults behavior=AUTO_STORE)
 Constructor just needs to know what to do for missing items. More...
 
 table_configurator (const table_configurator &to_copy)
 
virtual ~table_configurator ()
 
table_configuratoroperator= (const table_configurator &to_copy)
 
 DEFINE_CLASS_NAME ("table_configurator")
 
virtual void sections (structures::string_array &list)
 retrieves the section names into "list". More...
 
void reset ()
 
virtual bool get (const basis::astring &section, const basis::astring &entry, basis::astring &found)
 implements the configurator retrieval function. More...
 
virtual bool put (const basis::astring &section, const basis::astring &entry, const basis::astring &to_store)
 implements the configurator storage function. More...
 
virtual bool section_exists (const basis::astring &section)
 true if the "section" is presently in the table config. More...
 
virtual bool delete_section (const basis::astring &section)
 removes the entire "section" specified. More...
 
virtual bool delete_entry (const basis::astring &section, const basis::astring &entry)
 removes the entry specified by the "section" and "entry" name. More...
 
virtual bool get_section (const basis::astring &section, structures::string_table &info)
 reads the entire table held under "section" into a table called "info". More...
 
virtual bool put_section (const basis::astring &section, const structures::string_table &info)
 writes a table called "info" into the "section" held here. More...
 
- Public Member Functions inherited from configuration::configurator
 configurator (treatment_of_defaults behavior=RETURN_ONLY)
 
virtual ~configurator ()
 
treatment_of_defaults behavior () const
 observes the behavior chosen for the load() function. More...
 
void behavior (treatment_of_defaults new_behavior)
 modifies the behavior of the load() function. More...
 
bool store (const basis::astring &section, const basis::astring &entry, const basis::astring &to_store)
 a synonym for put. More...
 
basis::astring load (const basis::astring &section, const basis::astring &entry, const basis::astring &default_value)
 a synonym for get that implements the auto-store behavior. More...
 
bool store (const basis::astring &section, const basis::astring &entry, int value)
 stores an integer value from the configuration store. More...
 
int load (const basis::astring &section, const basis::astring &entry, int def_value)
 loads an integer value from the configuration store. More...
 
void section_set (structures::string_set &list)
 similar to above, but stores section names into a set. More...
 
virtual bool delete_entry (const basis::astring &formal(section), const basis::astring &formal(entry))
 eliminates the entry specified by the "section" and "entry" name. More...
 
virtual bool delete_section (const basis::astring &formal(section))
 whacks the entire "section" specified. More...
 
virtual bool get_section (const basis::astring &formal(section), structures::string_table &formal(found))
 retrieves an entire "section", if supported by the derived object. More...
 
virtual bool put_section (const basis::astring &formal(section), const structures::string_table &formal(to_store))
 stores an entire "section" from the table in "to_store", if supported. More...
 

Additional Inherited Members

- Public Types inherited from configuration::configurator
enum  treatment_of_defaults { AUTO_STORE , RETURN_ONLY }
 

Detailed Description

Supports the configurator interface using a collection of string tables.

Definition at line 29 of file table_configurator.h.

Constructor & Destructor Documentation

◆ table_configurator() [1/2]

configuration::table_configurator::table_configurator ( treatment_of_defaults  behavior = AUTO_STORE)

Constructor just needs to know what to do for missing items.

Creates a table_configurator that loads and stores entries into the internal collection of tables. It will use the "behavior" regarding missing entries when load() is invoked.

Definition at line 37 of file table_configurator.cpp.

◆ table_configurator() [2/2]

configuration::table_configurator::table_configurator ( const table_configurator to_copy)

Definition at line 42 of file table_configurator.cpp.

◆ ~table_configurator()

configuration::table_configurator::~table_configurator ( )
virtual

Definition at line 47 of file table_configurator.cpp.

References basis::WHACK().

Member Function Documentation

◆ DEFINE_CLASS_NAME()

configuration::table_configurator::DEFINE_CLASS_NAME ( "table_configurator"  )

◆ delete_entry()

bool configuration::table_configurator::delete_entry ( const basis::astring section,
const basis::astring entry 
)
virtual

removes the entry specified by the "section" and "entry" name.

Definition at line 85 of file table_configurator.cpp.

References structures::symbol_table< contents >::whack().

Referenced by put().

◆ delete_section()

bool configuration::table_configurator::delete_section ( const basis::astring section)
virtual

removes the entire "section" specified.

Definition at line 82 of file table_configurator.cpp.

Referenced by put().

◆ get()

bool configuration::table_configurator::get ( const basis::astring section,
const basis::astring entry,
basis::astring found 
)
virtual

implements the configurator retrieval function.

Implements configuration::configurator.

Definition at line 108 of file table_configurator.cpp.

References structures::symbol_table< contents >::find().

Referenced by configuration::config_watcher::changed_items().

◆ get_section()

◆ operator=()

table_configurator & configuration::table_configurator::operator= ( const table_configurator to_copy)

Definition at line 52 of file table_configurator.cpp.

References basis::array< contents >::length().

◆ put()

bool configuration::table_configurator::put ( const basis::astring section,
const basis::astring entry,
const basis::astring to_store 
)
virtual

implements the configurator storage function.

Implements configuration::configurator.

Definition at line 93 of file table_configurator.cpp.

References structures::symbol_table< contents >::add(), delete_entry(), delete_section(), and basis::astring::length().

Referenced by configuration::ini_parser::merge_section().

◆ put_section()

bool configuration::table_configurator::put_section ( const basis::astring section,
const structures::string_table info 
)
virtual

writes a table called "info" into the "section" held here.

Definition at line 182 of file table_configurator.cpp.

References FUNCDEF.

Referenced by configuration::ini_parser::merge_section(), and configuration::config_watcher::rescan().

◆ reset()

void configuration::table_configurator::reset ( )

◆ section_exists()

bool configuration::table_configurator::section_exists ( const basis::astring section)
virtual

true if the "section" is presently in the table config.

Reimplemented from configuration::configurator.

Definition at line 72 of file table_configurator.cpp.

Referenced by configuration::ini_parser::merge_section().

◆ sections()

void configuration::table_configurator::sections ( structures::string_array list)
virtual

retrieves the section names into "list".

Reimplemented from configuration::configurator.

Definition at line 75 of file table_configurator.cpp.

References basis::array< contents >::reset().

Referenced by configuration::ini_parser::restate().


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