#include <configurator.h>
Inheritance diagram for configurator:

Public Types | |
| enum | treatment_of_defaults { AUTO_STORE, RETURN_ONLY } |
Public Member Functions | |
| configurator (treatment_of_defaults behavior) | |
| virtual | ~configurator () |
| treatment_of_defaults | behavior () const |
| observes the behavior chosen for the load() function. | |
| void | behavior (treatment_of_defaults new_behavior) |
| modifies the behavior of the load() function. | |
| virtual bool | get (const istring §ion, const istring &entry, istring &found)=0 |
| Retrieves an item from the configuration store. | |
| virtual bool | put (const istring §ion, const istring &entry, const istring &to_store)=0 |
| Places an item into the configuration store. | |
| bool | store (const istring §ion, const istring &entry, const istring &to_store) |
| a synonym for put. | |
| istring | load (const istring §ion, const istring &entry, const istring &default_value) |
| a synonym for get that implements the auto-store behavior. | |
| bool | store (const istring §ion, const istring &entry, int value) |
| stores an integer value from the configuration store. | |
| int | load (const istring §ion, const istring &entry, int def_value) |
| loads an integer value from the configuration store. | |
| virtual void | sections (string_array &list) |
| retrieves the section names into "list". | |
| void | section_set (string_set &list) |
| similar to above, but stores section names into a set. | |
| virtual bool | delete_entry (const istring &formal(section), const istring &formal(entry)) |
| eliminates the entry specified by the "section" and "entry" name. | |
| virtual bool | delete_section (const istring &formal(section)) |
| whacks the entire "section" specified. | |
| virtual bool | section_exists (const istring §ion) |
| returns true if the "section" is found in the configurator. | |
| virtual bool | get_section (const istring &formal(section), string_table &formal(found)) |
| retrieves an entire "section", if supported by the derived object. | |
| virtual bool | put_section (const istring &formal(section), const string_table &formal(to_store)) |
| stores an entire "section" from the table in "to_store", if supported. | |
All items that can be stored are modelled as having an entry name and a value. Groups of entries are stored in sections, in which the data usually have some relation to each other or share a common purpose.
Definition at line 32 of file configurator.h.
| configurator::configurator | ( | treatment_of_defaults | behavior | ) | [inline] |
Definition at line 41 of file configurator.h.
| configurator::~configurator | ( | ) | [virtual] |
Definition at line 25 of file configurator.cpp.
| treatment_of_defaults configurator::behavior | ( | ) | const [inline] |
observes the behavior chosen for the load() function.
Definition at line 45 of file configurator.h.
Referenced by string_configlet::load().
| void configurator::behavior | ( | treatment_of_defaults | new_behavior | ) | [inline] |
modifies the behavior of the load() function.
Definition at line 47 of file configurator.h.
References AUTO_STORE.
| virtual bool configurator::get | ( | const istring & | section, | |
| const istring & | entry, | |||
| istring & | found | |||
| ) | [pure virtual] |
Retrieves an item from the configuration store.
This retrieves a string into "found" that is listed in the "section" specified under the "entry" name. if the string is not found, false is returned.
Implemented in table_configurator, ini_configurator, and registry_configurator.
Referenced by load(), int_configlet::load(), string_configlet::load(), and network_address::load().
| virtual bool configurator::put | ( | const istring & | section, | |
| const istring & | entry, | |||
| const istring & | to_store | |||
| ) | [pure virtual] |
Places an item into the configuration store.
places an entry into the "section" under the "entry" name using the string "to_store". if the storage was successful, true is returned. reasons for failure depend on the derived class implementations.
Implemented in table_configurator, ini_configurator, and registry_configurator.
Referenced by section_manager::add_section(), load(), string_configlet::load(), network_address::load(), store(), string_configlet::store(), and network_address::store().
| bool configurator::store | ( | const istring & | section, | |
| const istring & | entry, | |||
| const istring & | to_store | |||
| ) |
a synonym for put.
Definition at line 39 of file configurator.cpp.
References put().
Referenced by path_configuration::get_logging_directory(), ini_roller::ini_roller(), load(), main(), ini_roller::next_id(), tiny_shell::OnClose(), version_ini::set_record(), version_ini::set_version(), store(), int_configlet::store(), and ini_roller::~ini_roller().
| istring configurator::load | ( | const istring & | section, | |
| const istring & | entry, | |||
| const istring & | default_value | |||
| ) |
a synonym for get that implements the auto-store behavior.
if the behavior is set to auto-store, then the default value will be written when no value existed prior to the load() invocation.
Definition at line 27 of file configurator.cpp.
References AUTO_STORE, get(), and put().
Referenced by tiny_shell::Create(), version_ini::executable(), application_config::find_program(), version_ini::get_record(), ini_roller::ini_roller(), service_root::initialize(), int_configlet::load(), main(), version_ini::ole_auto_registering(), grid_processor::process_grid_files(), database_login_info::read_info(), path_configuration::read_item(), version_ini::read_version_from_ini(), section_manager::section_exists(), smtp_client::setup_session(), version_ini::write_code(), and version_ini::write_rc().
stores an integer value from the configuration store.
Definition at line 43 of file configurator.cpp.
References istring::SPRINTF, and store().
loads an integer value from the configuration store.
Definition at line 62 of file configurator.cpp.
References AUTO_STORE, istring::convert(), get(), and store().
| void configurator::sections | ( | string_array & | list | ) | [virtual] |
retrieves the section names into "list".
Reimplemented in table_configurator, and ini_configurator.
Definition at line 49 of file configurator.cpp.
References string_array().
Referenced by section_set().
| void configurator::section_set | ( | string_set & | list | ) |
similar to above, but stores section names into a set.
this never needs to be overridden; it's simply a set instead of an array. the real sections method is above for string_array.
Definition at line 55 of file configurator.cpp.
References sections().
Referenced by config_watcher::changed_sections(), config_watcher::deleted_sections(), config_watcher::new_sections(), and config_watcher::rescan().
| virtual bool configurator::delete_entry | ( | const istring & | formal(section), | |
| const istring & | formal(entry) | |||
| ) | [inline, virtual] |
eliminates the entry specified by the "section" and "entry" name.
Definition at line 92 of file configurator.h.
Referenced by section_manager::zap_section().
| virtual bool configurator::delete_section | ( | const istring & | formal(section) | ) | [inline, virtual] |
whacks the entire "section" specified.
Definition at line 96 of file configurator.h.
Referenced by section_manager::zap_section().
| bool configurator::section_exists | ( | const istring & | section | ) | [virtual] |
returns true if the "section" is found in the configurator.
the default implementation is quite slow; if there is a swifter means for a particular type of configurator, then this should be overridden.
Reimplemented in table_configurator, ini_configurator, and registry_configurator.
Definition at line 73 of file configurator.cpp.
References get_section().
| virtual bool configurator::get_section | ( | const istring & | formal(section), | |
| string_table & | formal(found) | |||
| ) | [inline, virtual] |
retrieves an entire "section", if supported by the derived object.
the symbol table "found" gets the entries from the "section". see symbol_table.h for more details about string_tables. true is returned if the section existed and its contents were put in "found".
Definition at line 105 of file configurator.h.
Referenced by section_manager::find_section(), section_manager::get_toc(), config_watcher::rescan(), and section_exists().
| virtual bool configurator::put_section | ( | const istring & | formal(section), | |
| const string_table & | formal(to_store) | |||
| ) | [inline, virtual] |
stores an entire "section" from the table in "to_store", if supported.
if any entries already exist in the "section", then they are eliminated before the new entries are stored. true is returned if the write was successful.
Definition at line 111 of file configurator.h.
Referenced by section_manager::add_section().
1.5.1