LCOV - code coverage report
Current view: top level - include/registry - registry.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 270 0.0 %
Date: 2014-04-14 Functions: 0 70 0.0 %
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             :     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 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 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             :                                 bool bWarnings = false,
     208             :                                 bool bReport = 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 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 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[in]  keyName specifies the name of the key which will be resolved relative to this key.
     631             :                         The resolved name will be prefixed with the name of this key.
     632             :         @param[in]  firstLinkOnly ignored
     633             :         @param[out] rResolvedName the resolved name.
     634             :         @return REG_NO_ERROR if succeeds else an error code.
     635             :      */
     636             :     inline RegError getResolvedKeyName(const rtl::OUString& keyName,
     637             :                                        bool firstLinkOnly,
     638             :                                            rtl::OUString& rResolvedName) const;
     639             : 
     640             :     /// returns the name of the registry in which the key is defined.
     641             :     inline rtl::OUString getRegistryName();
     642             : 
     643             :     /// returns the registry in which the key is defined.
     644             :     Registry getRegistry() const { return m_registry; }
     645             : 
     646             :     friend class Registry;
     647             : public:
     648             :     /// @cond INTERNAL
     649             : 
     650             :     /** Constructor, which initialize a RegistryKey with registry and an valid key handle.
     651             : 
     652             :         This constructor is internal only.
     653             :     */
     654             :     inline RegistryKey(Registry&    registry,
     655             :                        RegKeyHandle hKey);
     656             : 
     657             :     /** returns the internal key handle.
     658             :      */
     659             :     RegKeyHandle getKeyHandle() const { return m_hImpl; }
     660             : 
     661             : protected:
     662             :     /** sets the internal registry on which this key should work.
     663             :      */
     664             :     inline void setRegistry(Registry& registry);
     665             : 
     666             :     /// @endcond
     667             : 
     668             :     /// stores the registry on which this key works
     669             :     Registry        m_registry;
     670             :     /// stores the current key handle of this key
     671             :     RegKeyHandle    m_hImpl;
     672             : };
     673             : 
     674             : 
     675             : 
     676             : 
     677           0 : inline RegistryKeyArray::RegistryKeyArray()
     678             :     : m_length(0)
     679           0 :     , m_phKeys(NULL)
     680             : {
     681           0 : }
     682             : 
     683           0 : inline RegistryKeyArray::~RegistryKeyArray()
     684             : {
     685           0 :     if (m_phKeys)
     686           0 :         m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
     687           0 : }
     688             : 
     689           0 : inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
     690             : {
     691           0 :     if (m_registry.isValid() && index < m_length)
     692           0 :         return RegistryKey(m_registry, m_phKeys[index]);
     693             :     else
     694           0 :         return RegistryKey();
     695             : }
     696             : 
     697           0 : inline sal_uInt32 RegistryKeyArray::getLength()
     698             : {
     699           0 :     return m_length;
     700             : }
     701             : 
     702           0 : inline void RegistryKeyArray::setKeyHandles(Registry& registry,
     703             :                                             RegKeyHandle* phKeys,
     704             :                                             sal_uInt32 length)
     705             : {
     706           0 :     m_phKeys = phKeys;
     707           0 :     m_length = length;
     708           0 :     m_registry = registry;
     709           0 : }
     710             : 
     711             : inline RegError RegistryKeyArray::closeKeyHandles()
     712             : {
     713             :     if (m_registry.isValid() && m_phKeys)
     714             :     {
     715             :         RegError ret;
     716             :         ret = m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
     717             :         m_registry = Registry();
     718             :         m_length = 0;
     719             :         m_phKeys = NULL;
     720             :         return ret;
     721             :     } else
     722             :         return(REG_INVALID_KEY);
     723             : }
     724             : 
     725             : 
     726             : 
     727           0 : inline RegistryKeyNames::RegistryKeyNames()
     728             :     : m_length(0)
     729           0 :     , m_pKeyNames(NULL)
     730             : {
     731           0 : }
     732             : 
     733           0 : inline RegistryKeyNames::~RegistryKeyNames()
     734             : {
     735           0 :     if (m_pKeyNames)
     736           0 :         m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
     737           0 : }
     738             : 
     739           0 : inline rtl::OUString RegistryKeyNames::getElement(sal_uInt32 index)
     740             : {
     741             : 
     742           0 :     if (m_pKeyNames && index < m_length)
     743           0 :         return m_pKeyNames[index];
     744             :     else
     745           0 :         return rtl::OUString();
     746             : }
     747             : 
     748           0 : inline sal_uInt32 RegistryKeyNames::getLength()
     749             : {
     750           0 :     return m_length;
     751             : }
     752             : 
     753           0 : inline void RegistryKeyNames::setKeyNames(Registry& registry,
     754             :                                           rtl_uString** pKeyNames,
     755             :                                           sal_uInt32 length)
     756             : {
     757           0 :     m_pKeyNames = pKeyNames;
     758           0 :     m_length = length;
     759           0 :     m_registry = registry;
     760           0 : }
     761             : 
     762             : inline RegError RegistryKeyNames::freeKeyNames()
     763             : {
     764             :     if (m_registry.isValid() && m_pKeyNames)
     765             :     {
     766             :         RegError ret = REG_NO_ERROR;
     767             :         ret = m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
     768             :         m_registry = Registry();
     769             :         m_length = 0;
     770             :         m_pKeyNames = NULL;
     771             :         return ret;
     772             :     } else
     773             :         return REG_INVALID_KEY;
     774             : }
     775             : 
     776             : 
     777             : 
     778           0 : inline RegistryKey::RegistryKey()
     779           0 :     : m_hImpl(NULL)
     780           0 :     { }
     781             : 
     782             : /// @cond INTERNAL
     783           0 : inline RegistryKey::RegistryKey(Registry& registry, RegKeyHandle hKey)
     784             :     : m_registry(registry)
     785           0 :     , m_hImpl(hKey)
     786             :     {
     787           0 :         if (m_hImpl)
     788           0 :             m_registry.m_pApi->acquireKey(m_hImpl);
     789           0 :     }
     790             : /// @endcond
     791             : 
     792           0 : inline RegistryKey::RegistryKey(const RegistryKey& toCopy)
     793             :     : m_registry(toCopy.m_registry)
     794           0 :     , m_hImpl(toCopy.m_hImpl)
     795             :     {
     796           0 :         if (m_hImpl)
     797           0 :             m_registry.m_pApi->acquireKey(m_hImpl);
     798           0 :     }
     799             : 
     800             : /// @cond INTERNAL
     801           0 : inline void RegistryKey::setRegistry(Registry& registry)
     802             :     {
     803           0 :         m_registry = registry;
     804           0 :     }
     805             : /// @endcond
     806             : 
     807           0 : inline RegistryKey::~RegistryKey()
     808             :     {
     809           0 :         if (m_hImpl)
     810           0 :             m_registry.m_pApi->releaseKey(m_hImpl);
     811           0 :     }
     812             : 
     813           0 : inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
     814             : {
     815           0 :     m_registry = toAssign.m_registry;
     816             : 
     817           0 :     if (toAssign.m_hImpl)
     818           0 :         m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
     819           0 :     if (m_hImpl)
     820           0 :         m_registry.m_pApi->releaseKey(m_hImpl);
     821           0 :     m_hImpl = toAssign.m_hImpl;
     822             : 
     823           0 :     return *this;
     824             : }
     825             : 
     826           0 : inline bool RegistryKey::isValid() const
     827           0 :     {  return (m_hImpl != NULL); }
     828             : 
     829           0 : inline bool RegistryKey::isReadOnly() const
     830             :     {
     831           0 :         if  (m_registry.isValid())
     832           0 :             return (m_registry.m_pApi)->isKeyReadOnly(m_hImpl);
     833             :         else
     834           0 :             return false;
     835             :     }
     836             : 
     837           0 : inline rtl::OUString RegistryKey::getName()
     838             :     {
     839           0 :         rtl::OUString sRet;
     840           0 :         if (m_registry.isValid())
     841           0 :             m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
     842           0 :         return sRet;
     843             :     }
     844             : 
     845           0 : inline RegError RegistryKey::createKey(const rtl::OUString& keyName,
     846             :                                           RegistryKey& rNewKey)
     847             :     {
     848           0 :         if (rNewKey.isValid()) rNewKey.closeKey();
     849           0 :         if (m_registry.isValid())
     850             :         {
     851           0 :             RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
     852           0 :             if (!ret) rNewKey.setRegistry(m_registry);
     853           0 :             return ret;
     854             :         } else
     855           0 :             return REG_INVALID_KEY;
     856             :     }
     857             : 
     858           0 : inline RegError RegistryKey::openKey(const rtl::OUString& keyName,
     859             :                                      RegistryKey& rOpenKey)
     860             :     {
     861           0 :         if (rOpenKey.isValid()) rOpenKey.closeKey();
     862           0 :         if (m_registry.isValid())
     863             :         {
     864             :             RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
     865           0 :                                                     &rOpenKey.m_hImpl);
     866           0 :             if (!ret) rOpenKey.setRegistry(m_registry);
     867           0 :             return ret;
     868             :         } else
     869           0 :             return REG_INVALID_KEY;
     870             :     }
     871             : 
     872           0 : inline RegError RegistryKey::openSubKeys(const rtl::OUString& keyName,
     873             :                                          RegistryKeyArray& rSubKeys)
     874             :     {
     875           0 :         if (m_registry.isValid())
     876             :         {
     877           0 :             RegError        ret = REG_NO_ERROR;
     878             :             RegKeyHandle*   pSubKeys;
     879             :             sal_uInt32      nSubKeys;
     880             :              ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
     881           0 :                                                       &pSubKeys, &nSubKeys);
     882           0 :              if ( ret )
     883             :             {
     884           0 :                 return ret;
     885             :             } else
     886             :             {
     887           0 :                 rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
     888           0 :                 return ret;
     889             :             }
     890             :         } else
     891           0 :             return REG_INVALID_KEY;
     892             :     }
     893             : 
     894           0 : inline RegError RegistryKey::getKeyNames(const rtl::OUString& keyName,
     895             :                                              RegistryKeyNames& rSubKeyNames)
     896             :     {
     897           0 :         if (m_registry.isValid())
     898             :         {
     899           0 :             RegError        ret = REG_NO_ERROR;
     900             :             rtl_uString**   pSubKeyNames;
     901             :             sal_uInt32      nSubKeys;
     902             :              ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
     903           0 :                                                   &pSubKeyNames, &nSubKeys);
     904           0 :              if ( ret )
     905             :             {
     906           0 :                 return ret;
     907             :             } else
     908             :             {
     909           0 :                 rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
     910           0 :                 return ret;
     911             :             }
     912             :         } else
     913           0 :             return REG_INVALID_KEY;
     914             :     }
     915             : 
     916             : inline RegError RegistryKey::closeSubKeys(RegistryKeyArray& rSubKeys)
     917             :     {
     918             :         if (m_registry.isValid())
     919             :             return rSubKeys.closeKeyHandles();
     920             :         else
     921             :             return REG_INVALID_KEY;
     922             :     }
     923             : 
     924           0 : inline RegError RegistryKey::deleteKey(const rtl::OUString& keyName)
     925             :     {
     926           0 :         if (m_registry.isValid())
     927           0 :             return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
     928             :         else
     929           0 :             return REG_INVALID_KEY;
     930             :     }
     931             : 
     932           0 : inline RegError RegistryKey::closeKey()
     933             :     {
     934           0 :         if (m_registry.isValid())
     935             :         {
     936           0 :             RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
     937           0 :             if (!ret)
     938             :             {
     939           0 :                 m_hImpl = NULL;
     940           0 :                 m_registry = Registry();
     941             :             }
     942           0 :             return ret;
     943             :         } else
     944           0 :             return REG_INVALID_KEY;
     945             :     }
     946             : 
     947           0 : inline void RegistryKey::releaseKey()
     948             : {
     949           0 :     if (m_registry.isValid() && (m_hImpl != 0))
     950             :     {
     951           0 :         m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = 0;
     952             :     }
     953           0 : }
     954             : 
     955           0 : inline RegError RegistryKey::setValue(const rtl::OUString& keyName,
     956             :                                               RegValueType valueType,
     957             :                                            RegValue pValue,
     958             :                                               sal_uInt32 valueSize)
     959             :     {
     960           0 :         if (m_registry.isValid())
     961             :             return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
     962           0 :                                                 pValue, valueSize);
     963             :         else
     964           0 :             return REG_INVALID_KEY;
     965             :     }
     966             : 
     967           0 : inline RegError RegistryKey::setLongListValue(const rtl::OUString& keyName,
     968             :                                                   sal_Int32* pValueList,
     969             :                                                   sal_uInt32 len)
     970             :     {
     971           0 :         if (m_registry.isValid())
     972             :             return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
     973           0 :                                                            pValueList, len);
     974             :         else
     975           0 :             return REG_INVALID_KEY;
     976             :     }
     977             : 
     978           0 : inline RegError RegistryKey::setStringListValue(const rtl::OUString& keyName,
     979             :                                                    sal_Char** pValueList,
     980             :                                                    sal_uInt32 len)
     981             :     {
     982           0 :         if (m_registry.isValid())
     983             :             return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
     984           0 :                                                             pValueList, len);
     985             :         else
     986           0 :             return REG_INVALID_KEY;
     987             :     }
     988             : 
     989           0 : inline RegError RegistryKey::setUnicodeListValue(const rtl::OUString& keyName,
     990             :                                                         sal_Unicode** pValueList,
     991             :                                                         sal_uInt32 len)
     992             :     {
     993           0 :         if (m_registry.isValid())
     994             :             return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
     995           0 :                                                               pValueList, len);
     996             :         else
     997           0 :             return REG_INVALID_KEY;
     998             :     }
     999             : 
    1000           0 : inline RegError RegistryKey::getValueInfo(const rtl::OUString& keyName,
    1001             :                                                   RegValueType* pValueType,
    1002             :                                                   sal_uInt32* pValueSize)
    1003             :     {
    1004           0 :         if (m_registry.isValid())
    1005           0 :             return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
    1006             :         else
    1007           0 :             return REG_INVALID_KEY;
    1008             :     }
    1009             : 
    1010           0 : inline RegError RegistryKey::getValue(const rtl::OUString& keyName,
    1011             :                                         RegValue pValue)
    1012             :     {
    1013           0 :         if (m_registry.isValid())
    1014           0 :             return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
    1015             :         else
    1016           0 :             return REG_INVALID_KEY;
    1017             :     }
    1018             : 
    1019           0 : inline RegError RegistryKey::getLongListValue(const rtl::OUString& keyName,
    1020             :                                               RegistryValueList<sal_Int32>& rValueList)
    1021             :     {
    1022           0 :         if (m_registry.isValid())
    1023             :         {
    1024           0 :             RegError    ret = REG_NO_ERROR;
    1025             :             sal_Int32*  pValueList;
    1026             :             sal_uInt32  length;
    1027             :              ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
    1028           0 :                                                       &pValueList, &length);
    1029           0 :              if ( ret )
    1030             :             {
    1031           0 :                 return ret;
    1032             :             } else
    1033             :             {
    1034             :                 rValueList.setValueList(m_registry, RG_VALUETYPE_LONGLIST,
    1035           0 :                                         pValueList, length);
    1036           0 :                 return ret;
    1037             :             }
    1038             :         } else
    1039           0 :             return REG_INVALID_KEY;
    1040             :     }
    1041             : 
    1042           0 : inline RegError RegistryKey::getStringListValue(const rtl::OUString& keyName,
    1043             :                                                       RegistryValueList<sal_Char*>& rValueList)
    1044             :     {
    1045           0 :         if (m_registry.isValid())
    1046             :         {
    1047           0 :             RegError    ret = REG_NO_ERROR;
    1048             :             sal_Char**  pValueList;
    1049             :             sal_uInt32  length;
    1050             :              ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
    1051           0 :                                                       &pValueList, &length);
    1052           0 :              if ( ret )
    1053             :             {
    1054           0 :                 return ret;
    1055             :             } else
    1056             :             {
    1057             :                 rValueList.setValueList(m_registry, RG_VALUETYPE_STRINGLIST,
    1058           0 :                                         pValueList, length);
    1059           0 :                 return ret;
    1060             :             }
    1061             :         } else
    1062           0 :             return REG_INVALID_KEY;
    1063             :     }
    1064             : 
    1065           0 : inline RegError RegistryKey::getUnicodeListValue(const rtl::OUString& keyName,
    1066             :                                               RegistryValueList<sal_Unicode*>& rValueList)
    1067             :     {
    1068           0 :         if (m_registry.isValid())
    1069             :         {
    1070           0 :             RegError        ret = REG_NO_ERROR;
    1071             :             sal_Unicode**   pValueList;
    1072             :             sal_uInt32      length;
    1073             :              ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
    1074           0 :                                                       &pValueList, &length);
    1075           0 :              if ( ret )
    1076             :             {
    1077           0 :                 return ret;
    1078             :             } else
    1079             :             {
    1080             :                 rValueList.setValueList(m_registry, RG_VALUETYPE_UNICODELIST,
    1081           0 :                                         pValueList, length);
    1082           0 :                 return ret;
    1083             :             }
    1084             :         } else
    1085           0 :             return REG_INVALID_KEY;
    1086             :     }
    1087             : 
    1088           0 : inline RegError RegistryKey::createLink(const rtl::OUString& linkName,
    1089             :                                            const rtl::OUString& linkTarget)
    1090             :     {
    1091           0 :         if (m_registry.isValid())
    1092           0 :             return m_registry.m_pApi->createLink(m_hImpl, linkName.pData, linkTarget.pData);
    1093             :         else
    1094           0 :             return REG_INVALID_KEY;
    1095             :     }
    1096             : 
    1097           0 : inline RegError RegistryKey::deleteLink(const rtl::OUString& linkName)
    1098             :     {
    1099           0 :         if (m_registry.isValid())
    1100           0 :             return m_registry.m_pApi->deleteLink(m_hImpl, linkName.pData);
    1101             :         else
    1102           0 :             return REG_INVALID_KEY;
    1103             :     }
    1104             : 
    1105           0 : inline RegError RegistryKey::getKeyType(const rtl::OUString& keyName,
    1106             :                                               RegKeyType* pKeyType) const
    1107             :     {
    1108           0 :         if (m_registry.isValid())
    1109           0 :             return m_registry.m_pApi->getKeyType(m_hImpl, keyName.pData, pKeyType);
    1110             :         else
    1111           0 :             return REG_INVALID_KEY;
    1112             :     }
    1113             : 
    1114           0 : inline RegError RegistryKey::getLinkTarget(const rtl::OUString& linkName,
    1115             :                                                rtl::OUString& rLinkTarget) const
    1116             :     {
    1117           0 :         if (m_registry.isValid())
    1118             :         {
    1119             :             return m_registry.m_pApi->getLinkTarget(m_hImpl,
    1120             :                                                     linkName.pData,
    1121           0 :                                                     &rLinkTarget.pData);
    1122             :         } else
    1123           0 :             return REG_INVALID_KEY;
    1124             :     }
    1125             : 
    1126             : 
    1127           0 : inline RegError RegistryKey::getResolvedKeyName(const rtl::OUString& keyName,
    1128             :                                                 bool firstLinkOnly,
    1129             :                                                        rtl::OUString& rResolvedName) const
    1130             :     {
    1131           0 :         if (m_registry.isValid())
    1132             :             return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
    1133             :                                                          keyName.pData,
    1134             :                                                          firstLinkOnly,
    1135           0 :                                                          &rResolvedName.pData);
    1136             :         else
    1137           0 :             return REG_INVALID_KEY;
    1138             :     }
    1139             : 
    1140           0 : inline rtl::OUString RegistryKey::getRegistryName()
    1141             :     {
    1142           0 :         if (m_registry.isValid())
    1143             :         {
    1144           0 :             return m_registry.getName();
    1145             :         } else
    1146           0 :             return rtl::OUString();
    1147             :     }
    1148             : 
    1149             : 
    1150             : 
    1151           0 : inline Registry::Registry()
    1152           0 :     : m_pApi(initRegistry_Api())
    1153           0 :     , m_hImpl(NULL)
    1154           0 :     { }
    1155             : 
    1156           0 : inline Registry::Registry(const Registry& toCopy)
    1157             :     : m_pApi(toCopy.m_pApi)
    1158           0 :     , m_hImpl(toCopy.m_hImpl)
    1159             :     {
    1160           0 :         if (m_hImpl)
    1161           0 :             m_pApi->acquire(m_hImpl);
    1162           0 :     }
    1163             : 
    1164             : 
    1165           0 : inline Registry::~Registry()
    1166             :     {
    1167           0 :         if (m_hImpl)
    1168           0 :             m_pApi->release(m_hImpl);
    1169           0 :     }
    1170             : 
    1171           0 : inline Registry& Registry::operator = (const Registry& toAssign)
    1172             : {
    1173           0 :     if (toAssign.m_hImpl)
    1174           0 :         toAssign.m_pApi->acquire(toAssign.m_hImpl);
    1175           0 :     if (m_hImpl)
    1176           0 :         m_pApi->release(m_hImpl);
    1177             : 
    1178           0 :     m_pApi  = toAssign.m_pApi;
    1179           0 :     m_hImpl = toAssign.m_hImpl;
    1180             : 
    1181           0 :     return *this;
    1182             : }
    1183             : 
    1184           0 : inline bool Registry::isValid() const
    1185           0 :     {  return ( m_hImpl != NULL ); }
    1186             : 
    1187           0 : inline bool Registry::isReadOnly() const
    1188           0 :     {  return m_pApi->isReadOnly(m_hImpl); }
    1189             : 
    1190           0 : inline RegError Registry::openRootKey(RegistryKey& rRootKey)
    1191             :     {
    1192           0 :         rRootKey.setRegistry(*this);
    1193           0 :         return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
    1194             :     }
    1195             : 
    1196           0 : inline rtl::OUString Registry::getName()
    1197             :     {
    1198           0 :         rtl::OUString sRet;
    1199           0 :         m_pApi->getName(m_hImpl, &sRet.pData);
    1200           0 :         return sRet;
    1201             :     }
    1202             : 
    1203           0 : inline RegError Registry::create(const rtl::OUString& registryName)
    1204             :     {
    1205           0 :         if (m_hImpl)
    1206           0 :             m_pApi->release(m_hImpl);
    1207           0 :         return m_pApi->createRegistry(registryName.pData, &m_hImpl);
    1208             :     }
    1209             : 
    1210           0 : inline RegError Registry::open(const rtl::OUString& registryName,
    1211             :                                   RegAccessMode accessMode)
    1212             :     {
    1213           0 :         if (m_hImpl)
    1214           0 :             m_pApi->release(m_hImpl);
    1215           0 :         return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
    1216             :     }
    1217             : 
    1218           0 : inline RegError Registry::close()
    1219             :     {
    1220           0 :         RegError ret = m_pApi->closeRegistry(m_hImpl);
    1221           0 :         if (!ret)
    1222           0 :             m_hImpl = NULL;
    1223           0 :         return ret;
    1224             :     }
    1225             : 
    1226           0 : inline RegError Registry::destroy(const rtl::OUString& registryName)
    1227             :     {
    1228           0 :         RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
    1229           0 :         if ( !ret && registryName.isEmpty() )
    1230           0 :             m_hImpl = NULL;
    1231           0 :         return ret;
    1232             :     }
    1233             : 
    1234             : inline RegError Registry::loadKey(RegistryKey& rKey,
    1235             :                                       const rtl::OUString& keyName,
    1236             :                                       const rtl::OUString& regFileName)
    1237             :     {  return m_pApi->loadKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
    1238             : 
    1239             : inline RegError Registry::saveKey(RegistryKey& rKey,
    1240             :                                      const rtl::OUString& keyName,
    1241             :                                      const rtl::OUString& regFileName)
    1242             :     {  return m_pApi->saveKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
    1243             : 
    1244           0 : inline RegError Registry::mergeKey(RegistryKey& rKey,
    1245             :                                          const rtl::OUString& keyName,
    1246             :                                          const rtl::OUString& regFileName,
    1247             :                                          bool bWarnings,
    1248             :                                          bool bReport)
    1249           0 :     {  return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, bWarnings, bReport); }
    1250             : 
    1251             : inline RegError Registry::dumpRegistry(RegistryKey& rKey)
    1252             :     {  return m_pApi->dumpRegistry(m_hImpl, rKey.m_hImpl); }
    1253             : 
    1254             : 
    1255             : #endif
    1256             : 
    1257             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10