W32DLib
W32DLib::Registry Class Reference

The Registry class. More...

#include <w32dlib/registry.h>

Public Member Functions

 Registry (HKEY root, const TCHAR *path, bool permanent)
 Opens the supplied registry key read/write.
 
 Registry (HKEY root, const TCHAR *path)
 Opens the supplied registry key read only.
 
virtual ~Registry ()
 Destructor.
 
bool IsOpen ()
 Sees whether the key was opened.
 
bool Read (const TCHAR *name, bool &val)
 Reads a boolean value from the registry.
 
bool Read (const TCHAR *name, unsigned &val)
 Reads an integer value from the registry.
 
bool Read (const TCHAR *name, W32String &val)
 Reads a string value from the registry.
 
bool Write (const TCHAR *name, bool val)
 Writes a boolean value to the registry.
 
bool Write (const TCHAR *name, unsigned val)
 Writes an integer value to the registry.
 
bool Write (const TCHAR *name, const TCHAR *val)
 Writes a string value to the registry.
 
bool Write (const TCHAR *name, const W32String &val)
 Writes a string value to the registry.
 

Detailed Description

The Registry class.

Gives basic registry access.

Constructor & Destructor Documentation

W32DLib::Registry::Registry ( HKEY  root,
const TCHAR *  path,
bool  permanent 
)

Opens the supplied registry key read/write.

Parameters
rootThe root of the key (use Windows HKEY_xxx constants).
pathThe path to the key.
permanentIf false then the key is created volatile (ie. not saved to disk). This is ignored by Windows for Win9X.
W32DLib::Registry::Registry ( HKEY  root,
const TCHAR *  path 
)

Opens the supplied registry key read only.

Parameters
rootThe root of the key (use Windows HKEY_xxx constants).
pathThe path to the key.
virtual W32DLib::Registry::~Registry ( )
virtual

Destructor.

This closes the registry key.

Member Function Documentation

bool W32DLib::Registry::IsOpen ( )

Sees whether the key was opened.

Returns
True if the key was created/opened OK.
bool W32DLib::Registry::Read ( const TCHAR *  name,
bool &  val 
)

Reads a boolean value from the registry.

Booleans are implemented as a DWORD entry with a value 1 or 0.

Parameters
nameThe name of the value.
valA reference to a place to store the result.
Returns
True if the value could be read.
bool W32DLib::Registry::Read ( const TCHAR *  name,
unsigned &  val 
)

Reads an integer value from the registry.

Parameters
nameThe name of the value.
valA reference to a place to store the result.
Returns
True if the value could be read.
bool W32DLib::Registry::Read ( const TCHAR *  name,
W32String val 
)

Reads a string value from the registry.

Parameters
nameThe name of the value.
valA reference to a place to store the result.
Returns
True if the value could be read.
bool W32DLib::Registry::Write ( const TCHAR *  name,
bool  val 
)

Writes a boolean value to the registry.

Booleans are implemented as a DWORD entry with a value 1 or 0.

Parameters
nameThe name of the value.
valThe value.
Returns
True if the value could be read.
bool W32DLib::Registry::Write ( const TCHAR *  name,
unsigned  val 
)

Writes an integer value to the registry.

Parameters
nameThe name of the value.
valThe value.
Returns
True if the value was written.
bool W32DLib::Registry::Write ( const TCHAR *  name,
const TCHAR *  val 
)

Writes a string value to the registry.

Parameters
nameThe name of the value.
valThe value.
Returns
True if the value was written.
bool W32DLib::Registry::Write ( const TCHAR *  name,
const W32String val 
)

Writes a string value to the registry.

Parameters
nameThe name of the value.
valThe value.
Returns
True if the value was written.

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