fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / registry / source / regimpl.hxx
blob6d38cb7969475fb9b94a7d2f29ba3ec4d88fdd4c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_REGISTRY_SOURCE_REGIMPL_HXX
21 #define INCLUDED_REGISTRY_SOURCE_REGIMPL_HXX
23 #include <set>
24 #include <unordered_map>
26 #include <registry/registry.h>
27 #include <rtl/ustring.hxx>
28 #include <osl/mutex.hxx>
29 #include <store/store.hxx>
31 #define REG_PAGESIZE 512
33 #define REG_MODE_CREATE store_AccessCreate
34 #define REG_MODE_OPEN store_AccessReadWrite
35 #define REG_MODE_OPENREAD store_AccessReadOnly
37 #define KEY_MODE_CREATE store_AccessCreate
38 #define KEY_MODE_OPEN store_AccessReadWrite
39 #define KEY_MODE_OPENREAD store_AccessReadOnly
42 #define VALUE_MODE_CREATE store_AccessCreate
43 #define VALUE_MODE_OPEN store_AccessReadWrite
44 #define VALUE_MODE_OPENREAD store_AccessReadOnly
46 // 5 bytes = 1 (byte for the type) + 4 (bytes for the size of the data)
47 #define VALUE_HEADERSIZE 5
48 #define VALUE_TYPEOFFSET 1
49 #define VALUE_HEADEROFFSET 5
51 #define REG_GUARD(mutex) \
52 osl::Guard< osl::Mutex > aGuard( mutex );
54 class ORegKey;
55 class RegistryTypeReader;
57 class ORegistry
59 public:
60 ORegistry();
62 sal_uInt32 acquire()
63 { return ++m_refCount; }
65 sal_uInt32 release()
66 { return --m_refCount; }
68 RegError initRegistry(const OUString& name,
69 RegAccessMode accessMode,
70 bool bCreate = false);
72 RegError closeRegistry();
74 RegError destroyRegistry(const OUString& name);
76 RegError acquireKey(RegKeyHandle hKey);
77 RegError releaseKey(RegKeyHandle hKey);
79 RegError createKey(RegKeyHandle hKey,
80 const OUString& keyName,
81 RegKeyHandle* phNewKey);
83 RegError openKey(RegKeyHandle hKey,
84 const OUString& keyName,
85 RegKeyHandle* phOpenKey);
87 RegError closeKey(RegKeyHandle hKey);
89 RegError deleteKey(RegKeyHandle hKey, const OUString& keyName);
91 RegError loadKey(RegKeyHandle hKey,
92 const OUString& regFileName,
93 bool bWarings=false,
94 bool bReport=false);
96 RegError saveKey(RegKeyHandle hKey,
97 const OUString& regFileName,
98 bool bWarings=false,
99 bool bReport=false);
101 RegError dumpRegistry(RegKeyHandle hKey) const;
103 ~ORegistry();
105 bool isReadOnly() const
106 { return m_readOnly; }
108 bool isOpen() const
109 { return m_isOpen; }
111 ORegKey* getRootKey();
113 const store::OStoreFile& getStoreFile() const
114 { return m_file; }
116 const OUString& getName() const
117 { return m_name; }
119 friend class ORegKey;
121 private:
122 RegError eraseKey(ORegKey* pKey, const OUString& keyName);
124 RegError deleteSubkeysAndValues(ORegKey* pKey);
126 RegError loadAndSaveValue(ORegKey* pTargetKey,
127 ORegKey* pSourceKey,
128 const OUString& valueName,
129 sal_uInt32 nCut,
130 bool bWarnings=false,
131 bool bReport=false);
133 static RegError checkBlop(store::OStoreStream& rValue,
134 const OUString& sTargetPath,
135 sal_uInt32 srcValueSize,
136 sal_uInt8* pSrcBuffer,
137 bool bReport=false);
139 static RegError mergeModuleValue(store::OStoreStream& rTargetValue,
140 RegistryTypeReader& reader,
141 RegistryTypeReader& reader2);
143 RegError loadAndSaveKeys(ORegKey* pTargetKey,
144 ORegKey* pSourceKey,
145 const OUString& keyName,
146 sal_uInt32 nCut,
147 bool bWarnings=false,
148 bool bReport=false);
150 RegError dumpValue(const OUString& sPath,
151 const OUString& sName,
152 sal_Int16 nSpace) const;
154 RegError dumpKey(const OUString& sPath,
155 const OUString& sName,
156 sal_Int16 nSpace) const;
158 typedef std::unordered_map< OUString, ORegKey*, OUStringHash > KeyMap;
160 sal_uInt32 m_refCount;
161 osl::Mutex m_mutex;
162 bool m_readOnly;
163 bool m_isOpen;
164 OUString m_name;
165 store::OStoreFile m_file;
166 KeyMap m_openKeyTable;
168 const OUString ROOT;
171 #endif
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */