NAME

ACE_Configuration_Win32Registry - The win32 registry implementation of a configuration database

SYNOPSIS

#include <ace/Configuration.h>

class ACE_Configuration_Win32Registry : public ACE_Configuration { public: ACE_EXPLICIT ACE_Configuration_Win32Registry (HKEY hKey); virtual ~ACE_Configuration_Win32Registry (void); virtual int open_section ( const ACE_Configuration_Section_Key& base, const TCHAR* sub_section, int create, ACE_Configuration_Section_Key& result ); virtual int remove_section ( const ACE_Configuration_Section_Key& key, const TCHAR* sub_section, int recursive ); 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 TCHAR* name, const ACE_TString& value ); virtual int set_integer_value ( const ACE_Configuration_Section_Key& key, const TCHAR* name, u_int value ); virtual int set_binary_value ( const ACE_Configuration_Section_Key& key, const TCHAR* name, const void* data, u_int length ); virtual int get_string_value ( const ACE_Configuration_Section_Key& key, const TCHAR* name, ACE_TString& value ); virtual int get_integer_value ( const ACE_Configuration_Section_Key& key, const TCHAR* name, u_int& value ); virtual int get_binary_value ( const ACE_Configuration_Section_Key& key, const TCHAR* name, void*& data, u_int& length ); virtual int remove_value ( const ACE_Configuration_Section_Key& key, const TCHAR* name ); static HKEY resolve_key ( HKEY hKey, const TCHAR* path, int create = 1 ); protected: int load_key ( const ACE_Configuration_Section_Key& key, HKEY& hKey ); ACE_Configuration_Win32Registry (void); ACE_Configuration_Win32Registry ( const ACE_Configuration_Win32Registry& rhs ); ACE_Configuration_Win32Registry& operator= ( const ACE_Configuration_Win32Registry& rhs ); };

DESCRIPTION

The ACE configuration API provides a portable abstraction for program configuration. The API supports a tree based hierarchy of configuration sections. Each section contains other sections or values. Values may contain string, unsigned integer and binary data.

PUBLIC MEMBERS

ACE_EXPLICIT ACE_Configuration_Win32Registry (HKEY hKey);

virtual ~ACE_Configuration_Win32Registry (void);

virtual int open_section (
    const ACE_Configuration_Section_Key& base,
    const TCHAR* sub_section,
    int create,
    ACE_Configuration_Section_Key& result
    );

virtual int remove_section (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* sub_section,
    int recursive
    );

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 TCHAR* name,
    const ACE_TString& value
    );

virtual int set_integer_value (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* name,
    u_int value
    );

virtual int set_binary_value (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* name,
    const void* data,
    u_int length
    );

virtual int get_string_value (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* name,
    ACE_TString& value
    );

virtual int get_integer_value (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* name,
    u_int& value
    );

virtual int get_binary_value (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* name,
    void*& data,
    u_int& length
    );

virtual int remove_value (
    const ACE_Configuration_Section_Key& key,
    const TCHAR* name
    );

static HKEY resolve_key (
    HKEY hKey,
    const TCHAR* path,
    int create = 1
    );

PROTECTED MEMBERS

int load_key (const ACE_Configuration_Section_Key& key, HKEY& hKey);

ACE_Configuration_Win32Registry (void);

ACE_Configuration_Win32Registry (
    const ACE_Configuration_Win32Registry& rhs
    );

ACE_Configuration_Win32Registry& operator= (
    const ACE_Configuration_Win32Registry& rhs
    );

AUTHOR

Chris Hafey chris@stentorsoft.com

TODO

- Add locking for thread safety. - Need to investigate what happens if memory mapped file gets mapped to a location different than it was created with. - Implement export and import of binary values - Add dynamic buffer when importing. currently it will not allow importing of values greater than a fixed ammount (4096 bytes) - Replace unsigned int with a type that is fixed accross platforms.

LIBRARY

ace