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