1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _KEYIMPL_HXX_ 29 #define _KEYIMPL_HXX_ 30 31 #include <registry/registry.h> 32 #include "regimpl.hxx" 33 #include <rtl/ustring.hxx> 34 35 class ORegKey 36 { 37 public: 38 39 ORegKey(const rtl::OUString& keyName, ORegistry* pReg); 40 ~ORegKey(); 41 42 sal_uInt32 acquire() 43 { return ++m_refCount; } 44 45 sal_uInt32 release() 46 { return --m_refCount; } 47 48 RegError acquireKey(RegKeyHandle hKey); 49 RegError releaseKey(RegKeyHandle hKey); 50 51 RegError createKey(const rtl::OUString& keyName, RegKeyHandle* phNewKey); 52 53 RegError openKey(const rtl::OUString& keyName, RegKeyHandle* phOpenKey); 54 55 RegError openSubKeys(const rtl::OUString& keyName, 56 RegKeyHandle** phOpenSubKeys, 57 sal_uInt32* pnSubKeys); 58 59 RegError getKeyNames(const rtl::OUString& keyName, 60 rtl_uString*** pSubKeyNames, 61 sal_uInt32* pnSubKeys); 62 63 RegError closeKey(RegKeyHandle hKey); 64 65 RegError deleteKey(const rtl::OUString& keyName); 66 67 RegError getValueInfo(const rtl::OUString& valueName, 68 RegValueType* pValueTye, 69 sal_uInt32* pValueSize) const; 70 71 RegError setValue(const rtl::OUString& valueName, 72 RegValueType vType, 73 RegValue value, 74 sal_uInt32 vSize); 75 76 RegError setLongListValue(const rtl::OUString& valueName, 77 sal_Int32* pValueList, 78 sal_uInt32 len); 79 80 RegError setStringListValue(const rtl::OUString& valueName, 81 sal_Char** pValueList, 82 sal_uInt32 len); 83 84 RegError setUnicodeListValue(const rtl::OUString& valueName, 85 sal_Unicode** pValueList, 86 sal_uInt32 len); 87 88 RegError getValue(const rtl::OUString& valueName, RegValue value) const; 89 90 RegError getLongListValue(const rtl::OUString& valueName, 91 sal_Int32** pValueList, 92 sal_uInt32* pLen) const; 93 94 RegError getStringListValue(const rtl::OUString& valueName, 95 sal_Char*** pValueList, 96 sal_uInt32* pLen) const; 97 98 RegError getUnicodeListValue(const rtl::OUString& valueName, 99 sal_Unicode*** pValueList, 100 sal_uInt32* pLen) const; 101 102 RegError getKeyType(const rtl::OUString& name, 103 RegKeyType* pKeyType) const; 104 105 RegError getResolvedKeyName(const rtl::OUString& keyName, 106 rtl::OUString& resolvedName); 107 108 bool isDeleted() const 109 { return m_bDeleted != 0; } 110 111 void setDeleted (sal_Bool bKeyDeleted) 112 { m_bDeleted = bKeyDeleted ? 1 : 0; } 113 114 bool isModified() const 115 { return m_bModified != 0; } 116 117 void setModified (bool bModified = true) 118 { m_bModified = bModified ? 1 : 0; } 119 120 sal_Bool isReadOnly() const 121 { return m_pRegistry->isReadOnly(); } 122 123 sal_uInt32 countSubKeys(); 124 125 ORegistry* getRegistry() const 126 { return m_pRegistry; } 127 128 const store::OStoreFile& getStoreFile() const 129 { return m_pRegistry->getStoreFile(); } 130 131 store::OStoreDirectory getStoreDir(); 132 133 const rtl::OUString& getName() const 134 { return m_name; } 135 136 sal_uInt32 getRefCount() const 137 { return m_refCount; } 138 139 rtl::OUString getFullPath(rtl::OUString const & path) const; 140 141 private: 142 sal_uInt32 m_refCount; 143 rtl::OUString m_name; 144 int m_bDeleted:1; 145 int m_bModified:1; 146 ORegistry* m_pRegistry; 147 }; 148 149 #endif 150 151 152