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