Base class for configuration databases.
More...
#include <Configuration.h>
|
virtual | ~ACE_Configuration (void) |
| Destructor. More...
|
|
virtual const ACE_Configuration_Section_Key & | root_section (void) const |
| Obtain a reference to the root section of this configuration. More...
|
|
virtual int | open_section (const ACE_Configuration_Section_Key &base, const ACE_TCHAR *sub_section, int create, ACE_Configuration_Section_Key &result)=0 |
|
virtual int | remove_section (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *sub_section, bool recursive)=0 |
| Removes a named section. More...
|
|
virtual int | enumerate_values (const ACE_Configuration_Section_Key &key, int index, ACE_TString &name, VALUETYPE &type)=0 |
|
virtual int | enumerate_sections (const ACE_Configuration_Section_Key &key, int index, ACE_TString &name)=0 |
|
virtual int | set_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const ACE_TString &value)=0 |
| Sets a string-typed value. More...
|
|
virtual int | set_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int value)=0 |
| Sets a integer-typed value. More...
|
|
virtual int | set_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, const void *data, size_t length)=0 |
| Sets a binary-typed value. More...
|
|
virtual int | get_string_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, ACE_TString &value)=0 |
| Gets a string-typed value. More...
|
|
virtual int | get_integer_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, u_int &value)=0 |
| Gets an integer-typed value. More...
|
|
virtual int | get_binary_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, void *&data, size_t &length)=0 |
| Gets a binary-typed value. More...
|
|
virtual int | find_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, VALUETYPE &type)=0 |
|
virtual int | remove_value (const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name)=0 |
| Removes a named value. More...
|
|
int | expand_path (const ACE_Configuration_Section_Key &key, const ACE_TString &path_in, ACE_Configuration_Section_Key &key_out, int create=1) |
|
bool | operator== (const ACE_Configuration &rhs) const |
|
bool | operator!= (const ACE_Configuration &rhs) const |
|
Base class for configuration databases.
This class provides an interface for configuration databases. A concrete class is required that implements the interface.
- See also
- ACE_Configuration_Heap
-
ACE_Configuration_Win32Registry
Enumeration for the various types of values we can store.
Enumerator |
---|
STRING |
|
INTEGER |
|
BINARY |
|
INVALID |
|
ACE_Configuration::~ACE_Configuration |
( |
void |
| ) |
|
|
virtual |
ACE_Configuration::ACE_Configuration |
( |
void |
| ) |
|
|
protected |
Enumerates through the subsections in a section.
- Parameters
-
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. |
- Note
- You may not modify the key section while enumerating. If the section is modified during enumeration, results are undefined; you must restart the enumeration from index 0.
- Return values
-
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. |
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Enumerates through the values in a section.
- Parameters
-
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. |
- Note
- You may not delete or add values while enumerating. If the section is modified during enumeration, results are undefined; you must restart the enumeration from index 0.
- Return values
-
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. |
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Expands path_in to key_out from key. If create is true, the subsections are created. Returns 0 on success, non zero on error The path consists of sections separated by the backslash '\' or forward slash '/'. Returns 0 on success, -1 if <create) is 0 and the path refers a nonexistant section
Retrieves the type of a named configuration value.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Gets a binary-typed value.
- Parameters
-
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. |
- Return values
-
0 | for success; caller is responsible for freeing the returned memory. |
-1 | for error; ACE_OS::last_error() retrieves error code. |
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Gets an integer-typed value.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Resolves the internal key from a section key.
Gets a string-typed value.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Opens a named section in an existing section.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Determine if the contents of this object are different from the contents of the object on the right hand side. Returns false if they are equal and true if they are not equal
Determine if the contents of this object is the same as the contents of the object on the right hand side. Returns true if they are equal and false if they are not equal
Determine if the contents of this object is the same as the contents of the object on the right hand side. Returns 1 (True) if they are equal and 0 (False) if they are not equal
Removes a named section.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Obtain a reference to the root section of this configuration.
Sets a binary-typed value.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Sets a integer-typed value.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
Sets a string-typed value.
- Parameters
-
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. |
- Return values
-
Implemented in ACE_Configuration_Heap, and ACE_Configuration_Win32Registry.
int ACE_Configuration::validate_name |
( |
const ACE_TCHAR * |
name, |
|
|
int |
allow_path = 0 |
|
) |
| |
|
protected |
Tests to see if name is valid. name must be < 255 characters and not contain the path separator '\', brackets [] or = (maybe just restrict to alphanumeric?) returns non zero if name is not valid. The path separator is allowed, except for the first character, if allow_path is true.
int ACE_Configuration::validate_value_name |
( |
const ACE_TCHAR * |
name | ) |
|
|
protected |
Test to see if name is valid. The default value for a key can be unnamed, which means either name is == 0 or name == '\0` is valid. Otherwise, it calls validate_name() to test name for the same rules that apply to keys.
ACE_TCHAR ACE_Configuration::NULL_String_ = '\0' |
|
static |
- Represents the "NULL" string to simplify the internal logic.
The documentation for this class was generated from the following files: