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 <osl/diagnose.h>
21 : : #include <rtl/ustrbuf.hxx>
22 : : #include "registry/reader.hxx"
23 : : #include "registry/version.h"
24 : : #include "base.hxx"
25 : :
26 : : namespace stoc_rdbtdp
27 : : {
28 : :
29 : : //__________________________________________________________________________________________________
30 : : // virtual
31 [ + - ]: 2102 : ConstantsTypeDescriptionImpl::~ConstantsTypeDescriptionImpl()
32 : : {
33 [ + + ][ + - ]: 2102 : delete _pMembers;
34 : :
35 [ + - ]: 2102 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
36 [ - + ]: 4204 : }
37 : :
38 : : // XTypeDescription
39 : : //__________________________________________________________________________________________________
40 : : // virtual
41 : 1237 : TypeClass ConstantsTypeDescriptionImpl::getTypeClass()
42 : : throw( RuntimeException )
43 : : {
44 : 1237 : return TypeClass_CONSTANTS;
45 : : }
46 : : //__________________________________________________________________________________________________
47 : : // virtual
48 : 1652 : OUString ConstantsTypeDescriptionImpl::getName()
49 : : throw( RuntimeException )
50 : : {
51 : 1652 : return _aName;
52 : : }
53 : :
54 : : // XConstantsTypeDescription
55 : : //__________________________________________________________________________________________________
56 : : // virtual
57 : : Sequence< Reference< XConstantTypeDescription > > SAL_CALL
58 : 1652 : ConstantsTypeDescriptionImpl::getConstants()
59 : : throw ( RuntimeException )
60 : : {
61 [ + - ]: 1652 : if ( !_pMembers )
62 : : {
63 : : typereg::Reader aReader(
64 : 1652 : _aBytes.getConstArray(), _aBytes.getLength(), false,
65 [ + - ]: 1652 : TYPEREG_VERSION_1);
66 : :
67 : 1652 : sal_uInt16 nFields = aReader.getFieldCount();
68 : : Sequence< Reference< XConstantTypeDescription > > * pTempConsts
69 [ + - ]: 1652 : = new Sequence< Reference< XConstantTypeDescription > >( nFields );
70 : : Reference< XConstantTypeDescription > * pConsts
71 [ + - ]: 1652 : = pTempConsts->getArray();
72 : :
73 [ + + ]: 18400 : while ( nFields-- )
74 : : {
75 [ + - ]: 16748 : rtl::OUStringBuffer aName( _aName );
76 [ + - ]: 16748 : aName.appendAscii( "." );
77 [ + - ][ + - ]: 16748 : aName.append( aReader.getFieldName( nFields ) );
78 : :
79 [ + - ][ + - ]: 16748 : Any aValue( getRTValue( aReader.getFieldValue( nFields ) ) );
80 : :
81 : : pConsts[ nFields ]
82 : : = new ConstantTypeDescriptionImpl( aName.makeStringAndClear(),
83 [ + - ][ + - ]: 16748 : aValue );
[ + - ][ + - ]
84 : 16748 : }
85 : :
86 [ + - ][ + - ]: 1652 : ClearableMutexGuard aGuard( getMutex() );
87 [ - + ]: 1652 : if ( _pMembers )
88 : : {
89 [ # # ]: 0 : aGuard.clear();
90 [ # # ][ # # ]: 0 : delete pTempConsts;
91 : : }
92 : : else
93 : : {
94 : 1652 : _pMembers = pTempConsts;
95 [ + - ]: 1652 : }
96 : : }
97 : 1652 : return *_pMembers;
98 : : }
99 : :
100 : : }
101 : :
102 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|