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