comet::registry::value< error_policy > Class Template Reference

#include <comet/registry.h>

List of all members.

Public Member Functions

bool exists () const
 This can be used to query if a value exists.
 value (const impl::key_base &key, const tstring &value_name)
void swap (value &rhs)
 Non throwing swap.
void get (DWORD *type, BYTE *buffer, DWORD *number_bytes) const
 Get a value of any type. The arguments are passed directly to RegQueryValueEx.
LONG get_nothrow (DWORD *type, BYTE *buffer, DWORD *number_bytes) const
 Get a value - return errcode.
void set (DWORD type, const BYTE *buffer, DWORD number_bytes)
 Set a value arbitrarily. The arguments are passed directly to RegSetValueEx.
LONG set_nothrow (DWORD type, const BYTE *buffer, DWORD number_bytes)
 Set a value - return errcode.
tstring str () const
 Interpret value as a string.
tstring str (const tstring &default_val) const
 operator tstring () const
 Implicit conversion to string.
 operator DWORD () const
 Implicit conversion to unsigned int.
DWORD dword () const
 Interpret value as a DWORD.
DWORD dword (DWORD default_val) const
 operator std::pair () const
 operator std::pair () const
valueoperator= (const tstring &rhs)
 Assign a string value and set the type to REG_SZ.
valueoperator= (const DWORD &rhs)
 Assign a DWORD value and set the type to REG_DWORD.
valueoperator= (int rhs)
 Assign an integer value - sets type to REG_DWORD.
valueoperator= (const value &rhs)
 Assign value from another registry value.


Detailed Description

template<class error_policy>
class comet::registry::value< error_policy >

A pseudo-reference to a value in the registry. Assign to instances of this object to make changes to the corresponding registry value Read from this object to read values from the registry.


Member Function Documentation

template<class error_policy>
DWORD comet::registry::value< error_policy >::dword  )  const [inline]
 

Interpret value as a DWORD.

Exceptions:
com_error If the type is not REG_DWORD or REG_DWORD_LITTLE_ENDIAN (using standard error_policy)

template<class error_policy>
bool comet::registry::value< error_policy >::exists  )  const [inline]
 

This can be used to query if a value exists.

For example:

                        string get_thread_model(const regkey &clsid_key)
                        {
                                regkey::value_type t = clsid_key.open("InprocServer32", KEY_READ)["ThreadingModel"];
                                if(t.exists())
                                        return t.str();
                                else
                                        return "Single";
                        }

template<class error_policy>
void comet::registry::value< error_policy >::get DWORD *  type,
BYTE *  buffer,
DWORD *  number_bytes
const [inline]
 

Get a value of any type. The arguments are passed directly to RegQueryValueEx.

Parameters:
type Pointer to the type - can be 0
buffer Pointer to a buffer - can be 0
number_bytes Indicates size of the buffer - can be 0 if buffer is 0

template<class error_policy>
LONG comet::registry::value< error_policy >::get_nothrow DWORD *  type,
BYTE *  buffer,
DWORD *  number_bytes
const [inline]
 

Get a value - return errcode.

Parameters:
type Pointer to the type - can be 0
buffer Pointer to a buffer - can be 0
number_bytes Indicates size of the buffer - can be 0 if buffer is 0

template<class error_policy>
value& comet::registry::value< error_policy >::operator= const value< error_policy > &  rhs  )  [inline]
 

Assign value from another registry value.

Because value objects always refer to a part of the registry, this effectively copies a registry value from somewhere else in the registry.

template<class error_policy>
void comet::registry::value< error_policy >::set DWORD  type,
const BYTE *  buffer,
DWORD  number_bytes
[inline]
 

Set a value arbitrarily. The arguments are passed directly to RegSetValueEx.

Parameters:
type Type to set it to (e.g. REG_SZ)
buffer Pointer to a buffer
number_bytes Indicates size of the buffer

template<class error_policy>
LONG comet::registry::value< error_policy >::set_nothrow DWORD  type,
const BYTE *  buffer,
DWORD  number_bytes
[inline]
 

Set a value - return errcode.

Parameters:
type Type to set it to (e.g. REG_SZ)
buffer Pointer to a buffer
number_bytes Indicates size of the buffer

template<class error_policy>
tstring comet::registry::value< error_policy >::str  )  const [inline]
 

Interpret value as a string.

Exceptions:
com_error If the type is not REG_SZ or REG_EXPAND_SZ (using standard error_policy)

template<class error_policy>
void comet::registry::value< error_policy >::swap value< error_policy > &  rhs  )  [inline]
 

Non throwing swap.

This is for efficiency only. operator= is overloaded to have a different meaning (copying one part of the registry to another part of the registry).


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