LCOV - code coverage report
Current view: top level - registry/source - regimpl.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 12 0.0 %
Date: 2014-04-14 Functions: 0 6 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 _REGIMPL_HXX_
      21             : #define _REGIMPL_HXX_
      22             : 
      23             : #include <set>
      24             : #include <boost/unordered_map.hpp>
      25             : 
      26             : #include <registry/registry.h>
      27             : #include <rtl/ustring.hxx>
      28             : #include <osl/mutex.hxx>
      29             : #include <store/store.hxx>
      30             : 
      31             : #define REG_PAGESIZE 512
      32             : 
      33             : #define REG_MODE_CREATE     store_AccessCreate
      34             : #define REG_MODE_OPEN       store_AccessReadWrite
      35             : #define REG_MODE_OPENREAD   store_AccessReadOnly
      36             : 
      37             : #define KEY_MODE_CREATE     store_AccessCreate
      38             : #define KEY_MODE_OPEN       store_AccessReadWrite
      39             : #define KEY_MODE_OPENREAD   store_AccessReadOnly
      40             : 
      41             : 
      42             : #define VALUE_MODE_CREATE   store_AccessCreate
      43             : #define VALUE_MODE_OPEN     store_AccessReadWrite
      44             : #define VALUE_MODE_OPENREAD store_AccessReadOnly
      45             : 
      46             : // 5 Bytes = 1 (Byte fuer den Typ) + 4 (Bytes fuer die Groesse der Daten)
      47             : #define VALUE_HEADERSIZE    5
      48             : #define VALUE_TYPEOFFSET    1
      49             : #define VALUE_HEADEROFFSET  5
      50             : 
      51             : #define REG_CREATE      0x0004  // allow write accesses
      52             : 
      53             : #define REG_GUARD(mutex) \
      54             :     osl::Guard< osl::Mutex > aGuard( mutex );
      55             : 
      56             : class ORegKey;
      57             : class RegistryTypeReader;
      58             : 
      59             : class ORegistry
      60             : {
      61             : public:
      62             :     ORegistry();
      63             : 
      64           0 :     sal_uInt32  acquire()
      65           0 :         { return ++m_refCount; }
      66             : 
      67           0 :     sal_uInt32  release()
      68           0 :         { return --m_refCount; }
      69             : 
      70             :     RegError    initRegistry(const OUString& name,
      71             :                              RegAccessMode accessMode);
      72             : 
      73             :     RegError    closeRegistry();
      74             : 
      75             :     RegError    destroyRegistry(const OUString& name);
      76             : 
      77             :     RegError    acquireKey(RegKeyHandle hKey);
      78             :     RegError    releaseKey(RegKeyHandle hKey);
      79             : 
      80             :     RegError    createKey(RegKeyHandle hKey,
      81             :                           const OUString& keyName,
      82             :                           RegKeyHandle* phNewKey);
      83             : 
      84             :     RegError    openKey(RegKeyHandle hKey,
      85             :                         const OUString& keyName,
      86             :                         RegKeyHandle* phOpenKey);
      87             : 
      88             :     RegError    closeKey(RegKeyHandle hKey);
      89             : 
      90             :     RegError    deleteKey(RegKeyHandle hKey, const OUString& keyName);
      91             : 
      92             :     RegError    loadKey(RegKeyHandle hKey,
      93             :                         const OUString& regFileName,
      94             :                         bool bWarings=false,
      95             :                         bool bReport=false);
      96             : 
      97             :     RegError    saveKey(RegKeyHandle hKey,
      98             :                         const OUString& regFileName,
      99             :                         bool bWarings=false,
     100             :                         bool bReport=false);
     101             : 
     102             :     RegError    dumpRegistry(RegKeyHandle hKey) const;
     103             : 
     104             :     ~ORegistry();
     105             : 
     106           0 :     bool            isReadOnly() const
     107           0 :         { return m_readOnly; }
     108             : 
     109           0 :     bool            isOpen() const
     110           0 :         { return m_isOpen; }
     111             : 
     112             :     ORegKey*    getRootKey();
     113             : 
     114           0 :     const store::OStoreFile& getStoreFile() const
     115           0 :         { return m_file; }
     116             : 
     117           0 :     const OUString&    getName() const
     118           0 :         { return m_name; }
     119             : 
     120             :     friend class ORegKey;
     121             : 
     122             : private:
     123             :     RegError    eraseKey(ORegKey* pKey, const OUString& keyName);
     124             : 
     125             :     RegError    deleteSubkeysAndValues(ORegKey* pKey);
     126             : 
     127             :     RegError    loadAndSaveValue(ORegKey* pTargetKey,
     128             :                                  ORegKey* pSourceKey,
     129             :                                  const OUString& valueName,
     130             :                                  sal_uInt32 nCut,
     131             :                                  bool bWarnings=false,
     132             :                                  bool bReport=false);
     133             : 
     134             :     RegError    checkBlop(store::OStoreStream& rValue,
     135             :                           const OUString& sTargetPath,
     136             :                           sal_uInt32 srcValueSize,
     137             :                           sal_uInt8* pSrcBuffer,
     138             :                           bool bReport=false);
     139             : 
     140             :     RegError    mergeModuleValue(store::OStoreStream& rTargetValue,
     141             :                                  RegistryTypeReader& reader,
     142             :                                  RegistryTypeReader& reader2);
     143             : 
     144             :     RegError    loadAndSaveKeys(ORegKey* pTargetKey,
     145             :                                 ORegKey* pSourceKey,
     146             :                                 const OUString& keyName,
     147             :                                 sal_uInt32 nCut,
     148             :                                 bool bWarnings=false,
     149             :                                 bool bReport=false);
     150             : 
     151             :     RegError    dumpValue(const OUString& sPath,
     152             :                           const OUString& sName,
     153             :                           sal_Int16 nSpace) const;
     154             : 
     155             :     RegError    dumpKey(const OUString& sPath,
     156             :                         const OUString& sName,
     157             :                         sal_Int16 nSpace) const;
     158             : 
     159             :     typedef boost::unordered_map< OUString, ORegKey*, OUStringHash > KeyMap;
     160             : 
     161             :     sal_uInt32      m_refCount;
     162             :     osl::Mutex          m_mutex;
     163             :     bool            m_readOnly;
     164             :     bool            m_isOpen;
     165             :     OUString       m_name;
     166             :     store::OStoreFile   m_file;
     167             :     KeyMap          m_openKeyTable;
     168             : 
     169             :     const OUString ROOT;
     170             : };
     171             : 
     172             : #endif
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10