Branch data 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 : : #include "sal/config.h"
21 : :
22 : : #include <cstdlib>
23 : : #include <memory>
24 : : #include <vector>
25 : :
26 : : #include "com/sun/star/lang/XServiceInfo.hpp"
27 : : #include "com/sun/star/registry/InvalidRegistryException.hpp"
28 : : #include "com/sun/star/registry/InvalidValueException.hpp"
29 : : #include "com/sun/star/registry/MergeConflictException.hpp"
30 : : #include "com/sun/star/registry/RegistryKeyType.hpp"
31 : : #include "com/sun/star/registry/XRegistryKey.hpp"
32 : : #include "com/sun/star/registry/XSimpleRegistry.hpp"
33 : : #include "com/sun/star/uno/Reference.hxx"
34 : : #include "com/sun/star/uno/RuntimeException.hpp"
35 : : #include "com/sun/star/uno/XComponentContext.hpp"
36 : : #include "com/sun/star/uno/XInterface.hpp"
37 : : #include "com/sun/star/uno/Sequence.hxx"
38 : : #include "cppuhelper/implbase1.hxx"
39 : : #include "cppuhelper/implbase2.hxx"
40 : : #include "cppuhelper/weak.hxx"
41 : : #include "osl/mutex.hxx"
42 : : #include "registry/registry.hxx"
43 : : #include "registry/regtype.h"
44 : : #include "rtl/ref.hxx"
45 : : #include "rtl/string.h"
46 : : #include "rtl/string.hxx"
47 : : #include "rtl/textcvt.h"
48 : : #include "rtl/textenc.h"
49 : : #include "rtl/unload.h"
50 : : #include "rtl/ustring.h"
51 : : #include "rtl/ustring.hxx"
52 : : #include "sal/types.h"
53 : :
54 : : #include "bootstrapservices.hxx"
55 : :
56 : : #include "textualservices.hxx"
57 : :
58 : : extern rtl_StandardModuleCount g_moduleCount;
59 : :
60 : : namespace {
61 : :
62 : : namespace css = com::sun::star;
63 : :
64 : : class SimpleRegistry:
65 : : public cppu::WeakImplHelper2<
66 : : css::registry::XSimpleRegistry, css::lang::XServiceInfo >
67 : : {
68 : : public:
69 [ + - ][ + - ]: 2384 : SimpleRegistry() { g_moduleCount.modCnt.acquire(&g_moduleCount.modCnt); }
[ + - ]
70 : :
71 [ + - ][ + - ]: 2572 : ~SimpleRegistry() { g_moduleCount.modCnt.release(&g_moduleCount.modCnt); }
[ + - ][ + - ]
[ - + ]
72 : :
73 : : osl::Mutex mutex_;
74 : :
75 : : private:
76 : : virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
77 : :
78 : : virtual void SAL_CALL open(
79 : : rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
80 : : throw (
81 : : css::registry::InvalidRegistryException,
82 : : css::uno::RuntimeException);
83 : :
84 : : virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
85 : :
86 : : virtual void SAL_CALL close() throw (
87 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
88 : :
89 : : virtual void SAL_CALL destroy() throw(
90 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
91 : :
92 : : virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
93 : : getRootKey() throw(
94 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
95 : :
96 : : virtual sal_Bool SAL_CALL isReadOnly() throw(
97 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
98 : :
99 : : virtual void SAL_CALL mergeKey(
100 : : rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
101 : : throw (
102 : : css::registry::InvalidRegistryException,
103 : : css::registry::MergeConflictException, css::uno::RuntimeException);
104 : :
105 : 0 : virtual rtl::OUString SAL_CALL getImplementationName()
106 : : throw (css::uno::RuntimeException)
107 : 0 : { return stoc_bootstrap::simreg_getImplementationName(); }
108 : :
109 : 0 : virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
110 : : throw (css::uno::RuntimeException)
111 [ # # ]: 0 : { return ServiceName == getSupportedServiceNames()[0]; }
112 : :
113 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL
114 : 0 : getSupportedServiceNames() throw (css::uno::RuntimeException)
115 : 0 : { return stoc_bootstrap::simreg_getSupportedServiceNames(); }
116 : :
117 : : Registry registry_;
118 : : std::auto_ptr< stoc::simpleregistry::TextualServices > textual_;
119 : : };
120 : :
121 [ + - ][ - + ]: 1380826 : class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > {
122 : : public:
123 : 691506 : Key(
124 : : rtl::Reference< SimpleRegistry > const & registry,
125 : : RegistryKey const & key):
126 [ + - ]: 691506 : registry_(registry), key_(key) {}
127 : :
128 : : private:
129 : : virtual rtl::OUString SAL_CALL getKeyName()
130 : : throw (css::uno::RuntimeException);
131 : :
132 : : virtual sal_Bool SAL_CALL isReadOnly() throw (
133 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
134 : :
135 : : virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException);
136 : :
137 : : virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
138 : : rtl::OUString const & rKeyName)
139 : : throw (
140 : : css::registry::InvalidRegistryException,
141 : : css::uno::RuntimeException);
142 : :
143 : : virtual css::registry::RegistryValueType SAL_CALL getValueType() throw(
144 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
145 : :
146 : : virtual sal_Int32 SAL_CALL getLongValue() throw (
147 : : css::registry::InvalidRegistryException,
148 : : css::registry::InvalidValueException, css::uno::RuntimeException);
149 : :
150 : : virtual void SAL_CALL setLongValue(sal_Int32 value) throw (
151 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
152 : :
153 : : virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw(
154 : : css::registry::InvalidRegistryException,
155 : : css::registry::InvalidValueException, css::uno::RuntimeException);
156 : :
157 : : virtual void SAL_CALL setLongListValue(
158 : : com::sun::star::uno::Sequence< sal_Int32 > const & seqValue)
159 : : throw (
160 : : css::registry::InvalidRegistryException,
161 : : css::uno::RuntimeException);
162 : :
163 : : virtual rtl::OUString SAL_CALL getAsciiValue() throw (
164 : : css::registry::InvalidRegistryException,
165 : : css::registry::InvalidValueException, css::uno::RuntimeException);
166 : :
167 : : virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw (
168 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
169 : :
170 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue()
171 : : throw (
172 : : css::registry::InvalidRegistryException,
173 : : css::registry::InvalidValueException, css::uno::RuntimeException);
174 : :
175 : : virtual void SAL_CALL setAsciiListValue(
176 : : css::uno::Sequence< rtl::OUString > const & seqValue)
177 : : throw (
178 : : css::registry::InvalidRegistryException,
179 : : css::uno::RuntimeException);
180 : :
181 : : virtual rtl::OUString SAL_CALL getStringValue() throw(
182 : : css::registry::InvalidRegistryException,
183 : : css::registry::InvalidValueException, css::uno::RuntimeException);
184 : :
185 : : virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw (
186 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
187 : :
188 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue()
189 : : throw (
190 : : css::registry::InvalidRegistryException,
191 : : css::registry::InvalidValueException, css::uno::RuntimeException);
192 : :
193 : : virtual void SAL_CALL setStringListValue(
194 : : css::uno::Sequence< rtl::OUString > const & seqValue)
195 : : throw (
196 : : css::registry::InvalidRegistryException,
197 : : css::uno::RuntimeException);
198 : :
199 : : virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw (
200 : : css::registry::InvalidRegistryException,
201 : : css::registry::InvalidValueException, css::uno::RuntimeException);
202 : :
203 : : virtual void SAL_CALL setBinaryValue(
204 : : css::uno::Sequence< sal_Int8 > const & value)
205 : : throw (
206 : : css::registry::InvalidRegistryException,
207 : : css::uno::RuntimeException);
208 : :
209 : : virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
210 : : rtl::OUString const & aKeyName)
211 : : throw (
212 : : css::registry::InvalidRegistryException,
213 : : css::uno::RuntimeException);
214 : :
215 : : virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
216 : : createKey(rtl::OUString const & aKeyName) throw (
217 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
218 : :
219 : : virtual void SAL_CALL closeKey() throw (
220 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
221 : :
222 : : virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw (
223 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
224 : :
225 : : virtual
226 : : css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
227 : : SAL_CALL openKeys() throw (
228 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
229 : :
230 : : virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw (
231 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
232 : :
233 : : virtual sal_Bool SAL_CALL createLink(
234 : : rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
235 : : throw (
236 : : css::registry::InvalidRegistryException,
237 : : css::uno::RuntimeException);
238 : :
239 : : virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw (
240 : : css::registry::InvalidRegistryException, css::uno::RuntimeException);
241 : :
242 : : virtual rtl::OUString SAL_CALL getLinkTarget(
243 : : rtl::OUString const & rLinkName)
244 : : throw (
245 : : css::registry::InvalidRegistryException,
246 : : css::uno::RuntimeException);
247 : :
248 : : virtual rtl::OUString SAL_CALL getResolvedName(
249 : : rtl::OUString const & aKeyName)
250 : : throw (
251 : : css::registry::InvalidRegistryException,
252 : : css::uno::RuntimeException);
253 : :
254 : : rtl::Reference< SimpleRegistry > registry_;
255 : : RegistryKey key_;
256 : : };
257 : :
258 : 154649 : rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) {
259 [ + - ]: 154649 : osl::MutexGuard guard(registry_->mutex_);
260 [ + - ][ + - ]: 154649 : return key_.getName();
261 : : }
262 : :
263 : 64 : sal_Bool Key::isReadOnly()
264 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
265 : : {
266 [ + - ]: 64 : osl::MutexGuard guard(registry_->mutex_);
267 [ + - ][ + - ]: 64 : return key_.isReadOnly();
268 : : }
269 : :
270 : 851765 : sal_Bool Key::isValid() throw (css::uno::RuntimeException) {
271 [ + - ]: 851765 : osl::MutexGuard guard(registry_->mutex_);
272 [ + - ]: 851765 : return key_.isValid();
273 : : }
274 : :
275 : 820 : css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName)
276 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
277 : : {
278 [ + - ]: 820 : osl::MutexGuard guard(registry_->mutex_);
279 : : RegKeyType type;
280 [ + - ]: 820 : RegError err = key_.getKeyType(rKeyName, &type);
281 [ - + ]: 820 : if (err != REG_NO_ERROR) {
282 : : throw css::registry::InvalidRegistryException(
283 : : (rtl::OUString(
284 : : RTL_CONSTASCII_USTRINGPARAM(
285 : : "com.sun.star.registry.SimpleRegistry key getKeyType:"
286 : : " underlying RegistryKey::getKeyType() = ")) +
287 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
288 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
289 : : }
290 [ - + - ]: 820 : switch (type) {
291 : : default:
292 : 0 : std::abort(); // this cannot happen
293 : : // pseudo-fall-through to avoid warnings on MSC
294 : : case RG_KEYTYPE:
295 : 820 : return css::registry::RegistryKeyType_KEY;
296 : : case RG_LINKTYPE:
297 : 0 : return css::registry::RegistryKeyType_LINK;
298 [ + - ]: 820 : }
299 : : }
300 : :
301 : 70579 : css::registry::RegistryValueType Key::getValueType()
302 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
303 : : {
304 [ + - ]: 70579 : osl::MutexGuard guard(registry_->mutex_);
305 : : RegValueType type;
306 : : sal_uInt32 size;
307 [ + - ]: 70579 : RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
308 [ + + - ]: 70579 : switch (err) {
309 : : case REG_NO_ERROR:
310 : 69695 : break;
311 : : case REG_INVALID_VALUE:
312 : 884 : type = RG_VALUETYPE_NOT_DEFINED;
313 : 884 : break;
314 : : default:
315 : : throw css::registry::InvalidRegistryException(
316 : : (rtl::OUString(
317 : : RTL_CONSTASCII_USTRINGPARAM(
318 : : "com.sun.star.registry.SimpleRegistry key getValueType:"
319 : : " underlying RegistryKey::getValueInfo() = ")) +
320 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
321 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
322 : : }
323 [ - + - + : 70579 : switch (type) {
- + - -
- ]
324 : : default:
325 : 0 : std::abort(); // this cannot happen
326 : : // pseudo-fall-through to avoid warnings on MSC
327 : : case RG_VALUETYPE_NOT_DEFINED:
328 : 884 : return css::registry::RegistryValueType_NOT_DEFINED;
329 : : case RG_VALUETYPE_LONG:
330 : 0 : return css::registry::RegistryValueType_LONG;
331 : : case RG_VALUETYPE_STRING:
332 : 254 : return css::registry::RegistryValueType_ASCII;
333 : : case RG_VALUETYPE_UNICODE:
334 : 0 : return css::registry::RegistryValueType_STRING;
335 : : case RG_VALUETYPE_BINARY:
336 : 69441 : return css::registry::RegistryValueType_BINARY;
337 : : case RG_VALUETYPE_LONGLIST:
338 : 0 : return css::registry::RegistryValueType_LONGLIST;
339 : : case RG_VALUETYPE_STRINGLIST:
340 : 0 : return css::registry::RegistryValueType_ASCIILIST;
341 : : case RG_VALUETYPE_UNICODELIST:
342 : 0 : return css::registry::RegistryValueType_STRINGLIST;
343 [ + - ]: 70579 : }
344 : : }
345 : :
346 : 0 : sal_Int32 Key::getLongValue() throw (
347 : : css::registry::InvalidRegistryException,
348 : : css::registry::InvalidValueException, css::uno::RuntimeException)
349 : : {
350 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
351 : : sal_Int32 value;
352 [ # # ]: 0 : RegError err = key_.getValue(rtl::OUString(), &value);
353 [ # # # ]: 0 : switch (err) {
354 : : case REG_NO_ERROR:
355 : 0 : break;
356 : : case REG_INVALID_VALUE:
357 : : throw css::registry::InvalidValueException(
358 : : rtl::OUString(
359 : : RTL_CONSTASCII_USTRINGPARAM(
360 : : "com.sun.star.registry.SimpleRegistry key getLongValue:"
361 : : " underlying RegistryKey::getValue() = REG_INVALID_VALUE")),
362 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
363 : : default:
364 : : throw css::registry::InvalidRegistryException(
365 : : (rtl::OUString(
366 : : RTL_CONSTASCII_USTRINGPARAM(
367 : : "com.sun.star.registry.SimpleRegistry key getLongValue:"
368 : : " underlying RegistryKey::getValue() = ")) +
369 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
370 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
371 : : }
372 [ # # ]: 0 : return value;
373 : : }
374 : :
375 : 0 : void Key::setLongValue(sal_Int32 value)
376 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
377 : : {
378 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
379 : : RegError err = key_.setValue(
380 [ # # ]: 0 : rtl::OUString(), RG_VALUETYPE_LONG, &value, sizeof (sal_Int32));
381 [ # # ]: 0 : if (err != REG_NO_ERROR) {
382 : : throw css::registry::InvalidRegistryException(
383 : : (rtl::OUString(
384 : : RTL_CONSTASCII_USTRINGPARAM(
385 : : "com.sun.star.registry.SimpleRegistry key setLongValue:"
386 : : " underlying RegistryKey::setValue() = ")) +
387 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
388 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
389 [ # # ]: 0 : }
390 : 0 : }
391 : :
392 : 0 : css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw (
393 : : css::registry::InvalidRegistryException,
394 : : css::registry::InvalidValueException, css::uno::RuntimeException)
395 : : {
396 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
397 [ # # ]: 0 : RegistryValueList< sal_Int32 > list;
398 [ # # ]: 0 : RegError err = key_.getLongListValue(rtl::OUString(), list);
399 [ # # # # ]: 0 : switch (err) {
400 : : case REG_NO_ERROR:
401 : 0 : break;
402 : : case REG_VALUE_NOT_EXISTS:
403 [ # # ]: 0 : return css::uno::Sequence< sal_Int32 >();
404 : : case REG_INVALID_VALUE:
405 : : throw css::registry::InvalidValueException(
406 : : rtl::OUString(
407 : : RTL_CONSTASCII_USTRINGPARAM(
408 : : "com.sun.star.registry.SimpleRegistry key getLongListValue:"
409 : : " underlying RegistryKey::getLongListValue() ="
410 : : " REG_INVALID_VALUE")),
411 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
412 : : default:
413 : : throw css::registry::InvalidRegistryException(
414 : : (rtl::OUString(
415 : : RTL_CONSTASCII_USTRINGPARAM(
416 : : "com.sun.star.registry.SimpleRegistry key getLongListValue:"
417 : : " underlying RegistryKey::getLongListValue() = ")) +
418 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
419 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
420 : : }
421 : 0 : sal_uInt32 n = list.getLength();
422 [ # # ]: 0 : if (n > SAL_MAX_INT32) {
423 : : throw css::registry::InvalidValueException(
424 : : rtl::OUString(
425 : : RTL_CONSTASCII_USTRINGPARAM(
426 : : "com.sun.star.registry.SimpleRegistry key getLongListValue:"
427 : : " underlying RegistryKey::getLongListValue() too large")),
428 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
429 : : }
430 [ # # ]: 0 : css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n));
431 [ # # ]: 0 : for (sal_uInt32 i = 0; i < n; ++i) {
432 [ # # ]: 0 : value[static_cast< sal_Int32 >(i)] = list.getElement(i);
433 : : }
434 [ # # ][ # # ]: 0 : return value;
[ # # ][ # # ]
435 : : }
436 : :
437 : 0 : void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
438 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
439 : : {
440 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
441 [ # # ]: 0 : std::vector< sal_Int32 > list;
442 [ # # ]: 0 : for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
443 [ # # ]: 0 : list.push_back(seqValue[i]);
444 : : }
445 : : RegError err = key_.setLongListValue(
446 : 0 : rtl::OUString(), list.empty() ? 0 : &list[0],
447 [ # # ][ # # ]: 0 : static_cast< sal_uInt32 >(list.size()));
[ # # ]
448 [ # # ]: 0 : if (err != REG_NO_ERROR) {
449 : : throw css::registry::InvalidRegistryException(
450 : : (rtl::OUString(
451 : : RTL_CONSTASCII_USTRINGPARAM(
452 : : "com.sun.star.registry.SimpleRegistry key setLongListValue:"
453 : : " underlying RegistryKey::setLongListValue() = ")) +
454 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
455 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
456 [ # # ]: 0 : }
457 : 0 : }
458 : :
459 : 316 : rtl::OUString Key::getAsciiValue() throw (
460 : : css::registry::InvalidRegistryException,
461 : : css::registry::InvalidValueException, css::uno::RuntimeException)
462 : : {
463 [ + - ]: 316 : osl::MutexGuard guard(registry_->mutex_);
464 : : RegValueType type;
465 : : sal_uInt32 size;
466 [ + - ]: 316 : RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
467 [ - + ]: 316 : if (err != REG_NO_ERROR) {
468 : : throw css::registry::InvalidRegistryException(
469 : : (rtl::OUString(
470 : : RTL_CONSTASCII_USTRINGPARAM(
471 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
472 : : " underlying RegistryKey::getValueInfo() = ")) +
473 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
474 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
475 : : }
476 [ - + ]: 316 : if (type != RG_VALUETYPE_STRING) {
477 : : throw css::registry::InvalidValueException(
478 : : (rtl::OUString(
479 : : RTL_CONSTASCII_USTRINGPARAM(
480 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
481 : : " underlying RegistryKey type = ")) +
482 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
483 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
484 : : }
485 : : // size contains terminating null (error in underlying registry.cxx):
486 [ - + ]: 316 : if (size == 0) {
487 : : throw css::registry::InvalidValueException(
488 : : rtl::OUString(
489 : : RTL_CONSTASCII_USTRINGPARAM(
490 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
491 : : " underlying RegistryKey size 0 cannot happen due to"
492 : : " design error")),
493 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
494 : : }
495 [ - + ]: 316 : if (size > SAL_MAX_INT32) {
496 : : throw css::registry::InvalidValueException(
497 : : rtl::OUString(
498 : : RTL_CONSTASCII_USTRINGPARAM(
499 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
500 : : " underlying RegistryKey size too large")),
501 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
502 : : }
503 [ + - ]: 316 : std::vector< char > list(size);
504 [ + - ][ + - ]: 316 : err = key_.getValue(rtl::OUString(), &list[0]);
505 [ - + ]: 316 : if (err != REG_NO_ERROR) {
506 : : throw css::registry::InvalidRegistryException(
507 : : (rtl::OUString(
508 : : RTL_CONSTASCII_USTRINGPARAM(
509 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
510 : : " underlying RegistryKey::getValue() = ")) +
511 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
512 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
513 : : }
514 [ + - ][ - + ]: 316 : if (list[size - 1] != '\0') {
515 : : throw css::registry::InvalidValueException(
516 : : rtl::OUString(
517 : : RTL_CONSTASCII_USTRINGPARAM(
518 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
519 : : " underlying RegistryKey value must be null-terminated due"
520 : : " to design error")),
521 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
522 : : }
523 : 316 : rtl::OUString value;
524 [ - + ]: 316 : if (!rtl_convertStringToUString(
525 [ + - ]: 316 : &value.pData, &list[0],
526 : : static_cast< sal_Int32 >(size - 1), RTL_TEXTENCODING_UTF8,
527 : : (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
528 : : RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
529 : 316 : RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
530 : : {
531 : : throw css::registry::InvalidValueException(
532 : : rtl::OUString(
533 : : RTL_CONSTASCII_USTRINGPARAM(
534 : : "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
535 : : " underlying RegistryKey not UTF-8")),
536 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
537 : : }
538 [ + - ]: 316 : return value;
539 : : }
540 : :
541 : 504 : void Key::setAsciiValue(rtl::OUString const & value)
542 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
543 : : {
544 [ + - ]: 504 : osl::MutexGuard guard(registry_->mutex_);
545 : 504 : rtl::OString utf8;
546 [ - + ]: 504 : if (!value.convertToString(
547 : : &utf8, RTL_TEXTENCODING_UTF8,
548 : : (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
549 : 504 : RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
550 : : {
551 : : throw css::uno::RuntimeException(
552 : : rtl::OUString(
553 : : RTL_CONSTASCII_USTRINGPARAM(
554 : : "com.sun.star.registry.SimpleRegistry key setAsciiValue:"
555 : : " value not UTF-16")),
556 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
557 : : }
558 : : RegError err = key_.setValue(
559 : : rtl::OUString(), RG_VALUETYPE_STRING,
560 [ + - ]: 504 : const_cast< char * >(utf8.getStr()), utf8.getLength() + 1);
561 : : // +1 for terminating null (error in underlying registry.cxx)
562 [ - + ]: 504 : if (err != REG_NO_ERROR) {
563 : : throw css::registry::InvalidRegistryException(
564 : : (rtl::OUString(
565 : : RTL_CONSTASCII_USTRINGPARAM(
566 : : "com.sun.star.registry.SimpleRegistry key setAsciiValue:"
567 : : " underlying RegistryKey::setValue() = ")) +
568 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
569 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
570 [ + - ]: 504 : }
571 : 504 : }
572 : :
573 : 0 : css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw (
574 : : css::registry::InvalidRegistryException,
575 : : css::registry::InvalidValueException, css::uno::RuntimeException)
576 : : {
577 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
578 [ # # ]: 0 : RegistryValueList< char * > list;
579 [ # # ]: 0 : RegError err = key_.getStringListValue(rtl::OUString(), list);
580 [ # # # # ]: 0 : switch (err) {
581 : : case REG_NO_ERROR:
582 : 0 : break;
583 : : case REG_VALUE_NOT_EXISTS:
584 [ # # ]: 0 : return css::uno::Sequence< rtl::OUString >();
585 : : case REG_INVALID_VALUE:
586 : : throw css::registry::InvalidValueException(
587 : : rtl::OUString(
588 : : RTL_CONSTASCII_USTRINGPARAM(
589 : : "com.sun.star.registry.SimpleRegistry key"
590 : : " getAsciiListValue: underlying"
591 : : " RegistryKey::getStringListValue() = REG_INVALID_VALUE")),
592 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
593 : : default:
594 : : throw css::registry::InvalidRegistryException(
595 : : (rtl::OUString(
596 : : RTL_CONSTASCII_USTRINGPARAM(
597 : : "com.sun.star.registry.SimpleRegistry key"
598 : : " getAsciiListValue: underlying"
599 : : " RegistryKey::getStringListValue() = ")) +
600 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
601 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
602 : : }
603 : 0 : sal_uInt32 n = list.getLength();
604 [ # # ]: 0 : if (n > SAL_MAX_INT32) {
605 : : throw css::registry::InvalidValueException(
606 : : rtl::OUString(
607 : : RTL_CONSTASCII_USTRINGPARAM(
608 : : "com.sun.star.registry.SimpleRegistry key"
609 : : " getAsciiListValue: underlying"
610 : : " RegistryKey::getStringListValue() too large")),
611 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
612 : : }
613 [ # # ]: 0 : css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n));
614 [ # # ]: 0 : for (sal_uInt32 i = 0; i < n; ++i) {
615 : 0 : char * el = list.getElement(i);
616 : 0 : sal_Int32 size = rtl_str_getLength(el);
617 [ # # ]: 0 : if (!rtl_convertStringToUString(
618 [ # # ]: 0 : &value[static_cast< sal_Int32 >(i)].pData, el, size,
619 : : RTL_TEXTENCODING_UTF8,
620 : : (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
621 : : RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
622 : 0 : RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
623 : : {
624 : : throw css::registry::InvalidValueException(
625 : : rtl::OUString(
626 : : RTL_CONSTASCII_USTRINGPARAM(
627 : : "com.sun.star.registry.SimpleRegistry key"
628 : : " getAsciiListValue: underlying RegistryKey not"
629 : : " UTF-8")),
630 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
631 : : }
632 : : }
633 [ # # ][ # # ]: 0 : return value;
[ # # ][ # # ]
634 : : }
635 : :
636 : 126 : void Key::setAsciiListValue(
637 : : css::uno::Sequence< rtl::OUString > const & seqValue)
638 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
639 : : {
640 [ + - ]: 126 : osl::MutexGuard guard(registry_->mutex_);
641 [ + - ]: 126 : std::vector< rtl::OString > list;
642 [ + + ]: 252 : for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
643 : 126 : rtl::OString utf8;
644 [ - + ]: 252 : if (!seqValue[i].convertToString(
645 : : &utf8, RTL_TEXTENCODING_UTF8,
646 : : (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
647 : 126 : RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
648 : : {
649 : : throw css::uno::RuntimeException(
650 : : rtl::OUString(
651 : : RTL_CONSTASCII_USTRINGPARAM(
652 : : "com.sun.star.registry.SimpleRegistry key"
653 : : " setAsciiListValue: value not UTF-16")),
654 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
655 : : }
656 [ + - ]: 126 : list.push_back(utf8);
657 : 126 : }
658 [ + - ]: 126 : std::vector< char * > list2;
659 [ + - ][ + + ]: 252 : for (std::vector< rtl::OString >::iterator i(list.begin()); i != list.end();
660 : : ++i)
661 : : {
662 [ + - ]: 126 : list2.push_back(const_cast< char * >(i->getStr()));
663 : : }
664 : : RegError err = key_.setStringListValue(
665 : 126 : rtl::OUString(), list2.empty() ? 0 : &list2[0],
666 [ - + ][ + - ]: 252 : static_cast< sal_uInt32 >(list2.size()));
[ + - ]
667 [ - + ]: 126 : if (err != REG_NO_ERROR) {
668 : : throw css::registry::InvalidRegistryException(
669 : : (rtl::OUString(
670 : : RTL_CONSTASCII_USTRINGPARAM(
671 : : "com.sun.star.registry.SimpleRegistry key"
672 : : " setAsciiListValue: underlying"
673 : : " RegistryKey::setStringListValue() = ")) +
674 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
675 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
676 [ + - ]: 126 : }
677 : 126 : }
678 : :
679 : 0 : rtl::OUString Key::getStringValue() throw (
680 : : css::registry::InvalidRegistryException,
681 : : css::registry::InvalidValueException, css::uno::RuntimeException)
682 : : {
683 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
684 : : RegValueType type;
685 : : sal_uInt32 size;
686 [ # # ]: 0 : RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
687 [ # # ]: 0 : if (err != REG_NO_ERROR) {
688 : : throw css::registry::InvalidRegistryException(
689 : : (rtl::OUString(
690 : : RTL_CONSTASCII_USTRINGPARAM(
691 : : "com.sun.star.registry.SimpleRegistry key getStringValue:"
692 : : " underlying RegistryKey::getValueInfo() = ")) +
693 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
694 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
695 : : }
696 [ # # ]: 0 : if (type != RG_VALUETYPE_UNICODE) {
697 : : throw css::registry::InvalidValueException(
698 : : (rtl::OUString(
699 : : RTL_CONSTASCII_USTRINGPARAM(
700 : : "com.sun.star.registry.SimpleRegistry key getStringValue:"
701 : : " underlying RegistryKey type = ")) +
702 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
703 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
704 : : }
705 : : // size contains terminating null and is *2 (error in underlying
706 : : // registry.cxx):
707 [ # # ][ # # ]: 0 : if (size == 0 || (size & 1) == 1) {
708 : : throw css::registry::InvalidValueException(
709 : : rtl::OUString(
710 : : RTL_CONSTASCII_USTRINGPARAM(
711 : : "com.sun.star.registry.SimpleRegistry key getStringValue:"
712 : : " underlying RegistryKey size 0 or odd cannot happen due to"
713 : : " design error")),
714 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
715 : : }
716 [ # # ]: 0 : if (size > SAL_MAX_INT32) {
717 : : throw css::registry::InvalidValueException(
718 : : rtl::OUString(
719 : : RTL_CONSTASCII_USTRINGPARAM(
720 : : "com.sun.star.registry.SimpleRegistry key getStringValue:"
721 : : " underlying RegistryKey size too large")),
722 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
723 : : }
724 [ # # ]: 0 : std::vector< sal_Unicode > list(size);
725 [ # # ][ # # ]: 0 : err = key_.getValue(rtl::OUString(), &list[0]);
726 [ # # ]: 0 : if (err != REG_NO_ERROR) {
727 : : throw css::registry::InvalidRegistryException(
728 : : (rtl::OUString(
729 : : RTL_CONSTASCII_USTRINGPARAM(
730 : : "com.sun.star.registry.SimpleRegistry key getStringValue:"
731 : : " underlying RegistryKey::getValue() = ")) +
732 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
733 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
734 : : }
735 [ # # ][ # # ]: 0 : if (list[size/2 - 1] != 0) {
736 : : throw css::registry::InvalidValueException(
737 : : rtl::OUString(
738 : : RTL_CONSTASCII_USTRINGPARAM(
739 : : "com.sun.star.registry.SimpleRegistry key getStringValue:"
740 : : " underlying RegistryKey value must be null-terminated due"
741 : : " to design error")),
742 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
743 : : }
744 [ # # ][ # # ]: 0 : return rtl::OUString(&list[0], static_cast< sal_Int32 >(size/2 - 1));
745 : : }
746 : :
747 : 0 : void Key::setStringValue(rtl::OUString const & value)
748 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
749 : : {
750 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
751 : : RegError err = key_.setValue(
752 : : rtl::OUString(), RG_VALUETYPE_UNICODE,
753 : 0 : const_cast< sal_Unicode * >(value.getStr()),
754 [ # # ]: 0 : (value.getLength() + 1) * sizeof (sal_Unicode));
755 : : // +1 for terminating null (error in underlying registry.cxx)
756 [ # # ]: 0 : if (err != REG_NO_ERROR) {
757 : : throw css::registry::InvalidRegistryException(
758 : : (rtl::OUString(
759 : : RTL_CONSTASCII_USTRINGPARAM(
760 : : "com.sun.star.registry.SimpleRegistry key setStringValue:"
761 : : " underlying RegistryKey::setValue() = ")) +
762 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
763 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
764 [ # # ]: 0 : }
765 : 0 : }
766 : :
767 : 0 : css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw (
768 : : css::registry::InvalidRegistryException,
769 : : css::registry::InvalidValueException, css::uno::RuntimeException)
770 : : {
771 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
772 [ # # ]: 0 : RegistryValueList< sal_Unicode * > list;
773 [ # # ]: 0 : RegError err = key_.getUnicodeListValue(rtl::OUString(), list);
774 [ # # # # ]: 0 : switch (err) {
775 : : case REG_NO_ERROR:
776 : 0 : break;
777 : : case REG_VALUE_NOT_EXISTS:
778 [ # # ]: 0 : return css::uno::Sequence< rtl::OUString >();
779 : : case REG_INVALID_VALUE:
780 : : throw css::registry::InvalidValueException(
781 : : rtl::OUString(
782 : : RTL_CONSTASCII_USTRINGPARAM(
783 : : "com.sun.star.registry.SimpleRegistry key"
784 : : " getStringListValue: underlying"
785 : : " RegistryKey::getUnicodeListValue() = REG_INVALID_VALUE")),
786 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
787 : : default:
788 : : throw css::registry::InvalidRegistryException(
789 : : (rtl::OUString(
790 : : RTL_CONSTASCII_USTRINGPARAM(
791 : : "com.sun.star.registry.SimpleRegistry key"
792 : : " getStringListValue: underlying"
793 : : " RegistryKey::getUnicodeListValue() = ")) +
794 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
795 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
796 : : }
797 : 0 : sal_uInt32 n = list.getLength();
798 [ # # ]: 0 : if (n > SAL_MAX_INT32) {
799 : : throw css::registry::InvalidValueException(
800 : : rtl::OUString(
801 : : RTL_CONSTASCII_USTRINGPARAM(
802 : : "com.sun.star.registry.SimpleRegistry key"
803 : : " getStringListValue: underlying"
804 : : " RegistryKey::getUnicodeListValue() too large")),
805 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
806 : : }
807 [ # # ]: 0 : css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n));
808 [ # # ]: 0 : for (sal_uInt32 i = 0; i < n; ++i) {
809 [ # # ]: 0 : value[static_cast< sal_Int32 >(i)] = list.getElement(i);
810 : : }
811 [ # # ][ # # ]: 0 : return value;
[ # # ][ # # ]
812 : : }
813 : :
814 : 0 : void Key::setStringListValue(
815 : : css::uno::Sequence< rtl::OUString > const & seqValue)
816 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
817 : : {
818 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
819 [ # # ]: 0 : std::vector< sal_Unicode * > list;
820 [ # # ]: 0 : for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
821 [ # # ]: 0 : list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr()));
822 : : }
823 : : RegError err = key_.setUnicodeListValue(
824 : 0 : rtl::OUString(), list.empty() ? 0 : &list[0],
825 [ # # ][ # # ]: 0 : static_cast< sal_uInt32 >(list.size()));
[ # # ]
826 [ # # ]: 0 : if (err != REG_NO_ERROR) {
827 : : throw css::registry::InvalidRegistryException(
828 : : (rtl::OUString(
829 : : RTL_CONSTASCII_USTRINGPARAM(
830 : : "com.sun.star.registry.SimpleRegistry key"
831 : : " setStringListValue: underlying"
832 : : " RegistryKey::setUnicodeListValue() = ")) +
833 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
834 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
835 [ # # ]: 0 : }
836 : 0 : }
837 : :
838 : 69441 : css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
839 : : throw (
840 : : css::registry::InvalidRegistryException,
841 : : css::registry::InvalidValueException, css::uno::RuntimeException)
842 : : {
843 [ + - ]: 69441 : osl::MutexGuard guard(registry_->mutex_);
844 : : RegValueType type;
845 : : sal_uInt32 size;
846 [ + - ]: 69441 : RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
847 [ - + ]: 69441 : if (err != REG_NO_ERROR) {
848 : : throw css::registry::InvalidRegistryException(
849 : : (rtl::OUString(
850 : : RTL_CONSTASCII_USTRINGPARAM(
851 : : "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
852 : : " underlying RegistryKey::getValueInfo() = ")) +
853 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
854 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
855 : : }
856 [ - + ]: 69441 : if (type != RG_VALUETYPE_BINARY) {
857 : : throw css::registry::InvalidValueException(
858 : : (rtl::OUString(
859 : : RTL_CONSTASCII_USTRINGPARAM(
860 : : "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
861 : : " underlying RegistryKey type = ")) +
862 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
863 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
864 : : }
865 [ - + ]: 69441 : if (size > SAL_MAX_INT32) {
866 : : throw css::registry::InvalidValueException(
867 : : rtl::OUString(
868 : : RTL_CONSTASCII_USTRINGPARAM(
869 : : "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
870 : : " underlying RegistryKey size too large")),
871 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
872 : : }
873 [ + - ]: 69441 : css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size));
874 [ + - ][ + - ]: 69441 : err = key_.getValue(rtl::OUString(), value.getArray());
875 [ - + ]: 69441 : if (err != REG_NO_ERROR) {
876 : : throw css::registry::InvalidRegistryException(
877 : : (rtl::OUString(
878 : : RTL_CONSTASCII_USTRINGPARAM(
879 : : "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
880 : : " underlying RegistryKey::getValue() = ")) +
881 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
882 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
883 : : }
884 [ + - ]: 69441 : return value;
885 : : }
886 : :
887 : 0 : void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
888 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
889 : : {
890 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
891 : : RegError err = key_.setValue(
892 : : rtl::OUString(), RG_VALUETYPE_BINARY,
893 : 0 : const_cast< sal_Int8 * >(value.getConstArray()),
894 [ # # ]: 0 : static_cast< sal_uInt32 >(value.getLength()));
895 [ # # ]: 0 : if (err != REG_NO_ERROR) {
896 : : throw css::registry::InvalidRegistryException(
897 : : (rtl::OUString(
898 : : RTL_CONSTASCII_USTRINGPARAM(
899 : : "com.sun.star.registry.SimpleRegistry key setBinaryValue:"
900 : : " underlying RegistryKey::setValue() = ")) +
901 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
902 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
903 [ # # ]: 0 : }
904 : 0 : }
905 : :
906 : 183134 : css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
907 : : rtl::OUString const & aKeyName)
908 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
909 : : {
910 [ + - ]: 183134 : osl::MutexGuard guard(registry_->mutex_);
911 [ + - ]: 183134 : RegistryKey key;
912 [ + - ]: 183134 : RegError err = key_.openKey(aKeyName, key);
913 [ + + - ]: 183134 : switch (err) {
914 : : case REG_NO_ERROR:
915 [ + - ][ + - ]: 70408 : return new Key(registry_, key);
[ + - ]
916 : : case REG_KEY_NOT_EXISTS:
917 : 112726 : return css::uno::Reference< css::registry::XRegistryKey >();
918 : : default:
919 : : throw css::registry::InvalidRegistryException(
920 : : (rtl::OUString(
921 : : RTL_CONSTASCII_USTRINGPARAM(
922 : : "com.sun.star.registry.SimpleRegistry key openKey:"
923 : : " underlying RegistryKey::openKey() = ")) +
924 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
925 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
926 [ + - ][ + - ]: 183134 : }
927 : : }
928 : :
929 : 1766 : css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
930 : : rtl::OUString const & aKeyName)
931 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
932 : : {
933 [ + - ]: 1766 : osl::MutexGuard guard(registry_->mutex_);
934 [ + - ]: 1766 : RegistryKey key;
935 [ + - ]: 1766 : RegError err = key_.createKey(aKeyName, key);
936 [ + - - ]: 1766 : switch (err) {
937 : : case REG_NO_ERROR:
938 [ + - ][ + - ]: 1766 : return new Key(registry_, key);
[ + - ]
939 : : case REG_INVALID_KEYNAME:
940 : 0 : return css::uno::Reference< css::registry::XRegistryKey >();
941 : : default:
942 : : throw css::registry::InvalidRegistryException(
943 : : (rtl::OUString(
944 : : RTL_CONSTASCII_USTRINGPARAM(
945 : : "com.sun.star.registry.SimpleRegistry key createKey:"
946 : : " underlying RegistryKey::createKey() = ")) +
947 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
948 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
949 [ + - ][ + - ]: 1766 : }
950 : : }
951 : :
952 : 68547 : void Key::closeKey()
953 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
954 : : {
955 [ + - ]: 68547 : osl::MutexGuard guard(registry_->mutex_);
956 [ + - ]: 68547 : RegError err = key_.closeKey();
957 [ - + ]: 68547 : if (err != REG_NO_ERROR) {
958 : : throw css::registry::InvalidRegistryException(
959 : : (rtl::OUString(
960 : : RTL_CONSTASCII_USTRINGPARAM(
961 : : "com.sun.star.registry.SimpleRegistry key closeKey:"
962 : : " underlying RegistryKey::closeKey() = ")) +
963 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
964 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
965 [ + - ]: 68547 : }
966 : 68547 : }
967 : :
968 : 4 : void Key::deleteKey(rtl::OUString const & rKeyName)
969 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
970 : : {
971 [ + - ]: 4 : osl::MutexGuard guard(registry_->mutex_);
972 [ + - ]: 4 : RegError err = key_.deleteKey(rKeyName);
973 [ - + ]: 4 : if (err != REG_NO_ERROR) {
974 : : throw css::registry::InvalidRegistryException(
975 : : (rtl::OUString(
976 : : RTL_CONSTASCII_USTRINGPARAM(
977 : : "com.sun.star.registry.SimpleRegistry key deleteKey:"
978 : : " underlying RegistryKey::deleteKey() = ")) +
979 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
980 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
981 [ + - ]: 4 : }
982 : 4 : }
983 : :
984 : : css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
985 : 386 : Key::openKeys()
986 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
987 : : {
988 [ + - ]: 386 : osl::MutexGuard guard(registry_->mutex_);
989 [ + - ]: 386 : RegistryKeyArray list;
990 [ + - ]: 386 : RegError err = key_.openSubKeys(rtl::OUString(), list);
991 [ - + ]: 386 : if (err != REG_NO_ERROR) {
992 : : throw css::registry::InvalidRegistryException(
993 : : (rtl::OUString(
994 : : RTL_CONSTASCII_USTRINGPARAM(
995 : : "com.sun.star.registry.SimpleRegistry key openKeys:"
996 : : " underlying RegistryKey::openSubKeys() = ")) +
997 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
998 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
999 : : }
1000 : 386 : sal_uInt32 n = list.getLength();
1001 [ - + ]: 386 : if (n > SAL_MAX_INT32) {
1002 : : throw css::registry::InvalidRegistryException(
1003 : : rtl::OUString(
1004 : : RTL_CONSTASCII_USTRINGPARAM(
1005 : : "com.sun.star.registry.SimpleRegistry key getKeyNames:"
1006 : : " underlying RegistryKey::getKeyNames() too large")),
1007 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1008 : : }
1009 : : css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
1010 [ + - ]: 386 : keys(static_cast< sal_Int32 >(n));
1011 [ + + ]: 898 : for (sal_uInt32 i = 0; i < n; ++i) {
1012 [ + - ]: 512 : keys[static_cast< sal_Int32 >(i)] = new Key(
1013 [ + - ][ + - ]: 1024 : registry_, list.getElement(i));
[ + - ][ + - ]
[ + - ]
1014 : : }
1015 [ + - ][ + - ]: 386 : return keys;
1016 : : }
1017 : :
1018 : 966 : css::uno::Sequence< rtl::OUString > Key::getKeyNames()
1019 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1020 : : {
1021 [ + - ]: 966 : osl::MutexGuard guard(registry_->mutex_);
1022 [ + - ]: 966 : RegistryKeyNames list;
1023 [ + - ]: 966 : RegError err = key_.getKeyNames(rtl::OUString(), list);
1024 [ - + ]: 966 : if (err != REG_NO_ERROR) {
1025 : : throw css::registry::InvalidRegistryException(
1026 : : (rtl::OUString(
1027 : : RTL_CONSTASCII_USTRINGPARAM(
1028 : : "com.sun.star.registry.SimpleRegistry key getKeyNames:"
1029 : : " underlying RegistryKey::getKeyNames() = ")) +
1030 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1031 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1032 : : }
1033 : 966 : sal_uInt32 n = list.getLength();
1034 [ - + ]: 966 : if (n > SAL_MAX_INT32) {
1035 : : throw css::registry::InvalidRegistryException(
1036 : : rtl::OUString(
1037 : : RTL_CONSTASCII_USTRINGPARAM(
1038 : : "com.sun.star.registry.SimpleRegistry key getKeyNames:"
1039 : : " underlying RegistryKey::getKeyNames() too large")),
1040 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1041 : : }
1042 [ + - ]: 966 : css::uno::Sequence< rtl::OUString > names(static_cast< sal_Int32 >(n));
1043 [ + + ]: 4000 : for (sal_uInt32 i = 0; i < n; ++i) {
1044 [ + - ]: 3034 : names[static_cast< sal_Int32 >(i)] = list.getElement(i);
1045 : : }
1046 [ + - ][ + - ]: 966 : return names;
1047 : : }
1048 : :
1049 : 0 : sal_Bool Key::createLink(
1050 : : rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
1051 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1052 : : {
1053 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
1054 [ # # ]: 0 : RegError err = key_.createLink(aLinkName, aLinkTarget);
1055 [ # # # ]: 0 : switch (err) {
1056 : : case REG_NO_ERROR:
1057 : 0 : return true;
1058 : : case REG_INVALID_KEY:
1059 : : case REG_DETECT_RECURSION:
1060 : : throw css::registry::InvalidRegistryException(
1061 : : (rtl::OUString(
1062 : : RTL_CONSTASCII_USTRINGPARAM(
1063 : : "com.sun.star.registry.SimpleRegistry key createLink:"
1064 : : " underlying RegistryKey::createLink() = ")) +
1065 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1066 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1067 : : default:
1068 : 0 : return false;
1069 [ # # ]: 0 : }
1070 : : }
1071 : :
1072 : 0 : void Key::deleteLink(rtl::OUString const & rLinkName)
1073 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1074 : : {
1075 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
1076 [ # # ]: 0 : RegError err = key_.deleteLink(rLinkName);
1077 [ # # ]: 0 : if (err != REG_NO_ERROR) {
1078 : : throw css::registry::InvalidRegistryException(
1079 : : (rtl::OUString(
1080 : : RTL_CONSTASCII_USTRINGPARAM(
1081 : : "com.sun.star.registry.SimpleRegistry key deleteLink:"
1082 : : " underlying RegistryKey::deleteLink() = ")) +
1083 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1084 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1085 [ # # ]: 0 : }
1086 : 0 : }
1087 : :
1088 : 0 : rtl::OUString Key::getLinkTarget(rtl::OUString const & rLinkName)
1089 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1090 : : {
1091 [ # # ]: 0 : osl::MutexGuard guard(registry_->mutex_);
1092 : 0 : rtl::OUString target;
1093 [ # # ]: 0 : RegError err = key_.getLinkTarget(rLinkName, target);
1094 [ # # ]: 0 : if (err != REG_NO_ERROR) {
1095 : : throw css::registry::InvalidRegistryException(
1096 : : (rtl::OUString(
1097 : : RTL_CONSTASCII_USTRINGPARAM(
1098 : : "com.sun.star.registry.SimpleRegistry key getLinkTarget:"
1099 : : " underlying RegistryKey::getLinkTarget() = ")) +
1100 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1101 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1102 : : }
1103 [ # # ]: 0 : return target;
1104 : : }
1105 : :
1106 : 267565 : rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName)
1107 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1108 : : {
1109 [ + - ]: 267565 : osl::MutexGuard guard(registry_->mutex_);
1110 : 267565 : rtl::OUString resolved;
1111 [ + - ]: 267565 : RegError err = key_.getResolvedKeyName(aKeyName, true, resolved);
1112 [ - + ]: 267565 : if (err != REG_NO_ERROR) {
1113 : : throw css::registry::InvalidRegistryException(
1114 : : (rtl::OUString(
1115 : : RTL_CONSTASCII_USTRINGPARAM(
1116 : : "com.sun.star.registry.SimpleRegistry key getResolvedName:"
1117 : : " underlying RegistryKey::getResolvedName() = ")) +
1118 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1119 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1120 : : }
1121 [ + - ]: 267565 : return resolved;
1122 : : }
1123 : :
1124 : 0 : rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) {
1125 [ # # ]: 0 : osl::MutexGuard guard(mutex_);
1126 [ # # ][ # # ]: 0 : return textual_.get() == 0 ? registry_.getName() : textual_->getUri();
[ # # ]
1127 : : }
1128 : :
1129 : 2384 : void SimpleRegistry::open(
1130 : : rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
1131 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1132 : : {
1133 [ + - ]: 2384 : osl::MutexGuard guard(mutex_);
1134 [ - + ]: 2384 : if (textual_.get() != 0) {
1135 : : throw css::registry::InvalidRegistryException(
1136 : : (rtl::OUString(
1137 : : RTL_CONSTASCII_USTRINGPARAM(
1138 : : "com.sun.star.registry.SimpleRegistry.open(")) +
1139 : : rURL +
1140 : : rtl::OUString(
1141 : : RTL_CONSTASCII_USTRINGPARAM(
1142 : : "): instance already open"))),
1143 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ][ # # ]
1144 : : }
1145 : 2384 : RegError err = (rURL.isEmpty() && bCreate)
1146 : : ? REG_REGISTRY_NOT_EXISTS
1147 [ - + ][ + + ]: 2384 : : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE);
[ + - ][ + + ]
1148 [ + + ][ + + ]: 2384 : if (err == REG_REGISTRY_NOT_EXISTS && bCreate) {
1149 [ + - ]: 256 : err = registry_.create(rURL);
1150 : : }
1151 [ + + + ]: 2384 : switch (err) {
1152 : : case REG_NO_ERROR:
1153 : 1665 : break;
1154 : : case REG_INVALID_REGISTRY:
1155 [ + - ][ + - ]: 399 : if (bReadOnly && !bCreate) {
1156 [ + - ][ + - ]: 399 : textual_.reset(new stoc::simpleregistry::TextualServices(rURL));
1157 : 399 : break;
1158 : : }
1159 : : // fall through
1160 : : default:
1161 : : throw css::registry::InvalidRegistryException(
1162 : : (rtl::OUString(
1163 : : RTL_CONSTASCII_USTRINGPARAM(
1164 : : "com.sun.star.registry.SimpleRegistry.open(")) +
1165 : : rURL +
1166 : : rtl::OUString(
1167 : : RTL_CONSTASCII_USTRINGPARAM(
1168 : : "): underlying Registry::open/create() = ")) +
1169 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1170 [ + - ][ + - ]: 320 : static_cast< OWeakObject * >(this));
[ + - ][ + - ]
1171 [ + - ]: 2384 : }
1172 : 2064 : }
1173 : :
1174 : 330487 : sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) {
1175 [ + - ]: 330487 : osl::MutexGuard guard(mutex_);
1176 [ + + ][ + - ]: 330487 : return textual_.get() != 0 || registry_.isValid();
[ + - ]
1177 : : }
1178 : :
1179 : 252 : void SimpleRegistry::close()
1180 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1181 : : {
1182 [ + - ]: 252 : osl::MutexGuard guard(mutex_);
1183 [ - + ]: 252 : if (textual_.get() != 0) {
1184 : 0 : textual_.reset();
1185 : 252 : return;
1186 : : }
1187 [ + - ]: 252 : RegError err = registry_.close();
1188 [ - + ]: 252 : if (err != REG_NO_ERROR) {
1189 : : throw css::registry::InvalidRegistryException(
1190 : : (rtl::OUString(
1191 : : RTL_CONSTASCII_USTRINGPARAM(
1192 : : "com.sun.star.registry.SimpleRegistry.close:"
1193 : : " underlying Registry::close() = ")) +
1194 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1195 [ # # ][ # # ]: 252 : static_cast< OWeakObject * >(this));
[ # # ]
1196 [ + - ][ + - ]: 252 : }
1197 : : }
1198 : :
1199 : 0 : void SimpleRegistry::destroy()
1200 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1201 : : {
1202 [ # # ]: 0 : osl::MutexGuard guard(mutex_);
1203 [ # # ]: 0 : if (textual_.get() != 0) {
1204 : 0 : textual_.reset();
1205 : 0 : return;
1206 : : }
1207 [ # # ]: 0 : RegError err = registry_.destroy(rtl::OUString());
1208 [ # # ]: 0 : if (err != REG_NO_ERROR) {
1209 : : throw css::registry::InvalidRegistryException(
1210 : : (rtl::OUString(
1211 : : RTL_CONSTASCII_USTRINGPARAM(
1212 : : "com.sun.star.registry.SimpleRegistry.destroy:"
1213 : : " underlying Registry::destroy() = ")) +
1214 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1215 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1216 [ # # ][ # # ]: 0 : }
1217 : : }
1218 : :
1219 : 628060 : css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
1220 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1221 : : {
1222 [ + - ]: 628060 : osl::MutexGuard guard(mutex_);
1223 [ + + ]: 628060 : if (textual_.get() != 0) {
1224 [ + - ]: 9240 : return textual_->getRootKey();
1225 : : }
1226 [ + - ]: 618820 : RegistryKey root;
1227 [ + - ]: 618820 : RegError err = registry_.openRootKey(root);
1228 [ - + ]: 618820 : if (err != REG_NO_ERROR) {
1229 : : throw css::registry::InvalidRegistryException(
1230 : : (rtl::OUString(
1231 : : RTL_CONSTASCII_USTRINGPARAM(
1232 : : "com.sun.star.registry.SimpleRegistry.getRootKey:"
1233 : : " underlying Registry::getRootKey() = ")) +
1234 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1235 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1236 : : }
1237 [ + - ][ + - ]: 628060 : return new Key(this, root);
[ + - ][ + - ]
[ + - ]
1238 : : }
1239 : :
1240 : 0 : sal_Bool SimpleRegistry::isReadOnly()
1241 : : throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
1242 : : {
1243 [ # # ]: 0 : osl::MutexGuard guard(mutex_);
1244 [ # # ][ # # ]: 0 : return textual_.get() != 0 || registry_.isReadOnly();
[ # # ][ # # ]
1245 : : }
1246 : :
1247 : 0 : void SimpleRegistry::mergeKey(
1248 : : rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
1249 : : throw (
1250 : : css::registry::InvalidRegistryException,
1251 : : css::registry::MergeConflictException, css::uno::RuntimeException)
1252 : : {
1253 [ # # ]: 0 : osl::MutexGuard guard(mutex_);
1254 [ # # ]: 0 : if (textual_.get() != 0) {
1255 : : throw css::uno::RuntimeException(
1256 : : rtl::OUString(
1257 : : RTL_CONSTASCII_USTRINGPARAM(
1258 : : "com.sun.star.registry.SimpleRegistry.mergeKey: not"
1259 : : " supported for textual representation")),
1260 [ # # ][ # # ]: 0 : static_cast< cppu::OWeakObject * >(this));
[ # # ]
1261 : : }
1262 [ # # ]: 0 : RegistryKey root;
1263 [ # # ]: 0 : RegError err = registry_.openRootKey(root);
1264 [ # # ]: 0 : if (err == REG_NO_ERROR) {
1265 [ # # ]: 0 : err = registry_.mergeKey(root, aKeyName, aUrl, false, false);
1266 : : }
1267 [ # # # ]: 0 : switch (err) {
1268 : : case REG_NO_ERROR:
1269 : : case REG_MERGE_CONFLICT:
1270 : 0 : break;
1271 : : case REG_MERGE_ERROR:
1272 : : throw css::registry::MergeConflictException(
1273 : : rtl::OUString(
1274 : : RTL_CONSTASCII_USTRINGPARAM(
1275 : : "com.sun.star.registry.SimpleRegistry.mergeKey:"
1276 : : " underlying Registry::mergeKey() = REG_MERGE_ERROR")),
1277 [ # # ][ # # ]: 0 : static_cast< cppu::OWeakObject * >(this));
[ # # ]
1278 : : default:
1279 : : throw css::registry::InvalidRegistryException(
1280 : : (rtl::OUString(
1281 : : RTL_CONSTASCII_USTRINGPARAM(
1282 : : "com.sun.star.registry.SimpleRegistry.mergeKey:"
1283 : : " underlying Registry::getRootKey/mergeKey() = ")) +
1284 : : rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
1285 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
1286 [ # # ][ # # ]: 0 : }
1287 : 0 : }
1288 : :
1289 : : }
1290 : :
1291 : : namespace stoc_bootstrap {
1292 : :
1293 : 2384 : css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
1294 : : SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext >
1295 : : const &)
1296 : : {
1297 [ + - ]: 2384 : return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
1298 : : }
1299 : :
1300 : 2042 : css::uno::Sequence< rtl::OUString > simreg_getSupportedServiceNames() {
1301 : 2042 : css::uno::Sequence< rtl::OUString > names(1);
1302 [ + - ]: 2042 : names[0] = rtl::OUString(
1303 [ + - ]: 4084 : RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry"));
1304 : 2042 : return names;
1305 : : }
1306 : :
1307 : 10036 : rtl::OUString simreg_getImplementationName() {
1308 : : return rtl::OUString(
1309 : 10036 : RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry"));
1310 : : }
1311 : :
1312 : : }
1313 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|