CrystalSpace

Public API Reference

csWin32RegistryConfig Class Reference

An iConfigFile, storing the settings in the Windows registry. More...

#include <csutil/win32/registrycfg.h>

Inheritance diagram for csWin32RegistryConfig:

List of all members.

Public Member Functions

virtual void Clear ()
 Delete all options and rewind all iterators.
void Close ()
 Close the current registry key.
virtual void DeleteKey (const char *Key)
 Delete a key and its value and comment.
virtual csPtr< iConfigIteratorEnumerate (const char *Subsection=0)
 Enumerate selected keys.
virtual bool GetBool (const char *Key, bool Def=false) const
 Get a boolean value from the configuration.
virtual const char * GetComment (const char *Key) const
 Get the comment of the given key, or 0 if no comment exists.
virtual const char * GetEOFComment () const
 return the final comment at the end of the configuration file
virtual const char * GetFileName () const
 Get configuration file name.
virtual float GetFloat (const char *Key, float Def=0.0) const
 Get a float value from the configuration.
virtual int GetInt (const char *Key, int Def=0) const
 Get an integer value from the configuration.
virtual const char * GetStr (const char *Key, const char *Def="") const
 Get a string value from the configuration.
virtual iVFSGetVFS () const
 Get the VFS object on which this file is stored (if any).
virtual bool KeyExists (const char *Key) const
 Test if a key exists.
virtual bool Load (const char *iFileName, iVFS *=0, bool Merge=false, bool NewWins=true)
 Load a configuration file.
bool Open (const char *Key, HKEY parent=HKEY_CURRENT_USER)
 Open a registry key.
virtual bool Save (const char *iFileName, iVFS *=0)
 Save configuration into the given file (on VFS or on the physical filesystem).
virtual bool Save ()
 Save configuration to the same place from which it was loaded.
virtual void SetBool (const char *Key, bool Value)
 Set a boolean value.
virtual bool SetComment (const char *Key, const char *Text)
 Set the comment for given key.
virtual void SetEOFComment (const char *Text)
 set the final comment at the end of the configuration file
virtual void SetFileName (const char *, iVFS *)
 Set config file name.
virtual void SetFloat (const char *Key, float Value)
 Set a floating-point value.
virtual void SetInt (const char *Key, int Value)
 Set an integer value.
virtual void SetStr (const char *Key, const char *Val)
 Set an null-terminated string value.
virtual bool SubsectionExists (const char *Subsection) const
 Test if at least one key exists with the given Subsection prefix.

Detailed Description

An iConfigFile, storing the settings in the Windows registry.

Remarks:
This class provides functionality specific to the Win32 platform. To ensure that code using this functionality compiles properly on all other platforms, the use of the class and inclusion of the header file should be surrounded by appropriate '#if defined(CS_PLATFORM_WIN32) ... #endif' statements.

Definition at line 43 of file registrycfg.h.


Member Function Documentation

virtual void csWin32RegistryConfig::Clear (  )  [virtual]

Delete all options and rewind all iterators.

Implements iConfigFile.

void csWin32RegistryConfig::Close (  ) 

Close the current registry key.

Use this if you want reuse a registry config object at a later time but want to free it's resources for the time being.

Remarks:
This is called automatically on destruction or Open().
virtual void csWin32RegistryConfig::DeleteKey ( const char *  Key  )  [virtual]

Delete a key and its value and comment.

Implements iConfigFile.

virtual csPtr<iConfigIterator> csWin32RegistryConfig::Enumerate ( const char *  Subsection = 0  )  [virtual]

Enumerate selected keys.

If a subsection is given, only those keys which are prefixed by the subsection string will be enumerated. The returned iterator does not yet point to a valid key. You must call Next() to set it to the first key.

Implements iConfigFile.

virtual bool csWin32RegistryConfig::GetBool ( const char *  Key,
bool  Def = false 
) const [virtual]

Get a boolean value from the configuration.

The optional default value (Def parameter) will be used if the key was not found.

Implements iConfigFile.

virtual const char* csWin32RegistryConfig::GetComment ( const char *  Key  )  const [virtual]

Get the comment of the given key, or 0 if no comment exists.

Implements iConfigFile.

virtual const char* csWin32RegistryConfig::GetEOFComment (  )  const [virtual]

return the final comment at the end of the configuration file

Implements iConfigFile.

virtual const char* csWin32RegistryConfig::GetFileName (  )  const [virtual]

Get configuration file name.

Implements iConfigFile.

virtual float csWin32RegistryConfig::GetFloat ( const char *  Key,
float  Def = 0.0 
) const [virtual]

Get a float value from the configuration.

The optional default value (Def parameter) will be used if the key was not found.

Implements iConfigFile.

virtual int csWin32RegistryConfig::GetInt ( const char *  Key,
int  Def = 0 
) const [virtual]

Get an integer value from the configuration.

The optional default value (Def parameter) will be used if the key was not found.

Implements iConfigFile.

virtual const char* csWin32RegistryConfig::GetStr ( const char *  Key,
const char *  Def = "" 
) const [virtual]

Get a string value from the configuration.

The optional default value (Def parameter) will be used if the key was not found.

Implements iConfigFile.

virtual iVFS* csWin32RegistryConfig::GetVFS (  )  const [virtual]

Get the VFS object on which this file is stored (if any).

Returns 0 if this file resides within the real (non-VFS) filesystem.

Implements iConfigFile.

virtual bool csWin32RegistryConfig::KeyExists ( const char *  Key  )  const [virtual]

Test if a key exists.

Implements iConfigFile.

virtual bool csWin32RegistryConfig::Load ( const char *  iFileName,
iVFS = 0,
bool  Merge = false,
bool  NewWins = true 
) [virtual]

Load a configuration file.

If the file resides in a real filesystem, rather than a VFS filesystem, then pass 0 for the VFS argument.

You can set the Merge flag to merge the newly loaded configuration information into the existing information. If you do so, nothing will happen if the named file doesn't exist. The NewWins flag determines the behavior in case of configuration key conflicts. If true, then the new configuration value replaces the old for that key. If false, then the old value is kept, and the new value is ignored. The recorded file name will be set to the name of the newly loaded file if the Merge flag is false; otherwise it will retain the old name.

Implements iConfigFile.

bool csWin32RegistryConfig::Open ( const char *  Key,
HKEY  parent = HKEY_CURRENT_USER 
)

Open a registry key.

This will open the key named Key as a subkey of parent.

Remarks:
The key must be the full path, e.g. "Software\CrystalSpace".
If parent is none of the default HKEY_ roots, the key must remain open as long as a registry config object isn't Close()d.
virtual bool csWin32RegistryConfig::Save ( const char *  iFileName,
iVFS = 0 
) [virtual]

Save configuration into the given file (on VFS or on the physical filesystem).

If the second parameter is skipped, the file will be written to the physical filesystem, otherwise it is stored on given VFS filesystem. This method does not change the internally stored file name.

Implements iConfigFile.

virtual bool csWin32RegistryConfig::Save (  )  [virtual]

Save configuration to the same place from which it was loaded.

Returns true if the save operation succeeded.

Implements iConfigFile.

virtual void csWin32RegistryConfig::SetBool ( const char *  Key,
bool  Value 
) [virtual]

Set a boolean value.

Implements iConfigFile.

virtual bool csWin32RegistryConfig::SetComment ( const char *  Key,
const char *  Text 
) [virtual]

Set the comment for given key.

In addition to an actual comment, you can use "" for Text to place an empty comment line before this key, or 0 to remove the comment entirely. The comment may contain newline characters. Returns false if the key does not exist.

Implements iConfigFile.

virtual void csWin32RegistryConfig::SetEOFComment ( const char *  Text  )  [virtual]

set the final comment at the end of the configuration file

Implements iConfigFile.

virtual void csWin32RegistryConfig::SetFileName ( const char *  ,
iVFS  
) [virtual]

Set config file name.

You can use this if you want Save() to write to another file. This will set the dirty flag.

Implements iConfigFile.

virtual void csWin32RegistryConfig::SetFloat ( const char *  Key,
float  Value 
) [virtual]

Set a floating-point value.

Implements iConfigFile.

virtual void csWin32RegistryConfig::SetInt ( const char *  Key,
int  Value 
) [virtual]

Set an integer value.

Implements iConfigFile.

virtual void csWin32RegistryConfig::SetStr ( const char *  Key,
const char *  Val 
) [virtual]

Set an null-terminated string value.

Implements iConfigFile.

virtual bool csWin32RegistryConfig::SubsectionExists ( const char *  Subsection  )  const [virtual]

Test if at least one key exists with the given Subsection prefix.

Implements iConfigFile.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1