LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/registry - registry.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 158 270 58.5 %
Date: 2012-12-27 Functions: 38 70 54.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _REGISTRY_REGISTRY_HXX_
      21             : #define _REGISTRY_REGISTRY_HXX_
      22             : 
      23             : #include <registry/regdllapi.h>
      24             : #include <registry/regtype.h>
      25             : #include <rtl/ustring.hxx>
      26             : 
      27             : #ifdef __cplusplus
      28             : extern "C" {
      29             : #endif
      30             : 
      31             : /** specifies a collection of function pointers which represents the complete registry C-API.
      32             : 
      33             :     This funtions pointers are used by the C++ wrapper to call the C-API.
      34             : */
      35             : struct Registry_Api
      36             : {
      37             :     void        (REGISTRY_CALLTYPE *acquire)            (RegHandle);
      38             :     void        (REGISTRY_CALLTYPE *release)            (RegHandle);
      39             :     sal_Bool    (REGISTRY_CALLTYPE *isReadOnly)         (RegHandle);
      40             :     RegError    (REGISTRY_CALLTYPE *openRootKey)        (RegHandle, RegKeyHandle*);
      41             :     RegError    (REGISTRY_CALLTYPE *getName)            (RegHandle, rtl_uString**);
      42             :     RegError    (REGISTRY_CALLTYPE *createRegistry)     (rtl_uString*, RegHandle*);
      43             :     RegError    (REGISTRY_CALLTYPE *openRegistry)       (rtl_uString*, RegHandle*, RegAccessMode);
      44             :     RegError    (REGISTRY_CALLTYPE *closeRegistry)      (RegHandle);
      45             :     RegError    (REGISTRY_CALLTYPE *destroyRegistry)    (RegHandle, rtl_uString*);
      46             :     RegError    (REGISTRY_CALLTYPE *loadKey)            (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
      47             :     RegError    (REGISTRY_CALLTYPE *saveKey)            (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
      48             :     RegError    (REGISTRY_CALLTYPE *mergeKey)           (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*, sal_Bool, sal_Bool);
      49             :     RegError    (REGISTRY_CALLTYPE *dumpRegistry)       (RegHandle, RegKeyHandle);
      50             :     void        (REGISTRY_CALLTYPE *acquireKey)         (RegKeyHandle);
      51             :     void        (REGISTRY_CALLTYPE *releaseKey)         (RegKeyHandle);
      52             :     sal_Bool    (REGISTRY_CALLTYPE *isKeyReadOnly)      (RegKeyHandle);
      53             :     RegError    (REGISTRY_CALLTYPE *getKeyName)         (RegKeyHandle, rtl_uString**);
      54             :     RegError    (REGISTRY_CALLTYPE *createKey)          (RegKeyHandle, rtl_uString*, RegKeyHandle*);
      55             :     RegError    (REGISTRY_CALLTYPE *openKey)            (RegKeyHandle, rtl_uString*, RegKeyHandle*);
      56             :     RegError    (REGISTRY_CALLTYPE *openSubKeys)        (RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
      57             :     RegError    (REGISTRY_CALLTYPE *closeSubKeys)       (RegKeyHandle*, sal_uInt32);
      58             :     RegError    (REGISTRY_CALLTYPE *deleteKey)          (RegKeyHandle, rtl_uString*);
      59             :     RegError    (REGISTRY_CALLTYPE *closeKey)           (RegKeyHandle);
      60             :     RegError    (REGISTRY_CALLTYPE *setValue)           (RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
      61             :     RegError    (REGISTRY_CALLTYPE *setLongListValue)   (RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
      62             :     RegError    (REGISTRY_CALLTYPE *setStringListValue) (RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
      63             :     RegError    (REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
      64             :     RegError    (REGISTRY_CALLTYPE *getValueInfo)       (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
      65             :     RegError    (REGISTRY_CALLTYPE *getValue)           (RegKeyHandle, rtl_uString*, RegValue);
      66             :     RegError    (REGISTRY_CALLTYPE *getLongListValue)   (RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
      67             :     RegError    (REGISTRY_CALLTYPE *getStringListValue) (RegKeyHandle, rtl_uString*, sal_Char***, sal_uInt32*);
      68             :     RegError    (REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
      69             :     RegError    (REGISTRY_CALLTYPE *freeValueList)      (RegValueType, RegValue, sal_uInt32);
      70             :     RegError    (REGISTRY_CALLTYPE *createLink)         (RegKeyHandle, rtl_uString*, rtl_uString*);
      71             :     RegError    (REGISTRY_CALLTYPE *deleteLink)         (RegKeyHandle, rtl_uString*);
      72             :     RegError    (REGISTRY_CALLTYPE *getKeyType)         (RegKeyHandle, rtl_uString*, RegKeyType*);
      73             :     RegError    (REGISTRY_CALLTYPE *getLinkTarget)      (RegKeyHandle, rtl_uString*, rtl_uString**);
      74             :     RegError    (REGISTRY_CALLTYPE *getResolvedKeyName) (RegKeyHandle, rtl_uString*, sal_Bool, rtl_uString**);
      75             :     RegError    (REGISTRY_CALLTYPE *getKeyNames)        (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
      76             :     RegError    (REGISTRY_CALLTYPE *freeKeyNames)       (rtl_uString**, sal_uInt32);
      77             : };
      78             : 
      79             : /** the API initialization function.
      80             : */
      81             : REG_DLLPUBLIC Registry_Api* REGISTRY_CALLTYPE initRegistry_Api(void);
      82             : 
      83             : #ifdef __cplusplus
      84             : }
      85             : #endif
      86             : 
      87             : 
      88             : class RegistryKey;
      89             : 
      90             : //-----------------------------------------------------------------------------
      91             : 
      92             : /** The Registry provides the functionality to read and write information in a registry file.
      93             : 
      94             :     The class is implemented inline and use a C-Api.
      95             : */
      96             : class Registry
      97             : {
      98             : public:
      99             :     /** Default constructor.
     100             :      */
     101             :     inline Registry();
     102             : 
     103             :     /// Copy constructcor
     104             :     inline Registry(const Registry& toCopy);
     105             : 
     106             :     /// Destructor. The Destructor close the registry if it is open.
     107             :     inline ~Registry();
     108             : 
     109             :     /// Assign operator
     110             :     inline Registry& operator = (const Registry& toAssign);
     111             : 
     112             :     /// checks if the registry points to a valid registry data file.
     113             :     inline sal_Bool isValid() const;
     114             : 
     115             :     /** returns the access mode of the registry.
     116             : 
     117             :         @return TRUE if the access mode is readonly else FALSE.
     118             :     */
     119             :     inline sal_Bool     isReadOnly() const;
     120             : 
     121             :     /** opens the root key of the registry.
     122             : 
     123             :         @param  rRootKey reference to a RegistryKey which is filled with the rootkey.
     124             :         @return REG_NO_ERROR if succeeds else an error code.
     125             :     */
     126             :     inline RegError openRootKey(RegistryKey& rRootKey);
     127             : 
     128             :     /// returns the name of the current registry data file.
     129             :     inline ::rtl::OUString getName();
     130             : 
     131             :     /** creates a new registry with the specified name and creates a root key.
     132             : 
     133             :         @param  registryName specifies the name of the new registry.
     134             :         @return REG_NO_ERROR if succeeds else an error code.
     135             :     */
     136             :     inline RegError create(const ::rtl::OUString& registryName);
     137             : 
     138             :     /** opens a registry with the specified name.
     139             : 
     140             :         If the registry already points to a valid registry, the old registry will be closed.
     141             :         @param  registryName specifies a registry name.
     142             :         @param  accessMode specifies the access mode for the registry, REG_READONLY or REG_READWRITE.
     143             :         @return REG_NO_ERROR if succeeds else an error code.
     144             :     */
     145             :     inline RegError open(const ::rtl::OUString& registryName,
     146             :                             RegAccessMode accessMode);
     147             : 
     148             :     /// closes explicitly the current registry data file.
     149             :     inline RegError close();
     150             : 
     151             :     /** destroys a registry.
     152             : 
     153             :         @param registryName specifies a registry name, if the name is an empty string the registry
     154             :                             itselfs will be destroyed.
     155             :         @return REG_NO_ERROR if succeeds else an error code.
     156             :     */
     157             :     inline RegError destroy(const ::rtl::OUString& registryName);
     158             : 
     159             :     /** loads registry information from a specified file and save it under the
     160             :         specified keyName.
     161             : 
     162             :         @param  rKey references a currently open key. The key which should store the registry information
     163             :                      is a subkey of this key.
     164             :         @param  keyName specifies the name of the key which stores the registry information. If keyName is
     165             :                         is an empty string the registry information will be saved under the key specified
     166             :                         by rKey.
     167             :         @param  regFileName specifies the file containing the registry information.
     168             :         @return REG_NO_ERROR if succeeds else an error code.
     169             :     */
     170             :     inline RegError loadKey(RegistryKey& rKey,
     171             :                                const ::rtl::OUString& keyName,
     172             :                                const ::rtl::OUString& regFileName);
     173             : 
     174             :     /** saves the registry information of the specified key and all subkeys and save
     175             :         it in the specified file.
     176             : 
     177             :         @param  rKey references a currently open key. The key which information is saved by this
     178             :                      function is a subkey of this key.
     179             :         @param  keyName specifies the name of the key which information should be stored.
     180             :                         If keyName is an empty string the registry information under the key specified
     181             :                         by rKey is saved in the specified file.
     182             :         @param  regFileName specifies the file containing the registry information.
     183             :         @return REG_NO_ERROR if succeeds else an error code.
     184             :     */
     185             :     inline RegError saveKey(RegistryKey& rKey,
     186             :                                const ::rtl::OUString& keyName,
     187             :                                const ::rtl::OUString& regFileName);
     188             : 
     189             :     /** merges the registry information of the specified key with the registry
     190             :         information of the specified file.
     191             : 
     192             :         All existing keys will be extended and existing key values will be overwritten.
     193             :         @param  rKey references a currently open key. The key which information is merged by this
     194             :                      function is a subkey of this key
     195             :         @param  keyName specifies the name of the key which will be merged.
     196             :                         If keyName is an empty string the registry information under the key specified
     197             :                         by rKey is merged with the information from the specified file.
     198             :         @param  regFileName specifies the file containing the registry information.
     199             :         @param  bWarnings if TRUE the function returns an error if a key already exists.
     200             :         @param  bReport if TRUE the function reports warnings on stdout if a key already exists.
     201             :         @return REG_NO_ERROR if succeeds else an error code. If it returns an error the registry will
     202             :                 restore the state before merging.
     203             :     */
     204             :     inline RegError mergeKey(RegistryKey& rKey,
     205             :                                 const ::rtl::OUString& keyName,
     206             :                                 const ::rtl::OUString& regFileName,
     207             :                              sal_Bool bWarnings = sal_False,
     208             :                                 sal_Bool bReport = sal_False);
     209             : 
     210             :     /** This function reports the complete registry information of a key and all of its subkeys.
     211             : 
     212             :         All information which are available (keynames, value types, values, ...)
     213             :         will be printed to stdout for report issues only.
     214             :         @param  rKey references a currently open key which content will be reported.
     215             :         @return REG_NO_ERROR if succeeds else an error code.
     216             :     */
     217             :     inline RegError dumpRegistry(RegistryKey& rKey);
     218             : 
     219             :     friend class RegistryKey;
     220             :     friend class RegistryKeyArray;
     221             :     friend class RegistryKeyNames;
     222             : 
     223             :     /// returns the used registry Api.
     224           0 :     const Registry_Api* getApi() { return m_pApi; }
     225             : protected:
     226             : 
     227             :     /// stores the used and initialized registry Api.
     228             :     const Registry_Api*                          m_pApi;
     229             :     /// stores the handle of the underlying registry file on which most of the functions work.
     230             :     RegHandle                                    m_hImpl;
     231             : };
     232             : 
     233             : 
     234             : //-----------------------------------------------------------------------------
     235             : 
     236             : /** RegistryKeyArray represents an array of open keys.
     237             : 
     238             :     RegistryKeyArray is a helper class to work with an array of keys.
     239             : */
     240             : class RegistryKeyArray
     241             : {
     242             : public:
     243             :     /// Default constructor
     244             :     inline RegistryKeyArray();
     245             : 
     246             :     /// Destructor, all subkeys will be closed.
     247             :     inline ~RegistryKeyArray();
     248             : 
     249             :     /// returns the open key specified by index.
     250             :     inline RegistryKey getElement(sal_uInt32 index);
     251             : 
     252             :     /// returns the length of the array.
     253             :     inline sal_uInt32 getLength();
     254             : 
     255             :     friend class RegistryKey;
     256             : protected:
     257             :     /** sets the data of the key array.
     258             : 
     259             :         @param registry specifies the registry files where the keys are located.
     260             :         @param phKeys points to an array of open keys.
     261             :         @param length specifies the length of the array specified by phKeys.
     262             :      */
     263             :     inline void setKeyHandles(Registry& registry, RegKeyHandle* phKeys, sal_uInt32 length);
     264             :     /// close all subkeys
     265             :     inline RegError closeKeyHandles();
     266             : 
     267             :     /// stores the number of open subkeys, the number of elements.
     268             :     sal_uInt32      m_length;
     269             :     /// stores an array of open subkeys.
     270             :     RegKeyHandle*   m_phKeys;
     271             :     /// stores the handle to the registry file where the appropriate keys are located.
     272             :     Registry        m_registry;
     273             : };
     274             : 
     275             : 
     276             : /** RegistryKeyNames represents an array of key names.
     277             : 
     278             :     RegistryKeyNames is a helper class to work with an array of key names.
     279             : */
     280             : class RegistryKeyNames
     281             : {
     282             : public:
     283             :     /// Default constructor
     284             :     inline RegistryKeyNames();
     285             : 
     286             :     /// Destructor, the internal array with key names will be deleted.
     287             :     inline ~RegistryKeyNames();
     288             : 
     289             :     /// returns the name of the key sepecified by index.
     290             :     inline ::rtl::OUString getElement(sal_uInt32 index);
     291             : 
     292             :     /// returns the length of the array.
     293             :     inline sal_uInt32 getLength();
     294             : 
     295             :     friend class RegistryKey;
     296             : protected:
     297             :     /** sets the data of the array.
     298             : 
     299             :         @param registry specifies the registry files where the keys are located.
     300             :         @param pKeyNames points to an array of key names.
     301             :         @param length specifies the length of the array specified by pKeyNames.
     302             :      */
     303             :     inline void setKeyNames(Registry& registry, rtl_uString** pKeyNames, sal_uInt32 length);
     304             :     /// delete the array of key names.
     305             :     inline RegError freeKeyNames();
     306             : 
     307             :     /// stores the number of key names, the number of elements.
     308             :     sal_uInt32      m_length;
     309             :     /// stores an array of key names.
     310             :     rtl_uString**   m_pKeyNames;
     311             :     /// stores the handle to the registry file where the appropriate keys are located.
     312             :     Registry        m_registry;
     313             : };
     314             : 
     315             : //-----------------------------------------------------------------------------
     316             : 
     317             : /** RegistryValueList represents a value list of the specified type.
     318             : 
     319             :     RegistryValueList is a helper class to work with a list value.
     320             : */
     321             : template<class ValueType>
     322             : class RegistryValueList
     323             : {
     324             : public:
     325             :     /// Default constructor
     326           0 :     RegistryValueList()
     327             :         : m_length(0)
     328             :         , m_pValueList(NULL)
     329           0 :         , m_valueType(RG_VALUETYPE_NOT_DEFINED)
     330           0 :         {}
     331             : 
     332             :     /// Destructor, the internal value list will be freed.
     333           0 :     ~RegistryValueList()
     334             :     {
     335           0 :         if (m_pValueList)
     336             :         {
     337           0 :             m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
     338             :         }
     339           0 :     }
     340             : 
     341             :     /// returns the value of the list specified by index.
     342           0 :     ValueType getElement(sal_uInt32 index)
     343             :     {
     344           0 :         if (m_registry.isValid() && index < m_length)
     345             :         {
     346           0 :             return m_pValueList[index];
     347             :         } else
     348             :         {
     349           0 :             return 0;
     350             :         }
     351             :     }
     352             : 
     353             :     /// returns the length of the list.
     354           0 :     sal_uInt32 getLength()
     355             :     {
     356           0 :         return m_length;
     357             :     }
     358             : 
     359             :     friend class RegistryKey;
     360             : protected:
     361             :     /** sets the data of the value list.
     362             : 
     363             :         @param registry specifies the registry files where the appropriate key is located.
     364             :         @param valueType specifies the type of the list values.
     365             :         @param pValueList points to a value list.
     366             :         @param length specifies the length of the list.
     367             :      */
     368           0 :     void setValueList(Registry& registry, RegValueType valueType,
     369             :                       ValueType* pValueList, sal_uInt32 length)
     370             :     {
     371           0 :         m_length = length;
     372           0 :         m_pValueList = pValueList;
     373           0 :         m_valueType = valueType;
     374           0 :         m_registry = registry;
     375           0 :     }
     376             : 
     377             :     /// stores the length of the list, the number of elements.
     378             :     sal_uInt32      m_length;
     379             :     /// stores the value list.
     380             :     ValueType*      m_pValueList;
     381             :     /// stores the type of the list elements
     382             :     RegValueType    m_valueType;
     383             :     /** stores the handle to the registry file where the appropriate key to this
     384             :         value is located.
     385             :     */
     386             :     Registry        m_registry;
     387             : };
     388             : 
     389             : //-----------------------------------------------------------------------------
     390             : 
     391             : /** RegistryKey reads or writes information of the underlying key in a registry.
     392             : 
     393             :     Class is inline and use a load on call C-Api.
     394             : */
     395             : class RegistryKey
     396             : {
     397             : public:
     398             :     /// Default constructor
     399             :     inline RegistryKey();
     400             : 
     401             :     /// Copy constructor
     402             :     inline RegistryKey(const RegistryKey& toCopy);
     403             : 
     404             :     /// Destructor, close the key if it references an open one.
     405             :     inline ~RegistryKey();
     406             : 
     407             :     /// Assign operator
     408             :     inline RegistryKey& operator = (const RegistryKey& toAssign);
     409             : 
     410             :     /// checks if the key points to a valid registry key.
     411             :     inline sal_Bool isValid() const;
     412             : 
     413             :     /** returns the access mode of the key.
     414             : 
     415             :         @return TRUE if access mode is read only else FALSE.
     416             :     */
     417             :     inline sal_Bool     isReadOnly() const;
     418             : 
     419             :     /// returns the full qualified name of the key beginning with the rootkey.
     420             :     inline ::rtl::OUString getName();
     421             : 
     422             :     /** creates a new key or opens a key if the specified key already exists.
     423             : 
     424             :         The specified keyname is relativ to this key.
     425             :         @param  keyName specifies the name of the key which will be opened or created.
     426             :         @param  rNewKey references a RegistryKey which will be filled with the new or open key.
     427             :         @return REG_NO_ERROR if succeeds else an error code.
     428             :     */
     429             :     inline RegError createKey(const ::rtl::OUString& keyName,
     430             :                               RegistryKey& rNewKey);
     431             : 
     432             :     /** opens the specified key.
     433             : 
     434             :         The specified keyname is relativ to this key.
     435             :         @param  keyName specifies the name of the key which will be opened.
     436             :         @param  rOpenKey references a RegistryKey which will be filled with the open key.
     437             :         @return REG_NO_ERROR if succeeds else an error code.
     438             :     */
     439             :     inline RegError openKey(const ::rtl::OUString& keyName,
     440             :                               RegistryKey& rOpenKey);
     441             : 
     442             :     /** opens all subkeys of the specified key.
     443             : 
     444             :         The specified keyname is relativ to this key.
     445             :         @param  keyName specifies the name of the key which subkeys will be opened.
     446             :         @param  rSubKeys reference a RegistryKeyArray which will be filled with the open subkeys.
     447             :         @return REG_NO_ERROR if succeeds else an error code.
     448             :     */
     449             :     inline RegError openSubKeys(const ::rtl::OUString& keyName,
     450             :                                     RegistryKeyArray& rSubKeys);
     451             : 
     452             :     /** returns an array with the names of all subkeys of the specified key.
     453             : 
     454             :         The specified keyname is relativ to this key.
     455             :         @param  keyName specifies the name of the key which subkey names will be returned.
     456             :         @param  rSubKeyNames reference a RegistryKeyNames array which will be filled with the subkey names.
     457             :         @return REG_NO_ERROR if succeeds else an error code.
     458             :     */
     459             :     inline RegError getKeyNames(const ::rtl::OUString& keyName,
     460             :                                     RegistryKeyNames& rSubKeyNames);
     461             : 
     462             :     /** closes all keys specified in the array.
     463             : 
     464             :         @param  rSubKeys reference a RegistryKeyArray which contains the open keys.
     465             :         @return REG_NO_ERROR if succeeds else an error code.
     466             :     */
     467             :     inline RegError closeSubKeys(RegistryKeyArray& rSubKeys);
     468             : 
     469             :     /** deletes the specified key.
     470             : 
     471             :         @param  keyName specifies the name of the key which will be deleted.
     472             :         @return REG_NO_ERROR if succeeds else an error code.
     473             :     */
     474             :     inline RegError deleteKey(const ::rtl::OUString& keyName);
     475             : 
     476             :     /// closes explicitly the current key
     477             :     inline RegError closeKey();
     478             : 
     479             :     /// releases the current key
     480             :     inline void releaseKey();
     481             : 
     482             :     /** sets a value of a key.
     483             : 
     484             :         @param  keyName specifies the name of the key which value will be set.
     485             :                         If keyName is an empty string, the value will be set for the key
     486             :                         specified by hKey.
     487             :         @param  valueType specifies the type of the value.
     488             :         @param  pValue points to a memory block containing the data for the value.
     489             :         @param  valueSize specifies the size of pData in bytes
     490             :         @return REG_NO_ERROR if succeeds else an error code.
     491             :     */
     492             :     inline RegError setValue(const ::rtl::OUString& keyName,
     493             :                                 RegValueType valueType,
     494             :                                 RegValue pValue,
     495             :                                 sal_uInt32 valueSize);
     496             : 
     497             :     /** sets a long list value of a key.
     498             : 
     499             :         @param  keyName specifies the name of the key which value will be set.
     500             :                         If keyName is an empty string, the value will be set for the key
     501             :                         specified by hKey.
     502             :         @param  pValueList points to an array of longs containing the data for the value.
     503             :         @param  len specifies the length of the list (the array referenced by pValueList).
     504             :         @return REG_NO_ERROR if succeeds else an error code.
     505             :     */
     506             :     inline RegError setLongListValue(const ::rtl::OUString& keyName,
     507             :                                          sal_Int32* pValueList,
     508             :                                          sal_uInt32 len);
     509             : 
     510             :     /** sets an ascii list value of a key.
     511             : 
     512             :         @param  keyName specifies the name of the key which value will be set.
     513             :                         If keyName is an empty string, the value will be set for the key
     514             :                         specified by hKey.
     515             :         @param  pValueList points to an array of sal_Char* containing the data for the value.
     516             :         @param  len specifies the length of the list (the array referenced by pValueList).
     517             :         @return REG_NO_ERROR if succeeds else an error code.
     518             :     */
     519             :     inline RegError setStringListValue(const ::rtl::OUString& keyName,
     520             :                                            sal_Char** pValueList,
     521             :                                            sal_uInt32 len);
     522             : 
     523             :     /** sets an unicode string list value of a key.
     524             : 
     525             :         @param  keyName specifies the name of the key which value will be set.
     526             :                         If keyName is an empty string, the value will be set for the key
     527             :                         specified by hKey.
     528             :         @param  pValueList points to an array of sal_Unicode* containing the data for the value.
     529             :         @param  len specifies the length of the list (the array referenced by pValueList).
     530             :         @return REG_NO_ERROR if succeeds else an error code.
     531             :     */
     532             :     inline RegError setUnicodeListValue(const ::rtl::OUString& keyName,
     533             :                                             sal_Unicode** pValueList,
     534             :                                               sal_uInt32 len);
     535             : 
     536             :     /** gets info about type and size of a value.
     537             : 
     538             :         @param  keyName specifies the name of the key which value info will be returned.
     539             :                         If keyName is an empty string, the value info of the key
     540             :                         specified by hKey will be returned.
     541             :         @param  pValueType returns the type of the value.
     542             :         @param  pValueSize returns the size of the value in bytes or the length of a list value.
     543             :         @return REG_NO_ERROR if succeeds else an error code.
     544             :     */
     545             :     inline RegError getValueInfo(const ::rtl::OUString& keyName,
     546             :                                     RegValueType* pValueType,
     547             :                                     sal_uInt32* pValueSize);
     548             : 
     549             :     /** gets the value of a key.
     550             : 
     551             :         @param  keyName specifies the name of the key which value will be returned.
     552             :                         If keyName is an empty string, the value is get from the key
     553             :                         specified by hKey.
     554             :         @param  pValue points to an allocated memory block receiving the data of the value.
     555             :         @return REG_NO_ERROR if succeeds else an error code.
     556             :     */
     557             :     inline RegError getValue(const ::rtl::OUString& keyName,
     558             :                                 RegValue pValue);
     559             : 
     560             :     /** gets a long list value of a key.
     561             : 
     562             :         @param  keyName specifies the name of the key which value will be returned.
     563             :                         If keyName is an empty string, the value is get from the key
     564             :                         specified by hKey.
     565             :         @param  rValueList references a RegistryValueList which will be filled with the long values.
     566             :         @return REG_NO_ERROR if succeeds else an error code.
     567             :     */
     568             :     inline RegError getLongListValue(const ::rtl::OUString& keyName,
     569             :                                           RegistryValueList<sal_Int32>& rValueList);
     570             : 
     571             :     /** gets an ascii list value of a key.
     572             : 
     573             :         @param  keyName specifies the name of the key which value will be returned.
     574             :                         If keyName is an empty string, the value is get from the key
     575             :                         specified by hKey.
     576             :         @param  rValueList references a RegistryValueList which will be filled with the ascii values.
     577             :         @return REG_NO_ERROR if succeeds else an error code.
     578             :     */
     579             :     inline RegError getStringListValue(const ::rtl::OUString& keyName,
     580             :                                            RegistryValueList<sal_Char*>& rValueList);
     581             : 
     582             :     /** gets a unicode value of a key.
     583             : 
     584             :         @param  keyName specifies the name of the key which value will be returned.
     585             :                         If keyName is an empty string, the value is get from the key
     586             :                         specified by hKey.
     587             :         @param  rValueList reference a RegistryValueList which will be filled with the unicode values.
     588             :         @return REG_NO_ERROR if succeeds else an error code.
     589             :     */
     590             :     inline RegError getUnicodeListValue(const ::rtl::OUString& keyName,
     591             :                                               RegistryValueList<sal_Unicode*>& rValueList);
     592             : 
     593             :     /** used to create a link.
     594             : 
     595             :         @deprecated Links are no longer supported.
     596             : 
     597             :         @return REG_INVALID_LINK
     598             :      */
     599             :     inline RegError createLink(const ::rtl::OUString& linkName,
     600             :                                const ::rtl::OUString& linkTarget);
     601             : 
     602             :     /** used to delete a link.
     603             : 
     604             :         @deprecated Links are no longer supported.
     605             : 
     606             :         @return REG_INVALID_LINK
     607             :      */
     608             :     inline RegError deleteLink(const ::rtl::OUString& linkName);
     609             : 
     610             :     /** returns the type of the specified key.
     611             : 
     612             :         @param name specifies the name of the key or link.
     613             :         @param pKeyType returns the type of the key (always RG_KEYTYPE).
     614             :         @return REG_NO_ERROR if succeeds else an error code.
     615             :      */
     616             :     inline RegError getKeyType(const ::rtl::OUString& name,
     617             :                                   RegKeyType* pKeyType) const;
     618             : 
     619             :     /** used to return the target of a link.
     620             : 
     621             :         @deprecated Links are no longer supported.
     622             : 
     623             :         @return REG_INVALID_LINK
     624             :      */
     625             :     inline RegError getLinkTarget(const ::rtl::OUString& linkName,
     626             :                                     ::rtl::OUString& rLinkTarget) const;
     627             : 
     628             :     /** resolves a keyname.
     629             : 
     630             :         @param  keyName specifies the name of the key which will be resolved relativ to this key.
     631             :                         The resolved name will be prefixed with the name of this key.
     632             :         @param firstLinkOnly ignored
     633             :         @return REG_NO_ERROR if succeeds else an error code.
     634             :      */
     635             :     inline RegError getResolvedKeyName(const ::rtl::OUString& keyName,
     636             :                                        sal_Bool firstLinkOnly,
     637             :                                            ::rtl::OUString& rResolvedName) const;
     638             : 
     639             :     /// returns the name of the registry in which the key is defined.
     640             :     inline ::rtl::OUString getRegistryName();
     641             : 
     642             :     /// returns the registry in which the key is defined.
     643             :     Registry getRegistry() const { return m_registry; }
     644             : 
     645             :     friend class Registry;
     646             : public:
     647             :     /// @cond INTERNAL
     648             : 
     649             :     /** Constructor, which initialize a RegistryKey with registry and an valid key handle.
     650             : 
     651             :         This constructor is internal only.
     652             :     */
     653             :     inline RegistryKey(Registry&    registry,
     654             :                        RegKeyHandle hKey);
     655             : 
     656             :     /** returns the internal key handle.
     657             :      */
     658             :     RegKeyHandle getKeyHandle() const { return m_hImpl; }
     659             : 
     660             : protected:
     661             :     /** sets the internal registry on which this key should work.
     662             :      */
     663             :     inline void setRegistry(Registry& registry);
     664             : 
     665             :     /// @endcond
     666             : 
     667             :     /// stores the registry on which this key works
     668             :     Registry        m_registry;
     669             :     /// stores the current key handle of this key
     670             :     RegKeyHandle    m_hImpl;
     671             : };
     672             : 
     673             : 
     674             : //-----------------------------------------------------------------------------
     675             : 
     676       14773 : inline RegistryKeyArray::RegistryKeyArray()
     677             :     : m_length(0)
     678       14773 :     , m_phKeys(NULL)
     679             : {
     680       14773 : }
     681             : 
     682       29546 : inline RegistryKeyArray::~RegistryKeyArray()
     683             : {
     684       14773 :     if (m_phKeys)
     685         456 :         m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
     686       14773 : }
     687             : 
     688       14760 : inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
     689             : {
     690       14760 :     if (m_registry.isValid() && index < m_length)
     691       14760 :         return RegistryKey(m_registry, m_phKeys[index]);
     692             :     else
     693           0 :         return RegistryKey();
     694             : }
     695             : 
     696       29533 : inline sal_uInt32 RegistryKeyArray::getLength()
     697             : {
     698       29533 :     return m_length;
     699             : }
     700             : 
     701       14773 : inline void RegistryKeyArray::setKeyHandles(Registry& registry,
     702             :                                             RegKeyHandle* phKeys,
     703             :                                             sal_uInt32 length)
     704             : {
     705       14773 :     m_phKeys = phKeys;
     706       14773 :     m_length = length;
     707       14773 :     m_registry = registry;
     708       14773 : }
     709             : 
     710             : inline RegError RegistryKeyArray::closeKeyHandles()
     711             : {
     712             :     if (m_registry.isValid() && m_phKeys)
     713             :     {
     714             :         RegError ret;
     715             :         ret = m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
     716             :         m_registry = Registry();
     717             :         m_length = 0;
     718             :         m_phKeys = NULL;
     719             :         return ret;
     720             :     } else
     721             :         return(REG_INVALID_KEY);
     722             : }
     723             : 
     724             : //-----------------------------------------------------------------------------
     725             : 
     726        8506 : inline RegistryKeyNames::RegistryKeyNames()
     727             :     : m_length(0)
     728        8506 :     , m_pKeyNames(NULL)
     729             : {
     730        8506 : }
     731             : 
     732       17012 : inline RegistryKeyNames::~RegistryKeyNames()
     733             : {
     734        8506 :     if (m_pKeyNames)
     735         246 :         m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
     736        8506 : }
     737             : 
     738      998350 : inline ::rtl::OUString RegistryKeyNames::getElement(sal_uInt32 index)
     739             : {
     740             : 
     741      998350 :     if (m_pKeyNames && index < m_length)
     742      998350 :         return m_pKeyNames[index];
     743             :     else
     744           0 :         return ::rtl::OUString();
     745             : }
     746             : 
     747        8506 : inline sal_uInt32 RegistryKeyNames::getLength()
     748             : {
     749        8506 :     return m_length;
     750             : }
     751             : 
     752        8506 : inline void RegistryKeyNames::setKeyNames(Registry& registry,
     753             :                                           rtl_uString** pKeyNames,
     754             :                                           sal_uInt32 length)
     755             : {
     756        8506 :     m_pKeyNames = pKeyNames;
     757        8506 :     m_length = length;
     758        8506 :     m_registry = registry;
     759        8506 : }
     760             : 
     761             : inline RegError RegistryKeyNames::freeKeyNames()
     762             : {
     763             :     if (m_registry.isValid() && m_pKeyNames)
     764             :     {
     765             :         RegError ret = REG_NO_ERROR;
     766             :         ret = m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
     767             :         m_registry = Registry();
     768             :         m_length = 0;
     769             :         m_pKeyNames = NULL;
     770             :         return ret;
     771             :     } else
     772             :         return REG_INVALID_KEY;
     773             : }
     774             : 
     775             : //-----------------------------------------------------------------------------
     776             : 
     777      595485 : inline RegistryKey::RegistryKey()
     778      595485 :     : m_hImpl(NULL)
     779      595485 :     { }
     780             : 
     781             : /// @cond INTERNAL
     782       14760 : inline RegistryKey::RegistryKey(Registry& registry, RegKeyHandle hKey)
     783             :     : m_registry(registry)
     784       14760 :     , m_hImpl(hKey)
     785             :     {
     786       14760 :         if (m_hImpl)
     787       14760 :             m_registry.m_pApi->acquireKey(m_hImpl);
     788       14760 :     }
     789             : /// @endcond
     790             : 
     791       54741 : inline RegistryKey::RegistryKey(const RegistryKey& toCopy)
     792             :     : m_registry(toCopy.m_registry)
     793       54741 :     , m_hImpl(toCopy.m_hImpl)
     794             :     {
     795       54741 :         if (m_hImpl)
     796       54741 :             m_registry.m_pApi->acquireKey(m_hImpl);
     797       54741 :     }
     798             : 
     799             : /// @cond INTERNAL
     800      548296 : inline void RegistryKey::setRegistry(Registry& registry)
     801             :     {
     802      548296 :         m_registry = registry;
     803      548296 :     }
     804             : /// @endcond
     805             : 
     806     1329498 : inline RegistryKey::~RegistryKey()
     807             :     {
     808      664749 :         if (m_hImpl)
     809      357417 :             m_registry.m_pApi->releaseKey(m_hImpl);
     810      664749 :     }
     811             : 
     812       34804 : inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
     813             : {
     814       34804 :     m_registry = toAssign.m_registry;
     815             : 
     816       34804 :     if (toAssign.m_hImpl)
     817       34804 :         m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
     818       34804 :     if (m_hImpl)
     819       14390 :         m_registry.m_pApi->releaseKey(m_hImpl);
     820       34804 :     m_hImpl = toAssign.m_hImpl;
     821             : 
     822       34804 :     return *this;
     823             : }
     824             : 
     825      694833 : inline sal_Bool RegistryKey::isValid() const
     826      694833 :     {  return (m_hImpl != NULL); }
     827             : 
     828           0 : inline sal_Bool RegistryKey::isReadOnly() const
     829             :     {
     830           0 :         if  (m_registry.isValid())
     831           0 :             return (m_registry.m_pApi)->isKeyReadOnly(m_hImpl);
     832             :         else
     833           0 :             return sal_False;
     834             :     }
     835             : 
     836       34595 : inline ::rtl::OUString RegistryKey::getName()
     837             :     {
     838       34595 :         ::rtl::OUString sRet;
     839       34595 :         if (m_registry.isValid())
     840       34595 :             m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
     841       34595 :         return sRet;
     842             :     }
     843             : 
     844       26122 : inline RegError RegistryKey::createKey(const ::rtl::OUString& keyName,
     845             :                                           RegistryKey& rNewKey)
     846             :     {
     847       26122 :         if (rNewKey.isValid()) rNewKey.closeKey();
     848       26122 :         if (m_registry.isValid())
     849             :         {
     850       26122 :             RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
     851       26122 :             if (!ret) rNewKey.setRegistry(m_registry);
     852       26122 :             return ret;
     853             :         } else
     854           0 :             return REG_INVALID_KEY;
     855             :     }
     856             : 
     857      448744 : inline RegError RegistryKey::openKey(const ::rtl::OUString& keyName,
     858             :                                      RegistryKey& rOpenKey)
     859             :     {
     860      448744 :         if (rOpenKey.isValid()) rOpenKey.closeKey();
     861      448744 :         if (m_registry.isValid())
     862             :         {
     863             :             RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
     864      448744 :                                                     &rOpenKey.m_hImpl);
     865      448744 :             if (!ret) rOpenKey.setRegistry(m_registry);
     866      448744 :             return ret;
     867             :         } else
     868           0 :             return REG_INVALID_KEY;
     869             :     }
     870             : 
     871       14773 : inline RegError RegistryKey::openSubKeys(const ::rtl::OUString& keyName,
     872             :                                          RegistryKeyArray& rSubKeys)
     873             :     {
     874       14773 :         if (m_registry.isValid())
     875             :         {
     876       14773 :             RegError        ret = REG_NO_ERROR;
     877             :             RegKeyHandle*   pSubKeys;
     878             :             sal_uInt32      nSubKeys;
     879             :              ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
     880       14773 :                                                       &pSubKeys, &nSubKeys);
     881       14773 :              if ( ret )
     882             :             {
     883           0 :                 return ret;
     884             :             } else
     885             :             {
     886       14773 :                 rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
     887       14773 :                 return ret;
     888             :             }
     889             :         } else
     890           0 :             return REG_INVALID_KEY;
     891             :     }
     892             : 
     893        8506 : inline RegError RegistryKey::getKeyNames(const ::rtl::OUString& keyName,
     894             :                                              RegistryKeyNames& rSubKeyNames)
     895             :     {
     896        8506 :         if (m_registry.isValid())
     897             :         {
     898        8506 :             RegError        ret = REG_NO_ERROR;
     899             :             rtl_uString**   pSubKeyNames;
     900             :             sal_uInt32      nSubKeys;
     901             :              ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
     902        8506 :                                                   &pSubKeyNames, &nSubKeys);
     903        8506 :              if ( ret )
     904             :             {
     905           0 :                 return ret;
     906             :             } else
     907             :             {
     908        8506 :                 rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
     909        8506 :                 return ret;
     910             :             }
     911             :         } else
     912           0 :             return REG_INVALID_KEY;
     913             :     }
     914             : 
     915             : inline RegError RegistryKey::closeSubKeys(RegistryKeyArray& rSubKeys)
     916             :     {
     917             :         if (m_registry.isValid())
     918             :             return rSubKeys.closeKeyHandles();
     919             :         else
     920             :             return REG_INVALID_KEY;
     921             :     }
     922             : 
     923           0 : inline RegError RegistryKey::deleteKey(const ::rtl::OUString& keyName)
     924             :     {
     925           0 :         if (m_registry.isValid())
     926           0 :             return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
     927             :         else
     928           0 :             return REG_INVALID_KEY;
     929             :     }
     930             : 
     931       17320 : inline RegError RegistryKey::closeKey()
     932             :     {
     933       17320 :         if (m_registry.isValid())
     934             :         {
     935       17320 :             RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
     936       17320 :             if (!ret)
     937             :             {
     938       17320 :                 m_hImpl = NULL;
     939       17320 :                 m_registry = Registry();
     940             :             }
     941       17320 :             return ret;
     942             :         } else
     943           0 :             return REG_INVALID_KEY;
     944             :     }
     945             : 
     946       10385 : inline void RegistryKey::releaseKey()
     947             : {
     948       10385 :     if (m_registry.isValid() && (m_hImpl != 0))
     949             :     {
     950       10385 :         m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = 0;
     951             :     }
     952       10385 : }
     953             : 
     954       26122 : inline RegError RegistryKey::setValue(const ::rtl::OUString& keyName,
     955             :                                               RegValueType valueType,
     956             :                                            RegValue pValue,
     957             :                                               sal_uInt32 valueSize)
     958             :     {
     959       26122 :         if (m_registry.isValid())
     960             :             return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
     961       26122 :                                                 pValue, valueSize);
     962             :         else
     963           0 :             return REG_INVALID_KEY;
     964             :     }
     965             : 
     966           0 : inline RegError RegistryKey::setLongListValue(const ::rtl::OUString& keyName,
     967             :                                                   sal_Int32* pValueList,
     968             :                                                   sal_uInt32 len)
     969             :     {
     970           0 :         if (m_registry.isValid())
     971             :             return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
     972           0 :                                                            pValueList, len);
     973             :         else
     974           0 :             return REG_INVALID_KEY;
     975             :     }
     976             : 
     977           0 : inline RegError RegistryKey::setStringListValue(const ::rtl::OUString& keyName,
     978             :                                                    sal_Char** pValueList,
     979             :                                                    sal_uInt32 len)
     980             :     {
     981           0 :         if (m_registry.isValid())
     982             :             return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
     983           0 :                                                             pValueList, len);
     984             :         else
     985           0 :             return REG_INVALID_KEY;
     986             :     }
     987             : 
     988           0 : inline RegError RegistryKey::setUnicodeListValue(const ::rtl::OUString& keyName,
     989             :                                                         sal_Unicode** pValueList,
     990             :                                                         sal_uInt32 len)
     991             :     {
     992           0 :         if (m_registry.isValid())
     993             :             return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
     994           0 :                                                               pValueList, len);
     995             :         else
     996           0 :             return REG_INVALID_KEY;
     997             :     }
     998             : 
     999       65850 : inline RegError RegistryKey::getValueInfo(const ::rtl::OUString& keyName,
    1000             :                                                   RegValueType* pValueType,
    1001             :                                                   sal_uInt32* pValueSize)
    1002             :     {
    1003       65850 :         if (m_registry.isValid())
    1004       65850 :             return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
    1005             :         else
    1006           0 :             return REG_INVALID_KEY;
    1007             :     }
    1008             : 
    1009       61699 : inline RegError RegistryKey::getValue(const ::rtl::OUString& keyName,
    1010             :                                         RegValue pValue)
    1011             :     {
    1012       61699 :         if (m_registry.isValid())
    1013       61699 :             return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
    1014             :         else
    1015           0 :             return REG_INVALID_KEY;
    1016             :     }
    1017             : 
    1018           0 : inline RegError RegistryKey::getLongListValue(const ::rtl::OUString& keyName,
    1019             :                                               RegistryValueList<sal_Int32>& rValueList)
    1020             :     {
    1021           0 :         if (m_registry.isValid())
    1022             :         {
    1023           0 :             RegError    ret = REG_NO_ERROR;
    1024             :             sal_Int32*  pValueList;
    1025             :             sal_uInt32  length;
    1026             :              ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
    1027           0 :                                                       &pValueList, &length);
    1028           0 :              if ( ret )
    1029             :             {
    1030           0 :                 return ret;
    1031             :             } else
    1032             :             {
    1033             :                 rValueList.setValueList(m_registry, RG_VALUETYPE_LONGLIST,
    1034           0 :                                         pValueList, length);
    1035           0 :                 return ret;
    1036             :             }
    1037             :         } else
    1038           0 :             return REG_INVALID_KEY;
    1039             :     }
    1040             : 
    1041           0 : inline RegError RegistryKey::getStringListValue(const ::rtl::OUString& keyName,
    1042             :                                                       RegistryValueList<sal_Char*>& rValueList)
    1043             :     {
    1044           0 :         if (m_registry.isValid())
    1045             :         {
    1046           0 :             RegError    ret = REG_NO_ERROR;
    1047             :             sal_Char**  pValueList;
    1048             :             sal_uInt32  length;
    1049             :              ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
    1050           0 :                                                       &pValueList, &length);
    1051           0 :              if ( ret )
    1052             :             {
    1053           0 :                 return ret;
    1054             :             } else
    1055             :             {
    1056             :                 rValueList.setValueList(m_registry, RG_VALUETYPE_STRINGLIST,
    1057           0 :                                         pValueList, length);
    1058           0 :                 return ret;
    1059             :             }
    1060             :         } else
    1061           0 :             return REG_INVALID_KEY;
    1062             :     }
    1063             : 
    1064           0 : inline RegError RegistryKey::getUnicodeListValue(const ::rtl::OUString& keyName,
    1065             :                                               RegistryValueList<sal_Unicode*>& rValueList)
    1066             :     {
    1067           0 :         if (m_registry.isValid())
    1068             :         {
    1069           0 :             RegError        ret = REG_NO_ERROR;
    1070             :             sal_Unicode**   pValueList;
    1071             :             sal_uInt32      length;
    1072             :              ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
    1073           0 :                                                       &pValueList, &length);
    1074           0 :              if ( ret )
    1075             :             {
    1076           0 :                 return ret;
    1077             :             } else
    1078             :             {
    1079             :                 rValueList.setValueList(m_registry, RG_VALUETYPE_UNICODELIST,
    1080           0 :                                         pValueList, length);
    1081           0 :                 return ret;
    1082             :             }
    1083             :         } else
    1084           0 :             return REG_INVALID_KEY;
    1085             :     }
    1086             : 
    1087           0 : inline RegError RegistryKey::createLink(const ::rtl::OUString& linkName,
    1088             :                                            const ::rtl::OUString& linkTarget)
    1089             :     {
    1090           0 :         if (m_registry.isValid())
    1091           0 :             return m_registry.m_pApi->createLink(m_hImpl, linkName.pData, linkTarget.pData);
    1092             :         else
    1093           0 :             return REG_INVALID_KEY;
    1094             :     }
    1095             : 
    1096           0 : inline RegError RegistryKey::deleteLink(const ::rtl::OUString& linkName)
    1097             :     {
    1098           0 :         if (m_registry.isValid())
    1099           0 :             return m_registry.m_pApi->deleteLink(m_hImpl, linkName.pData);
    1100             :         else
    1101           0 :             return REG_INVALID_KEY;
    1102             :     }
    1103             : 
    1104           0 : inline RegError RegistryKey::getKeyType(const ::rtl::OUString& keyName,
    1105             :                                               RegKeyType* pKeyType) const
    1106             :     {
    1107           0 :         if (m_registry.isValid())
    1108           0 :             return m_registry.m_pApi->getKeyType(m_hImpl, keyName.pData, pKeyType);
    1109             :         else
    1110           0 :             return REG_INVALID_KEY;
    1111             :     }
    1112             : 
    1113           0 : inline RegError RegistryKey::getLinkTarget(const ::rtl::OUString& linkName,
    1114             :                                                ::rtl::OUString& rLinkTarget) const
    1115             :     {
    1116           0 :         if (m_registry.isValid())
    1117             :         {
    1118             :             return m_registry.m_pApi->getLinkTarget(m_hImpl,
    1119             :                                                     linkName.pData,
    1120           0 :                                                     &rLinkTarget.pData);
    1121             :         } else
    1122           0 :             return REG_INVALID_KEY;
    1123             :     }
    1124             : 
    1125             : 
    1126        9617 : inline RegError RegistryKey::getResolvedKeyName(const ::rtl::OUString& keyName,
    1127             :                                                    sal_Bool firstLinkOnly,
    1128             :                                                        ::rtl::OUString& rResolvedName) const
    1129             :     {
    1130        9617 :         if (m_registry.isValid())
    1131             :             return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
    1132             :                                                          keyName.pData,
    1133             :                                                          firstLinkOnly,
    1134        9617 :                                                          &rResolvedName.pData);
    1135             :         else
    1136           0 :             return REG_INVALID_KEY;
    1137             :     }
    1138             : 
    1139           0 : inline ::rtl::OUString RegistryKey::getRegistryName()
    1140             :     {
    1141           0 :         if (m_registry.isValid())
    1142             :         {
    1143           0 :             return m_registry.getName();
    1144             :         } else
    1145           0 :             return ::rtl::OUString();
    1146             :     }
    1147             : 
    1148             : //-----------------------------------------------------------------------------
    1149             : 
    1150      641599 : inline Registry::Registry()
    1151      641599 :     : m_pApi(initRegistry_Api())
    1152      641599 :     , m_hImpl(NULL)
    1153      641599 :     { }
    1154             : 
    1155       69527 : inline Registry::Registry(const Registry& toCopy)
    1156             :     : m_pApi(toCopy.m_pApi)
    1157       69527 :     , m_hImpl(toCopy.m_hImpl)
    1158             :     {
    1159       69527 :         if (m_hImpl)
    1160       69527 :             m_pApi->acquire(m_hImpl);
    1161       69527 :     }
    1162             : 
    1163             : 
    1164      710626 : inline Registry::~Registry()
    1165             :     {
    1166      710626 :         if (m_hImpl)
    1167      391159 :             m_pApi->release(m_hImpl);
    1168      710626 :     }
    1169             : 
    1170      623699 : inline Registry& Registry::operator = (const Registry& toAssign)
    1171             : {
    1172      623699 :     if (toAssign.m_hImpl)
    1173      606379 :         toAssign.m_pApi->acquire(toAssign.m_hImpl);
    1174      623699 :     if (m_hImpl)
    1175      284562 :         m_pApi->release(m_hImpl);
    1176             : 
    1177      623699 :     m_pApi  = toAssign.m_pApi;
    1178      623699 :     m_hImpl = toAssign.m_hImpl;
    1179             : 
    1180      623699 :     return *this;
    1181             : }
    1182             : 
    1183      745651 : inline sal_Bool Registry::isValid() const
    1184      745651 :     {  return ( m_hImpl != NULL ); }
    1185             : 
    1186           0 : inline sal_Bool Registry::isReadOnly() const
    1187           0 :     {  return m_pApi->isReadOnly(m_hImpl); }
    1188             : 
    1189      456871 : inline RegError Registry::openRootKey(RegistryKey& rRootKey)
    1190             :     {
    1191      456871 :         rRootKey.setRegistry(*this);
    1192      456871 :         return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
    1193             :     }
    1194             : 
    1195           0 : inline ::rtl::OUString Registry::getName()
    1196             :     {
    1197           0 :         ::rtl::OUString sRet;
    1198           0 :         m_pApi->getName(m_hImpl, &sRet.pData);
    1199           0 :         return sRet;
    1200             :     }
    1201             : 
    1202        5198 : inline RegError Registry::create(const ::rtl::OUString& registryName)
    1203             :     {
    1204        5198 :         if (m_hImpl)
    1205           0 :             m_pApi->release(m_hImpl);
    1206        5198 :         return m_pApi->createRegistry(registryName.pData, &m_hImpl);
    1207             :     }
    1208             : 
    1209         343 : inline RegError Registry::open(const ::rtl::OUString& registryName,
    1210             :                                   RegAccessMode accessMode)
    1211             :     {
    1212         343 :         if (m_hImpl)
    1213          13 :             m_pApi->release(m_hImpl);
    1214         343 :         return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
    1215             :     }
    1216             : 
    1217        5200 : inline RegError Registry::close()
    1218             :     {
    1219        5200 :         RegError ret = m_pApi->closeRegistry(m_hImpl);
    1220        5200 :         if (!ret)
    1221        5200 :             m_hImpl = NULL;
    1222        5200 :         return ret;
    1223             :     }
    1224             : 
    1225           0 : inline RegError Registry::destroy(const ::rtl::OUString& registryName)
    1226             :     {
    1227           0 :         RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
    1228           0 :         if ( !ret && registryName.isEmpty() )
    1229           0 :             m_hImpl = NULL;
    1230           0 :         return ret;
    1231             :     }
    1232             : 
    1233             : inline RegError Registry::loadKey(RegistryKey& rKey,
    1234             :                                       const ::rtl::OUString& keyName,
    1235             :                                       const ::rtl::OUString& regFileName)
    1236             :     {  return m_pApi->loadKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
    1237             : 
    1238             : inline RegError Registry::saveKey(RegistryKey& rKey,
    1239             :                                      const ::rtl::OUString& keyName,
    1240             :                                      const ::rtl::OUString& regFileName)
    1241             :     {  return m_pApi->saveKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
    1242             : 
    1243        5196 : inline RegError Registry::mergeKey(RegistryKey& rKey,
    1244             :                                          const ::rtl::OUString& keyName,
    1245             :                                          const ::rtl::OUString& regFileName,
    1246             :                                          sal_Bool bWarnings,
    1247             :                                          sal_Bool bReport)
    1248        5196 :     {  return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, bWarnings, bReport); }
    1249             : 
    1250             : inline RegError Registry::dumpRegistry(RegistryKey& rKey)
    1251             :     {  return m_pApi->dumpRegistry(m_hImpl, rKey.m_hImpl); }
    1252             : 
    1253             : 
    1254             : #endif
    1255             : 
    1256             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10