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