1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_stoc.hxx" 30 #include <osl/diagnose.h> 31 #include <rtl/ustrbuf.hxx> 32 #include "registry/reader.hxx" 33 #include "registry/version.h" 34 #include "base.hxx" 35 36 namespace stoc_rdbtdp 37 { 38 39 //__________________________________________________________________________________________________ 40 // virtual 41 ConstantsTypeDescriptionImpl::~ConstantsTypeDescriptionImpl() 42 { 43 delete _pMembers; 44 45 g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); 46 } 47 48 // XTypeDescription 49 //__________________________________________________________________________________________________ 50 // virtual 51 TypeClass ConstantsTypeDescriptionImpl::getTypeClass() 52 throw( RuntimeException ) 53 { 54 return TypeClass_CONSTANTS; 55 } 56 //__________________________________________________________________________________________________ 57 // virtual 58 OUString ConstantsTypeDescriptionImpl::getName() 59 throw( RuntimeException ) 60 { 61 return _aName; 62 } 63 64 // XConstantsTypeDescription 65 //__________________________________________________________________________________________________ 66 // virtual 67 Sequence< Reference< XConstantTypeDescription > > SAL_CALL 68 ConstantsTypeDescriptionImpl::getConstants() 69 throw ( RuntimeException ) 70 { 71 if ( !_pMembers ) 72 { 73 typereg::Reader aReader( 74 _aBytes.getConstArray(), _aBytes.getLength(), false, 75 TYPEREG_VERSION_1); 76 77 sal_uInt16 nFields = aReader.getFieldCount(); 78 Sequence< Reference< XConstantTypeDescription > > * pTempConsts 79 = new Sequence< Reference< XConstantTypeDescription > >( nFields ); 80 Reference< XConstantTypeDescription > * pConsts 81 = pTempConsts->getArray(); 82 83 while ( nFields-- ) 84 { 85 rtl::OUStringBuffer aName( _aName ); 86 aName.appendAscii( "." ); 87 aName.append( aReader.getFieldName( nFields ) ); 88 89 Any aValue( getRTValue( aReader.getFieldValue( nFields ) ) ); 90 91 pConsts[ nFields ] 92 = new ConstantTypeDescriptionImpl( aName.makeStringAndClear(), 93 aValue ); 94 } 95 96 ClearableMutexGuard aGuard( getMutex() ); 97 if ( _pMembers ) 98 { 99 aGuard.clear(); 100 delete pTempConsts; 101 } 102 else 103 { 104 _pMembers = pTempConsts; 105 } 106 } 107 return *_pMembers; 108 } 109 110 } 111