LibreOffice Module registry (master) 1
Public Member Functions | Public Attributes | Friends | List of all members
RegistryKey Class Reference

RegistryKey reads or writes information of the underlying key in a registry. More...

#include <registry.hxx>

Collaboration diagram for RegistryKey:
[legend]

Public Member Functions

 RegistryKey ()
 Default constructor. More...
 
 RegistryKey (const RegistryKey &toCopy)
 Copy constructor. More...
 
 ~RegistryKey ()
 Destructor, close the key if it references an open one. More...
 
RegistryKeyoperator= (const RegistryKey &toAssign)
 Assign operator. More...
 
bool isValid () const
 checks if the key points to a valid registry key. More...
 
bool isReadOnly () const
 returns the access mode of the key. More...
 
OUString getName ()
 returns the full qualified name of the key beginning with the rootkey. More...
 
RegError createKey (const OUString &keyName, RegistryKey &rNewKey)
 creates a new key or opens a key if the specified key already exists. More...
 
RegError openKey (const OUString &keyName, RegistryKey &rOpenKey)
 opens the specified key. More...
 
RegError openSubKeys (const OUString &keyName, RegistryKeyArray &rSubKeys)
 opens all subkeys of the specified key. More...
 
RegError getKeyNames (const OUString &keyName, RegistryKeyNames &rSubKeyNames)
 returns an array with the names of all subkeys of the specified key. More...
 
RegError deleteKey (const OUString &keyName)
 deletes the specified key. More...
 
RegError closeKey ()
 closes explicitly the current key More...
 
RegError setValue (const OUString &keyName, RegValueType valueType, RegValue pValue, sal_uInt32 valueSize)
 sets a value of a key. More...
 
RegError setLongListValue (const OUString &keyName, sal_Int32 const *pValueList, sal_uInt32 len)
 sets a long list value of a key. More...
 
RegError setStringListValue (const OUString &keyName, char **pValueList, sal_uInt32 len)
 sets an ascii list value of a key. More...
 
RegError setUnicodeListValue (const OUString &keyName, sal_Unicode **pValueList, sal_uInt32 len)
 sets a unicode string list value of a key. More...
 
RegError getValueInfo (const OUString &keyName, RegValueType *pValueType, sal_uInt32 *pValueSize)
 gets info about type and size of a value. More...
 
RegError getValue (const OUString &keyName, RegValue pValue)
 gets the value of a key. More...
 
RegError getLongListValue (const OUString &keyName, RegistryValueList< sal_Int32 > &rValueList)
 gets a long list value of a key. More...
 
RegError getStringListValue (const OUString &keyName, RegistryValueList< char * > &rValueList)
 gets an ascii list value of a key. More...
 
RegError getUnicodeListValue (const OUString &keyName, RegistryValueList< sal_Unicode * > &rValueList)
 gets a unicode value of a key. More...
 
RegError getResolvedKeyName (const OUString &keyName, OUString &rResolvedName) const
 resolves a keyname. More...
 
OUString getRegistryName ()
 returns the name of the registry in which the key is defined. More...
 

Public Attributes

Registry m_registry
 stores the registry on which this key works More...
 
RegKeyHandle m_hImpl
 stores the current key handle of this key More...
 

Friends

class Registry
 

Detailed Description

RegistryKey reads or writes information of the underlying key in a registry.

Class is inline and use a load on call C-Api.

Definition at line 327 of file registry.hxx.

Constructor & Destructor Documentation

◆ RegistryKey() [1/2]

RegistryKey::RegistryKey ( )
inline

Default constructor.

Definition at line 622 of file registry.hxx.

◆ RegistryKey() [2/2]

RegistryKey::RegistryKey ( const RegistryKey toCopy)
inline

Copy constructor.

Definition at line 636 of file registry.hxx.

References m_hImpl, Registry::m_pApi, and m_registry.

◆ ~RegistryKey()

RegistryKey::~RegistryKey ( )
inline

Destructor, close the key if it references an open one.

Definition at line 651 of file registry.hxx.

References m_hImpl, Registry::m_pApi, and m_registry.

Member Function Documentation

◆ closeKey()

RegError RegistryKey::closeKey ( )
inline

closes explicitly the current key

Definition at line 768 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, RegError, and Registry.

Referenced by createKey(), and openKey().

◆ createKey()

RegError RegistryKey::createKey ( const OUString &  keyName,
RegistryKey rNewKey 
)
inline

creates a new key or opens a key if the specified key already exists.

The specified keyname is relative to this key.

Parameters
keyNamespecifies the name of the key which will be opened or created.
rNewKeyreferences a RegistryKey which will be filled with the new or open key.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 689 of file registry.hxx.

References closeKey(), INVALID_KEY, Registry::isValid(), isValid(), m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, and RegError.

◆ deleteKey()

RegError RegistryKey::deleteKey ( const OUString &  keyName)
inline

deletes the specified key.

Parameters
keyNamespecifies the name of the key which will be deleted.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 760 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ getKeyNames()

RegError RegistryKey::getKeyNames ( const OUString &  keyName,
RegistryKeyNames rSubKeyNames 
)
inline

returns an array with the names of all subkeys of the specified key.

The specified keyname is relative to this key.

Parameters
keyNamespecifies the name of the key which subkey names will be returned.
rSubKeyNamesreference a RegistryKeyNames array which will be filled with the subkey names.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 738 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, RegError, and RegistryKeyNames::setKeyNames().

◆ getLongListValue()

RegError RegistryKey::getLongListValue ( const OUString &  keyName,
RegistryValueList< sal_Int32 > &  rValueList 
)
inline

gets a long list value of a key.

Parameters
keyNamespecifies the name of the key which value will be returned. If keyName is an empty string, the value is get from the key specified by hKey.
rValueListreferences a RegistryValueList which will be filled with the long values.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 847 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), length, LONGLIST, m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, RegError, and RegistryValueList< ValueType >::setValueList().

◆ getName()

OUString RegistryKey::getName ( )
inline

returns the full qualified name of the key beginning with the rootkey.

Definition at line 681 of file registry.hxx.

References Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ getRegistryName()

OUString RegistryKey::getRegistryName ( )
inline

returns the name of the registry in which the key is defined.

Definition at line 928 of file registry.hxx.

References Registry::getName(), Registry::isValid(), and m_registry.

◆ getResolvedKeyName()

RegError RegistryKey::getResolvedKeyName ( const OUString &  keyName,
OUString &  rResolvedName 
) const
inline

resolves a keyname.

Parameters
[in]keyNamespecifies the name of the key which will be resolved relative to this key. The resolved name will be prefixed with the name of this key.
[out]rResolvedNamethe resolved name.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 916 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ getStringListValue()

RegError RegistryKey::getStringListValue ( const OUString &  keyName,
RegistryValueList< char * > &  rValueList 
)
inline

gets an ascii list value of a key.

Parameters
keyNamespecifies the name of the key which value will be returned. If keyName is an empty string, the value is get from the key specified by hKey.
rValueListreferences a RegistryValueList which will be filled with the ascii values.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 870 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), length, m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, RegError, RegistryValueList< ValueType >::setValueList(), and STRINGLIST.

◆ getUnicodeListValue()

RegError RegistryKey::getUnicodeListValue ( const OUString &  keyName,
RegistryValueList< sal_Unicode * > &  rValueList 
)
inline

gets a unicode value of a key.

Parameters
keyNamespecifies the name of the key which value will be returned. If keyName is an empty string, the value is get from the key specified by hKey.
rValueListreference a RegistryValueList which will be filled with the unicode values.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 893 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), length, m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, RegError, and RegistryValueList< ValueType >::setValueList().

◆ getValue()

RegError RegistryKey::getValue ( const OUString &  keyName,
RegValue  pValue 
)
inline

gets the value of a key.

Parameters
keyNamespecifies the name of the key which value will be returned. If keyName is an empty string, the value is get from the key specified by hKey.
pValuepoints to an allocated memory block receiving the data of the value.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 838 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ getValueInfo()

RegError RegistryKey::getValueInfo ( const OUString &  keyName,
RegValueType pValueType,
sal_uInt32 *  pValueSize 
)
inline

gets info about type and size of a value.

Parameters
keyNamespecifies the name of the key which value info will be returned. If keyName is an empty string, the value info of the key specified by hKey will be returned.
pValueTypereturns the type of the value.
pValueSizereturns the size of the value in bytes or the length of a list value.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 828 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ isReadOnly()

bool RegistryKey::isReadOnly ( ) const
inline

returns the access mode of the key.

Returns
TRUE if access mode is read only else FALSE.

Definition at line 673 of file registry.hxx.

References Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ isValid()

bool RegistryKey::isValid ( ) const
inline

checks if the key points to a valid registry key.

Definition at line 670 of file registry.hxx.

References m_hImpl.

Referenced by createKey(), and openKey().

◆ openKey()

RegError RegistryKey::openKey ( const OUString &  keyName,
RegistryKey rOpenKey 
)
inline

opens the specified key.

The specified keyname is relative to this key.

Parameters
keyNamespecifies the name of the key which will be opened.
rOpenKeyreferences a RegistryKey which will be filled with the open key.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 702 of file registry.hxx.

References closeKey(), INVALID_KEY, Registry::isValid(), isValid(), m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, and RegError.

◆ openSubKeys()

RegError RegistryKey::openSubKeys ( const OUString &  keyName,
RegistryKeyArray rSubKeys 
)
inline

opens all subkeys of the specified key.

The specified keyname is relative to this key.

Parameters
keyNamespecifies the name of the key which subkeys will be opened.
rSubKeysreference a RegistryKeyArray which will be filled with the open subkeys.
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 716 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, m_registry, NO_ERROR, RegError, and RegistryKeyArray::setKeyHandles().

◆ operator=()

RegistryKey & RegistryKey::operator= ( const RegistryKey toAssign)
inline

Assign operator.

Definition at line 657 of file registry.hxx.

References m_hImpl, Registry::m_pApi, and m_registry.

◆ setLongListValue()

RegError RegistryKey::setLongListValue ( const OUString &  keyName,
sal_Int32 const *  pValueList,
sal_uInt32  len 
)
inline

sets a long list value of a key.

Parameters
keyNamespecifies the name of the key which value will be set. If keyName is an empty string, the value will be set for the key specified by hKey.
pValueListpoints to an array of longs containing the data for the value.
lenspecifies the length of the list (the array referenced by pValueList).
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 795 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ setStringListValue()

RegError RegistryKey::setStringListValue ( const OUString &  keyName,
char **  pValueList,
sal_uInt32  len 
)
inline

sets an ascii list value of a key.

Parameters
keyNamespecifies the name of the key which value will be set. If keyName is an empty string, the value will be set for the key specified by hKey.
pValueListpoints to an array of char* containing the data for the value.
lenspecifies the length of the list (the array referenced by pValueList).
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 806 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ setUnicodeListValue()

RegError RegistryKey::setUnicodeListValue ( const OUString &  keyName,
sal_Unicode **  pValueList,
sal_uInt32  len 
)
inline

sets a unicode string list value of a key.

Parameters
keyNamespecifies the name of the key which value will be set. If keyName is an empty string, the value will be set for the key specified by hKey.
pValueListpoints to an array of sal_Unicode* containing the data for the value.
lenspecifies the length of the list (the array referenced by pValueList).
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 817 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

◆ setValue()

RegError RegistryKey::setValue ( const OUString &  keyName,
RegValueType  valueType,
RegValue  pValue,
sal_uInt32  valueSize 
)
inline

sets a value of a key.

Parameters
keyNamespecifies the name of the key which value will be set. If keyName is an empty string, the value will be set for the key specified by hKey.
valueTypespecifies the type of the value.
pValuepoints to a memory block containing the data for the value.
valueSizespecifies the size of pData in bytes
Returns
RegError::NO_ERROR if succeeds else an error code.

Definition at line 783 of file registry.hxx.

References INVALID_KEY, Registry::isValid(), m_hImpl, Registry::m_pApi, and m_registry.

Friends And Related Function Documentation

◆ Registry

friend class Registry
friend

Definition at line 528 of file registry.hxx.

Referenced by closeKey().

Member Data Documentation

◆ m_hImpl

RegKeyHandle RegistryKey::m_hImpl

◆ m_registry

Registry RegistryKey::m_registry

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