feisty meow concerns codebase  2.140
configuration::registry_configurator Class Reference

Supports the configurator class interface on the windows registry. More...

#include <registry_config.h>

Inheritance diagram for configuration::registry_configurator:
Collaboration diagram for configuration::registry_configurator:

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 &section, const basis::astring &entry, basis::astring &found)
 implements the configurator retrieval function. More...
 
virtual bool section_exists (const basis::astring &section)
 returns true if the "section" was found in the file. 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 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 "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" 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 &section)
 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 &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...
 
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...
 

Detailed Description

Supports the configurator class interface on the windows registry.

Definition at line 25 of file registry_config.h.

Member Enumeration Documentation

◆ registry_hives

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.

Constructor & Destructor Documentation

◆ registry_configurator()

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.

◆ ~registry_configurator()

configuration::registry_configurator::~registry_configurator ( )
virtual

Definition at line 66 of file registry_config.cpp.

Member Function Documentation

◆ DEFINE_CLASS_NAME()

configuration::registry_configurator::DEFINE_CLASS_NAME ( "registry_configurator"  )

◆ delete_entry()

bool configuration::registry_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 269 of file registry_config.cpp.

References fix_section(), FUNCDEF, basis::astring::length(), LOG, and translate_hive().

Referenced by put().

◆ delete_section()

bool configuration::registry_configurator::delete_section ( const basis::astring section)
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().

◆ fix_section()

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().

◆ get()

bool configuration::registry_configurator::get ( const basis::astring section,
const basis::astring entry,
basis::astring found 
)
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().

◆ get_section()

bool configuration::registry_configurator::get_section ( const basis::astring section,
structures::string_table info 
)
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().

◆ put()

bool configuration::registry_configurator::put ( const basis::astring section,
const basis::astring entry,
const basis::astring to_store 
)
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().

◆ put_section()

bool configuration::registry_configurator::put_section ( const basis::astring section,
const structures::string_table info 
)
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().

◆ section_exists()

bool configuration::registry_configurator::section_exists ( const basis::astring section)
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().

◆ translate_hive()

void * configuration::registry_configurator::translate_hive ( registry_hives  hive)

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