feisty meow concerns codebase
2.140
|
Supports the configurator class interface on the windows registry. More...
#include <registry_config.h>
Public Types | |
enum | registry_hives { hkey_classes_root , hkey_current_user , hkey_local_machine , hkey_users , hkey_current_config , HKCR = hkey_classes_root , HKCU = hkey_current_user , HKLM = hkey_local_machine , HKU = hkey_users , HKCC = hkey_current_config } |
the hives are major partitions of the registry. More... | |
Public Types inherited from configuration::configurator | |
enum | treatment_of_defaults { AUTO_STORE , RETURN_ONLY } |
Public Member Functions | |
registry_configurator (registry_hives hive, treatment_of_defaults behavior) | |
creates a registry_configurator that stores entries into the "hive". More... | |
virtual | ~registry_configurator () |
DEFINE_CLASS_NAME ("registry_configurator") | |
virtual bool | get (const basis::astring §ion, const basis::astring &entry, basis::astring &found) |
implements the configurator retrieval function. More... | |
virtual bool | section_exists (const basis::astring §ion) |
returns true if the "section" was found in the file. More... | |
virtual bool | put (const basis::astring §ion, const basis::astring &entry, const basis::astring &to_store) |
implements the configurator storage function. More... | |
virtual bool | delete_section (const basis::astring §ion) |
removes the entire "section" specified. More... | |
virtual bool | delete_entry (const basis::astring §ion, const basis::astring &entry) |
removes the entry specified by the "section" and "entry" name. More... | |
virtual bool | get_section (const basis::astring §ion, structures::string_table &info) |
reads the entire "section" into a table called "info". More... | |
virtual bool | put_section (const basis::astring §ion, const structures::string_table &info) |
writes a table called "info" into the "section" in the INI file. More... | |
void * | translate_hive (registry_hives hive) |
translates from our enum to the windows specific type for hives. More... | |
basis::astring | fix_section (const basis::astring §ion) |
repairs malformed section names. 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 §ion, const basis::astring &entry, const basis::astring &to_store) |
a synonym for put. More... | |
basis::astring | load (const basis::astring §ion, 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 §ion, const basis::astring &entry, int value) |
stores an integer value from the configuration store. More... | |
int | load (const basis::astring §ion, const basis::astring &entry, int def_value) |
loads an integer value from the configuration store. More... | |
virtual void | sections (structures::string_array &list) |
retrieves the section names into "list". 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... | |
Supports the configurator class interface on the windows registry.
Definition at line 25 of file registry_config.h.
the hives are major partitions of the registry.
Enumerator | |
---|---|
hkey_classes_root | |
hkey_current_user | |
hkey_local_machine | |
hkey_users | |
hkey_current_config | |
HKCR | |
HKCU | |
HKLM | |
HKU | |
HKCC |
Definition at line 29 of file registry_config.h.
configuration::registry_configurator::registry_configurator | ( | registry_hives | hive, |
treatment_of_defaults | behavior | ||
) |
creates a registry_configurator that stores entries into the "hive".
applies the "behavior" to items that are not found.
Definition at line 60 of file registry_config.cpp.
|
virtual |
Definition at line 66 of file registry_config.cpp.
configuration::registry_configurator::DEFINE_CLASS_NAME | ( | "registry_configurator" | ) |
|
virtual |
removes the entry specified by the "section" and "entry" name.
Definition at line 269 of file registry_config.cpp.
References fix_section(), FUNCDEF, basis::astring::length(), LOG, and translate_hive().
Referenced by put().
|
virtual |
removes the entire "section" specified.
Definition at line 250 of file registry_config.cpp.
References fix_section(), FUNCDEF, basis::astring::length(), LOG, and translate_hive().
astring configuration::registry_configurator::fix_section | ( | const basis::astring & | section | ) |
repairs malformed section names.
translates a section name that might use forward slashes into the form required for windows that uses backslashes.
Definition at line 90 of file registry_config.cpp.
References basis::astring::length().
Referenced by delete_entry(), delete_section(), get(), get_section(), put(), put_section(), and section_exists().
|
virtual |
implements the configurator retrieval function.
note that for registry based retrieval, an empty "entry" is allowed, and that specifies the default item in the "section".
Implements configuration::configurator.
Definition at line 139 of file registry_config.cpp.
References fix_section(), FUNCDEF, LOG, configuration::MAXIMUM_ENTRY_SIZE, and translate_hive().
|
virtual |
reads the entire "section" into a table called "info".
on win-9x, this will fail if the section's data exceeds 32K.
Definition at line 185 of file registry_config.cpp.
References structures::symbol_table< contents >::add(), fix_section(), FUNCDEF, basis::astring::length(), LOG, configuration::MAXIMUM_ENTRY_SIZE, configuration::MAXIMUM_NAME_SIZE, structures::symbol_table< contents >::reset(), and translate_hive().
|
virtual |
implements the configurator storage function.
put interprets an empty string for "entry" as pointing at the default item in the "section".
Implements configuration::configurator.
Definition at line 100 of file registry_config.cpp.
References delete_entry(), fix_section(), FUNCDEF, basis::astring::length(), LOG, NULL_POINTER, basis::astring::s(), and translate_hive().
Referenced by put_section().
|
virtual |
writes a table called "info" into the "section" in the INI file.
any existing data for that section is wiped out. on win-9x, this will fail if the section's data exceeds 32K.
Definition at line 300 of file registry_config.cpp.
References fix_section(), structures::symbol_table< contents >::name(), put(), and structures::symbol_table< contents >::symbols().
|
virtual |
returns true if the "section" was found in the file.
Reimplemented from configuration::configurator.
Definition at line 230 of file registry_config.cpp.
References fix_section(), FUNCDEF, basis::astring::length(), LOG, and translate_hive().
void * configuration::registry_configurator::translate_hive | ( | registry_hives | hive | ) |
translates from our enum to the windows specific type for hives.
Definition at line 78 of file registry_config.cpp.
References configuration::HKEY_CLASSES_ROOT, hkey_classes_root, configuration::HKEY_CURRENT_CONFIG, hkey_current_config, configuration::HKEY_CURRENT_USER, hkey_current_user, configuration::HKEY_LOCAL_MACHINE, hkey_local_machine, configuration::HKEY_USERS, and hkey_users.
Referenced by delete_entry(), delete_section(), get(), get_section(), put(), and section_exists().