Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #include <vector>
22 : : #include <osl/diagnose.h>
23 : : #include "base.hxx"
24 : :
25 : : namespace stoc_rdbtdp
26 : : {
27 : :
28 : : //__________________________________________________________________________________________________
29 : : // virtual
30 : 8 : ModuleTypeDescriptionImpl::~ModuleTypeDescriptionImpl()
31 : : {
32 [ - + ][ # # ]: 8 : delete _pMembers;
33 : :
34 [ + - ]: 8 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
35 [ - + ]: 16 : }
36 : :
37 : : // XTypeDescription
38 : : //__________________________________________________________________________________________________
39 : : // virtual
40 : 14 : TypeClass ModuleTypeDescriptionImpl::getTypeClass()
41 : : throw( RuntimeException )
42 : : {
43 : 14 : return TypeClass_MODULE;
44 : : }
45 : : //__________________________________________________________________________________________________
46 : : // virtual
47 : 0 : OUString ModuleTypeDescriptionImpl::getName()
48 : : throw( RuntimeException )
49 : : {
50 : 0 : return _aName;
51 : : }
52 : :
53 : : // XModuleTypeDescription
54 : : //__________________________________________________________________________________________________
55 : : // virtual
56 : : Sequence< Reference< XTypeDescription > > SAL_CALL
57 : 0 : ModuleTypeDescriptionImpl::getMembers()
58 : : throw ( RuntimeException )
59 : : {
60 [ # # ]: 0 : if ( !_pMembers )
61 : : {
62 : 0 : Reference< XTypeDescriptionEnumeration > xEnum;
63 : : try
64 : : {
65 [ # # ]: 0 : xEnum = _xTDMgr->createTypeDescriptionEnumeration(
66 : : _aName,
67 : : Sequence< TypeClass >(),
68 [ # # ][ # # ]: 0 : TypeDescriptionSearchDepth_ONE );
[ # # ][ # # ]
[ # # # ]
69 : : }
70 [ # # ]: 0 : catch ( NoSuchTypeNameException const & )
71 : : {
72 : : }
73 [ # # ]: 0 : catch ( InvalidTypeNameException const & )
74 : : {
75 : : }
76 : :
77 : : OSL_ENSURE( xEnum.is(),
78 : : "ModuleTypeDescriptionImpl::getMembers - No enumeration!" );
79 : :
80 [ # # ]: 0 : std::vector< Reference< XTypeDescription > > aTDs;
81 [ # # ][ # # ]: 0 : while ( xEnum->hasMoreElements() )
[ # # ]
82 : : {
83 : : try
84 : : {
85 : : Reference< XTypeDescription > xTD(
86 [ # # ][ # # ]: 0 : xEnum->nextTypeDescription() );
87 [ # # ][ # # ]: 0 : aTDs.push_back( xTD );
88 : : }
89 [ # # ]: 0 : catch ( NoSuchElementException const & )
90 : : {
91 : : OSL_FAIL( "ModuleTypeDescriptionImpl::getMembers - "
92 : : " Caught NoSuchElementException!" );
93 : : }
94 : : }
95 : :
96 : : Sequence< Reference< XTypeDescription > > * pMembers
97 [ # # ]: 0 : = new Sequence< Reference< XTypeDescription > >( aTDs.size() );
98 [ # # ]: 0 : for ( sal_Int32 n = 0; n < pMembers->getLength(); n++ )
99 [ # # ][ # # ]: 0 : (*pMembers)[ n ] = aTDs[ n ];
100 : :
101 [ # # ][ # # ]: 0 : ClearableMutexGuard aGuard( getMutex() );
102 [ # # ]: 0 : if ( _pMembers )
103 : : {
104 [ # # ]: 0 : aGuard.clear();
105 [ # # ][ # # ]: 0 : delete pMembers;
106 : : }
107 : : else
108 : : {
109 : 0 : _pMembers = pMembers;
110 [ # # ]: 0 : }
111 : : }
112 : 0 : return *_pMembers;
113 : : }
114 : :
115 : : }
116 : :
117 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|