ACE
6.1.0
|
The win32 registry implementation of a configuration database. More...
#include <Configuration.h>
Public Member Functions | |
ACE_Configuration_Win32Registry (HKEY hKey) | |
virtual | ~ACE_Configuration_Win32Registry (void) |
Destructor. | |
virtual int | open_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, int create, ACE_Configuration_Section_Key &result) |
virtual int | remove_section (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *sub_section, bool recursive) |
Removes a named section. | |
virtual int | enumerate_values (const ACE_Configuration_Section_Key &key, int index, ACE_TString &name, VALUETYPE &type) |
virtual int | enumerate_sections (const ACE_Configuration_Section_Key &key, int index, ACE_TString &name) |
virtual int | set_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const ACE_TString &value) |
Sets a string-typed value. | |
virtual int | set_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int value) |
Sets a integer-typed value. | |
virtual int | set_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const void *data, size_t length) |
Sets a binary-typed value. | |
virtual int | get_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, ACE_TString &value) |
Gets a string-typed value. | |
virtual int | get_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int &value) |
Gets an integer-typed value. | |
virtual int | get_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, void *&data, size_t &length) |
Gets a binary-typed value. | |
virtual int | find_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, VALUETYPE &type) |
virtual int | remove_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name) |
Removes the the value name from key. returns non zero on error. | |
virtual bool | operator== (const ACE_Configuration_Win32Registry &rhs) const |
virtual bool | operator!= (const ACE_Configuration_Win32Registry &rhs) const |
Static Public Member Functions | |
static HKEY | resolve_key (HKEY hKey, const ACE_TCHAR *path, int create=1) |
Protected Member Functions | |
int | load_key (const ACE_Configuration_Section_Key &key, HKEY &hKey) |
Gets the HKEY for a configuration section. | |
ACE_Configuration_Win32Registry (void) | |
ACE_Configuration_Win32Registry (const ACE_Configuration_Win32Registry &rhs) | |
ACE_Configuration_Win32Registry & | operator= (const ACE_Configuration_Win32Registry &rhs) |
The win32 registry implementation of a configuration database.
The win32 implementation basically makes calls through to the registry functions. The API is very similar so very little work must be done
ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry | ( | HKEY | hKey | ) | [explicit] |
Constructor for registry configuration database. hKey is the base registry key to attach to. This class takes ownership of hKey, it will invoke <RegCloseKey> on it upon destruction.
ACE_Configuration_Win32Registry::~ACE_Configuration_Win32Registry | ( | void | ) | [virtual] |
Destructor.
ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry | ( | void | ) | [protected] |
ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry | ( | const ACE_Configuration_Win32Registry & | rhs | ) | [protected] |
int ACE_Configuration_Win32Registry::enumerate_sections | ( | const ACE_Configuration_Section_Key & | key, |
int | index, | ||
ACE_TString & | name | ||
) | [virtual] |
Enumerates through the subsections in a section.
key | Section key to iterate through. |
index | Iteration position. Must be zero on the first call to iterate through key. Increment index by one on each successive call to this method. |
name | Receives the subsection's name. |
0 | for success, name has a valid name. |
1 | there are no more subsections in the section. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::enumerate_values | ( | const ACE_Configuration_Section_Key & | key, |
int | index, | ||
ACE_TString & | name, | ||
VALUETYPE & | type | ||
) | [virtual] |
Enumerates through the values in a section.
key | Section key to iterate through. |
index | Iteration position. Must be zero on the first call to iterate through key. Increment index by one on each successive call to this method. |
name | Receives the value's name. |
type | Receives the value's data type. |
0 | for success, name and type are valid. |
1 | there are no more values in the section. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::find_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
VALUETYPE & | type | ||
) | [virtual] |
Retrieves the type of a named configuration value.
key | Configuration section to look up the name in. |
name | Name of the configuration value to get the type of. |
type | Receives the data type of the named value, if it exists. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::get_binary_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
void *& | data, | ||
size_t & | length | ||
) | [virtual] |
Gets a binary-typed value.
key | Configuration section to get the value from. |
name | Name of the configuration value to get. |
data | Receives a pointer to memory holding the binary data for the value. This method allocates the memory pointed to using operator new[]. The caller is responsible for freeing the memory using operator delete[]. |
length | Receives the number of bytes in the value. |
0 | for success; caller is responsible for freeing the returned memory. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::get_integer_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
u_int & | value | ||
) | [virtual] |
Gets an integer-typed value.
key | Configuration section to get the value from. |
name | Name of the configuration value to get. |
value | Receives the configuration value if it exists and has type INTEGER. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::get_string_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
ACE_TString & | value | ||
) | [virtual] |
Gets a string-typed value.
key | Configuration section to get the value from. |
name | Name of the configuration value to get. |
value | Receives the configuration value if it exists and has type STRING. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::load_key | ( | const ACE_Configuration_Section_Key & | key, |
HKEY & | hKey | ||
) | [protected] |
Gets the HKEY for a configuration section.
int ACE_Configuration_Win32Registry::open_section | ( | const ACE_Configuration_Section_Key & | base, |
const ACE_TCHAR * | sub_section, | ||
int | create, | ||
ACE_Configuration_Section_Key & | result | ||
) | [virtual] |
Opens a named section in an existing section.
base | Existing section in which to open the named section. |
sub_section | Name of the section to open. |
create | If zero, the named section must exist. If non-zero, the named section will be created if it does not exist. |
result | Reference; receives the section key for the new section. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
bool ACE_Configuration_Win32Registry::operator!= | ( | const ACE_Configuration_Win32Registry & | rhs | ) | const [virtual] |
ACE_Configuration_Win32Registry& ACE_Configuration_Win32Registry::operator= | ( | const ACE_Configuration_Win32Registry & | rhs | ) | [protected] |
bool ACE_Configuration_Win32Registry::operator== | ( | const ACE_Configuration_Win32Registry & | rhs | ) | const [virtual] |
int ACE_Configuration_Win32Registry::remove_section | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | sub_section, | ||
bool | recursive | ||
) | [virtual] |
Removes a named section.
key | Section key to remove the named section from. |
sub_section | Name of the section to remove. |
recursive | If true, any subkeys below sub_section are removed as well. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::remove_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name | ||
) | [virtual] |
Removes the the value name from key. returns non zero on error.
Implements ACE_Configuration.
HKEY ACE_Configuration_Win32Registry::resolve_key | ( | HKEY | hKey, |
const ACE_TCHAR * | path, | ||
int | create = 1 |
||
) | [static] |
This method traverses <path> through <hKey>. It is useful when you want the HKEY for a specific registry key, especially when initializing this implementation. Caller is responsible for closeing this key when it is no longer used. If create is 1 (default) the keys are create if they don't already exist. Returns 0 on error
int ACE_Configuration_Win32Registry::set_binary_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
const void * | data, | ||
size_t | length | ||
) | [virtual] |
Sets a binary-typed value.
key | Configuration section to set the value in. |
name | Name of the configuration value to set. If a value with the specified name exists, it is replaced. |
data | Pointer to the binary data for the value. |
length | Number of bytes for the new value. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::set_integer_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
u_int | value | ||
) | [virtual] |
Sets a integer-typed value.
key | Configuration section to set the value in. |
name | Name of the configuration value to set. If a value with the specified name exists, it is replaced. |
value | The integer to set the configuration value to. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.
int ACE_Configuration_Win32Registry::set_string_value | ( | const ACE_Configuration_Section_Key & | key, |
const ACE_TCHAR * | name, | ||
const ACE_TString & | value | ||
) | [virtual] |
Sets a string-typed value.
key | Configuration section to set the value in. |
name | Name of the configuration value to set. If a value with the specified name exists, it is replaced. |
value | The string to set the configuration value to. |
0 | for success. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implements ACE_Configuration.