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 27 #include <vector> 28 #include <osl/diagnose.h> 29 #include "base.hxx" 30 31 namespace stoc_rdbtdp 32 { 33 34 //__________________________________________________________________________________________________ 35 // virtual 36 ModuleTypeDescriptionImpl::~ModuleTypeDescriptionImpl() 37 { 38 delete _pMembers; 39 40 g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); 41 } 42 43 // XTypeDescription 44 //__________________________________________________________________________________________________ 45 // virtual 46 TypeClass ModuleTypeDescriptionImpl::getTypeClass() 47 { 48 return TypeClass_MODULE; 49 } 50 //__________________________________________________________________________________________________ 51 // virtual 52 OUString ModuleTypeDescriptionImpl::getName() 53 { 54 return _aName; 55 } 56 57 // XModuleTypeDescription 58 //__________________________________________________________________________________________________ 59 // virtual 60 Sequence< Reference< XTypeDescription > > SAL_CALL 61 ModuleTypeDescriptionImpl::getMembers() 62 { 63 if ( !_pMembers ) 64 { 65 Reference< XTypeDescriptionEnumeration > xEnum; 66 try 67 { 68 xEnum = _xTDMgr->createTypeDescriptionEnumeration( 69 _aName, 70 Sequence< TypeClass >(), 71 TypeDescriptionSearchDepth_ONE ); 72 } 73 catch ( NoSuchTypeNameException const & ) 74 { 75 } 76 catch ( InvalidTypeNameException const & ) 77 { 78 } 79 80 OSL_ENSURE( xEnum.is(), 81 "ModuleTypeDescriptionImpl::getMembers - No enumeration!" ); 82 83 std::vector< Reference< XTypeDescription > > aTDs; 84 while ( xEnum->hasMoreElements() ) 85 { 86 try 87 { 88 Reference< XTypeDescription > xTD( 89 xEnum->nextTypeDescription() ); 90 aTDs.push_back( xTD ); 91 } 92 catch ( NoSuchElementException const & ) 93 { 94 OSL_ENSURE( sal_False, 95 "ModuleTypeDescriptionImpl::getMembers - " 96 " Caught NoSuchElementException!" ); 97 } 98 } 99 100 Sequence< Reference< XTypeDescription > > * pMembers 101 = new Sequence< Reference< XTypeDescription > >( aTDs.size() ); 102 for ( sal_Int32 n = 0; n < pMembers->getLength(); n++ ) 103 (*pMembers)[ n ] = aTDs[ n ]; 104 105 ClearableMutexGuard aGuard( getMutex() ); 106 if ( _pMembers ) 107 { 108 aGuard.clear(); 109 delete pMembers; 110 } 111 else 112 { 113 _pMembers = pMembers; 114 } 115 } 116 return *_pMembers; 117 } 118 119 } 120