1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_stoc.hxx" 26 #include <osl/diagnose.h> 27 #include <rtl/ustrbuf.hxx> 28 #include "registry/reader.hxx" 29 #include "registry/version.h" 30 #include "base.hxx" 31 32 namespace stoc_rdbtdp 33 { 34 35 //__________________________________________________________________________________________________ 36 // virtual ~ConstantsTypeDescriptionImpl()37ConstantsTypeDescriptionImpl::~ConstantsTypeDescriptionImpl() 38 { 39 delete _pMembers; 40 41 g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); 42 } 43 44 // XTypeDescription 45 //__________________________________________________________________________________________________ 46 // virtual getTypeClass()47TypeClass ConstantsTypeDescriptionImpl::getTypeClass() 48 throw( RuntimeException ) 49 { 50 return TypeClass_CONSTANTS; 51 } 52 //__________________________________________________________________________________________________ 53 // virtual getName()54OUString ConstantsTypeDescriptionImpl::getName() 55 throw( RuntimeException ) 56 { 57 return _aName; 58 } 59 60 // XConstantsTypeDescription 61 //__________________________________________________________________________________________________ 62 // virtual 63 Sequence< Reference< XConstantTypeDescription > > SAL_CALL getConstants()64ConstantsTypeDescriptionImpl::getConstants() 65 throw ( RuntimeException ) 66 { 67 if ( !_pMembers ) 68 { 69 typereg::Reader aReader( 70 _aBytes.getConstArray(), _aBytes.getLength(), false, 71 TYPEREG_VERSION_1); 72 73 sal_uInt16 nFields = aReader.getFieldCount(); 74 Sequence< Reference< XConstantTypeDescription > > * pTempConsts 75 = new Sequence< Reference< XConstantTypeDescription > >( nFields ); 76 Reference< XConstantTypeDescription > * pConsts 77 = pTempConsts->getArray(); 78 79 while ( nFields-- ) 80 { 81 rtl::OUStringBuffer aName( _aName ); 82 aName.appendAscii( "." ); 83 aName.append( aReader.getFieldName( nFields ) ); 84 85 Any aValue( getRTValue( aReader.getFieldValue( nFields ) ) ); 86 87 pConsts[ nFields ] 88 = new ConstantTypeDescriptionImpl( aName.makeStringAndClear(), 89 aValue ); 90 } 91 92 ClearableMutexGuard aGuard( getMutex() ); 93 if ( _pMembers ) 94 { 95 aGuard.clear(); 96 delete pTempConsts; 97 } 98 else 99 { 100 _pMembers = pTempConsts; 101 } 102 } 103 return *_pMembers; 104 } 105 106 } 107