Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

AnyConfig::AcRegConfig Class Reference

Access the registry for configuration information. More...

#include <AnyConfig.h>

Inheritance diagram for AnyConfig::AcRegConfig::

AnyConfig::AcConfiguration List of all members.

Public Methods

 AcRegConfig ()
 Constructor method. More...

virtual ~AcRegConfig ()
 Destructor method. More...

virtual bool copyTo (AcWriteableConfig *pWriteableConfig)
 Copy this configuration to another configuration. More...

virtual void display ()
 Mostly for debugging purposes, display the configuration. More...

virtual bool getSectionStr (const char *pSection, const char *pKey, CString &rValue)
 Like getStr() but can fetch keys from another section than the current one. More...

virtual bool getStr (const char *pKey, CString &rValue)
 Retrieve a string from the configuration for the specified key. More...

virtual bool initialize (AcConfiguration &parentConfig)
 Not used with AcRegConfig, use the HKEY overloaded function instead. More...

virtual bool initialize (HKEY hKey, AcConfiguration &parentConfig)
 Initialize a registry configuration class. More...

virtual bool initRequired ()
 Returns true if the derived AcConfiguration requires to be initialized. More...

virtual bool keyExists (const char *pKey)
 Check if a given key exists. More...


Private Methods

void copyBranch (HKEY hKey)
 Copy the keys. More...

void copyLeaves (HKEY hKey)
 Copy the values. More...

void copyTree (HKEY hKey)
 This tree has leaves growing on its roots... More...

bool initialize (HKEY hKey, const char *keyPath)
 Recursively open subKeys until we're there. More...

void ConstructorInclude ()
 Method which must be called first in a constructor. More...

void DestructorInclude ()
 Method which must be called first in a destructor. More...


Private Attributes

AcMemConfig _copy

Detailed Description

Access the registry for configuration information.

If you don't know what this could mean you are a lucky person. Otherwise, use it if you have to, write a better implementation if you actually like this.


Constructor & Destructor Documentation

AnyConfig::AcRegConfig::AcRegConfig ( )
 

Constructor method.

AnyConfig::AcRegConfig::~AcRegConfig ( ) [virtual]
 

Destructor method.


Member Function Documentation

void AnyConfig::AcRegConfig::ConstructorInclude ( ) [private]
 

Method which must be called first in a constructor.

Reimplemented from AnyConfig::AcConfiguration.

void AnyConfig::AcRegConfig::DestructorInclude ( ) [private]
 

Method which must be called first in a destructor.

Reimplemented from AnyConfig::AcConfiguration.

void AnyConfig::AcRegConfig::copyBranch ( HKEY hKey ) [private]
 

Copy the keys.

void AnyConfig::AcRegConfig::copyLeaves ( HKEY hKey ) [private]
 

Copy the values.

bool AnyConfig::AcRegConfig::copyTo ( AcWriteableConfig * pWriteableConfig ) [virtual]
 

Copy this configuration to another configuration.

This method is specifically handy when the source configuration comes from a text file and the destination configuration is AcMemConfig, which offers much more functionality. Along the same lines, this method can be used to save an AcMemConfig in a file. If the target configuration already has filled-in items, the result of this operation is undefined. Some derived classes may end up containing a merged result of the old and the new values (AcMemConfig, AcEnvConfig), other may only contain the copied values (like AcFileConfig).

Parameters:
pWriteableConfig   A pointer to an initialized AcWriteableConfig.
return   True if the derived configuration supports copying, false otherwise.

Reimplemented from AnyConfig::AcConfiguration.

void AnyConfig::AcRegConfig::copyTree ( HKEY hKey ) [private]
 

This tree has leaves growing on its roots...

void AnyConfig::AcRegConfig::display ( ) [virtual]
 

Mostly for debugging purposes, display the configuration.

Reimplemented from AnyConfig::AcConfiguration.

bool AnyConfig::AcRegConfig::getSectionStr ( const char * pSection,
const char * pKey,
CString & rValue ) [virtual]
 

Like getStr() but can fetch keys from another section than the current one.

The default implementation just pushes _currentSection on stack, replaces it with the supplied section and calls the regular getStr() function.

Parameters:
pKey   The key to fetch.
pSection   The section to fetch it from.
rValue   The value found, if any.
Returns:
False if the key could not be found in the specified section.

Reimplemented from AnyConfig::AcConfiguration.

bool AnyConfig::AcRegConfig::getStr ( const char * pKey,
CString & rValue ) [virtual]
 

Retrieve a string from the configuration for the specified key.

Parameters:
pKey   The key to look for (in the current section).
rValue   Will be filled in with the value found.
Returns:
False if the key could not be located in the current section (if any).

Reimplemented from AnyConfig::AcConfiguration.

bool AnyConfig::AcRegConfig::initRequired ( ) [virtual]
 

Returns true if the derived AcConfiguration requires to be initialized.

See the initialize() function for the various derived classes for more details. Note that this function must return false once the initialization has been done once.

Reimplemented from AnyConfig::AcConfiguration.

bool AnyConfig::AcRegConfig::initialize ( HKEY hKey,
AcConfiguration & parentConfig ) [virtual]
 

Initialize a registry configuration class.

AcRegConfig is implemented as a read-only configuration. The actual contents is kept in-memory in a AcMemConfig.

The parent configuration must have a REGISTRYKEY item.
That string is taken to be a subKey of the handle passed.
The subKey may contain Back-slashes, these will be recursively opened. The (final) subKey will be scanned for any sub-subKeys, these will become sections. The values in those sub-subKeys will become configuration name-value pairs.

bool AnyConfig::AcRegConfig::initialize ( AcConfiguration & parentConfig ) [virtual]
 

Not used with AcRegConfig, use the HKEY overloaded function instead.

Reimplemented from AnyConfig::AcConfiguration.

bool AnyConfig::AcRegConfig::initialize ( HKEY hKey,
const char * keyPath ) [private]
 

Recursively open subKeys until we're there.

bool AnyConfig::AcRegConfig::keyExists ( const char * pKey ) [virtual]
 

Check if a given key exists.

Parameters:
key   The key to look for in [the current section in] the configuration.
Returns:
True if the key exists.

Reimplemented from AnyConfig::AcConfiguration.


The documentation for this class was generated from the following files:
Generated at Wed Nov 21 11:34:19 2001 for AnyConfig by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001