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

Generated by: LCOV version 1.11