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 : : #include <osl/diagnose.h>
21 : : #include <rtl/ustrbuf.hxx>
22 : : #include "registry/reader.hxx"
23 : : #include "registry/version.h"
24 : :
25 : : #include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
26 : : #include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
27 : : #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
28 : : #include <com/sun/star/reflection/XMethodParameter.hpp>
29 : : #include <com/sun/star/reflection/XParameter.hpp>
30 : : #include "com/sun/star/uno/RuntimeException.hpp"
31 : : #include "base.hxx"
32 : : #include "functiondescription.hxx"
33 : : #include "methoddescription.hxx"
34 : :
35 : : #include <memory>
36 : : #include <set>
37 : :
38 : : namespace stoc_rdbtdp
39 : : {
40 : :
41 : : //==================================================================================================
42 : : class InterfaceMethodImpl : public WeakImplHelper1< XInterfaceMethodTypeDescription >
43 : : {
44 : : stoc::registry_tdprovider::MethodDescription _desc;
45 : :
46 : : Reference< XHierarchicalNameAccess > _xTDMgr;
47 : :
48 : : OUString _aTypeName;
49 : :
50 : : OUString _aReturnType;
51 : : Reference< XTypeDescription > _xReturnTD;
52 : :
53 : : sal_Bool _bIsOneWay;
54 : : sal_Int32 _nPosition;
55 : :
56 : : public:
57 : 168353 : InterfaceMethodImpl( const Reference< XHierarchicalNameAccess > & xTDMgr,
58 : : const OUString & rTypeName,
59 : : const OUString & rMemberName,
60 : : const OUString & rReturnType,
61 : : const Sequence< sal_Int8 > & rBytes,
62 : : sal_uInt16 nMethodIndex,
63 : : sal_Bool bIsOneWay,
64 : : sal_Int32 nPosition )
65 : : : _desc(xTDMgr, rMemberName, rBytes, nMethodIndex)
66 : : , _xTDMgr( xTDMgr )
67 : : , _aTypeName( rTypeName )
68 : : , _aReturnType( rReturnType )
69 : : , _bIsOneWay( bIsOneWay )
70 [ + - ]: 168353 : , _nPosition( nPosition )
71 : : {
72 [ + - ]: 168353 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
73 : 168353 : }
74 : : virtual ~InterfaceMethodImpl();
75 : :
76 : : // XTypeDescription
77 : : virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
78 : : virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
79 : :
80 : : // XInterfaceMemberTypeDescription
81 : 0 : virtual OUString SAL_CALL getMemberName() throw(::com::sun::star::uno::RuntimeException)
82 : 0 : { return _desc.getName(); }
83 : : virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
84 : :
85 : : // XInterfaceMethodTypeDescription
86 : : virtual Reference< XTypeDescription > SAL_CALL getReturnType() throw(::com::sun::star::uno::RuntimeException);
87 : : virtual sal_Bool SAL_CALL isOneway() throw(::com::sun::star::uno::RuntimeException);
88 : : virtual Sequence< Reference< XMethodParameter > > SAL_CALL getParameters() throw(::com::sun::star::uno::RuntimeException);
89 : : virtual Sequence< Reference< XTypeDescription > > SAL_CALL getExceptions() throw(::com::sun::star::uno::RuntimeException);
90 : : };
91 : : //__________________________________________________________________________________________________
92 [ + - ]: 164908 : InterfaceMethodImpl::~InterfaceMethodImpl()
93 : : {
94 [ + - ]: 164908 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
95 [ - + ]: 329816 : }
96 : :
97 : : // XTypeDescription
98 : : //__________________________________________________________________________________________________
99 : 395513 : TypeClass InterfaceMethodImpl::getTypeClass()
100 : : throw(::com::sun::star::uno::RuntimeException)
101 : : {
102 : 395513 : return TypeClass_INTERFACE_METHOD;
103 : : }
104 : : //__________________________________________________________________________________________________
105 : 481049 : OUString InterfaceMethodImpl::getName()
106 : : throw(::com::sun::star::uno::RuntimeException)
107 : : {
108 : 481049 : return _aTypeName;
109 : : }
110 : :
111 : : // XInterfaceMemberTypeDescription
112 : : //__________________________________________________________________________________________________
113 : 30292 : sal_Int32 InterfaceMethodImpl::getPosition()
114 : : throw(::com::sun::star::uno::RuntimeException)
115 : : {
116 : 30292 : return _nPosition;
117 : : }
118 : :
119 : : // XInterfaceMethodTypeDescription
120 : : //__________________________________________________________________________________________________
121 : 30292 : Reference<XTypeDescription > InterfaceMethodImpl::getReturnType()
122 : : throw(::com::sun::star::uno::RuntimeException)
123 : : {
124 [ + + ][ + - ]: 30292 : if (!_xReturnTD.is() && !_aReturnType.isEmpty())
[ + + ]
125 : : {
126 : : try
127 : : {
128 : 28895 : Reference< XTypeDescription > xReturnTD;
129 [ + - ][ + - ]: 28895 : if (_xTDMgr->getByHierarchicalName( _aReturnType ) >>= xReturnTD)
[ + - ][ + - ]
130 : : {
131 [ + - ][ + - ]: 28895 : MutexGuard aGuard( getMutex() );
132 [ + - ]: 28895 : if (! _xReturnTD.is())
133 [ + - ]: 28895 : _xReturnTD = xReturnTD;
134 [ + - ]: 28895 : return _xReturnTD;
135 [ - + ][ # # ]: 28895 : }
136 : : }
137 : 0 : catch (NoSuchElementException &)
138 : : {
139 : : }
140 : : // never try again, if no td was found
141 : 0 : _aReturnType = OUString();
142 : : }
143 : 30292 : return _xReturnTD;
144 : : }
145 : : //__________________________________________________________________________________________________
146 : 30294 : sal_Bool InterfaceMethodImpl::isOneway()
147 : : throw(::com::sun::star::uno::RuntimeException)
148 : : {
149 : 30294 : return _bIsOneWay;
150 : : }
151 : : //__________________________________________________________________________________________________
152 : 30292 : Sequence<Reference<XMethodParameter > > InterfaceMethodImpl::getParameters()
153 : : throw(::com::sun::star::uno::RuntimeException)
154 : : {
155 [ + - ]: 30292 : Sequence< Reference< XParameter > > s1(_desc.getParameters());
156 [ + - ]: 30292 : Sequence< Reference< XMethodParameter > > s2(s1.getLength());
157 [ + + ]: 57273 : for (sal_Int32 i = 0; i < s1.getLength(); ++i) {
158 [ + - ][ + - ]: 26981 : s2[i] = s1[i].get();
[ + - ][ + - ]
159 : : }
160 [ + - ]: 30292 : return s2;
161 : : }
162 : : //__________________________________________________________________________________________________
163 : 30292 : Sequence<Reference<XTypeDescription > > InterfaceMethodImpl::getExceptions()
164 : : throw(::com::sun::star::uno::RuntimeException)
165 : : {
166 : : Sequence< Reference< XCompoundTypeDescription > > s1(
167 [ + - ]: 30292 : _desc.getExceptions());
168 [ + - ]: 30292 : Sequence< Reference< XTypeDescription > > s2(s1.getLength());
169 [ + + ]: 48394 : for (sal_Int32 i = 0; i < s1.getLength(); ++i) {
170 [ + - ][ + - ]: 18102 : s2[i] = s1[i].get();
[ + - ][ + - ]
171 : : }
172 [ + - ]: 30292 : return s2;
173 : : }
174 : :
175 : :
176 : : //##################################################################################################
177 : : //##################################################################################################
178 : : //##################################################################################################
179 : :
180 : :
181 : : //==================================================================================================
182 : : class InterfaceAttributeImpl : public WeakImplHelper1< XInterfaceAttributeTypeDescription2 >
183 : : {
184 : : Reference< XHierarchicalNameAccess > _xTDMgr;
185 : :
186 : : OUString _aTypeName;
187 : : OUString _aMemberName;
188 : :
189 : : OUString _aMemberTypeName;
190 : : Reference< XTypeDescription > _xMemberTD;
191 : :
192 : : sal_Bool _bReadOnly;
193 : : sal_Bool _bBound;
194 : : sal_Int32 _nPosition;
195 : :
196 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
197 : : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > _getter;
198 : : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > _setter;
199 : : SAL_WNODEPRECATED_DECLARATIONS_POP
200 : :
201 : : public:
202 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
203 : 8799 : InterfaceAttributeImpl(
204 : : const Reference< XHierarchicalNameAccess > & xTDMgr,
205 : : const OUString & rTypeName,
206 : : const OUString & rMemberName,
207 : : const OUString & rMemberTypeName,
208 : : sal_Bool bReadOnly,
209 : : sal_Bool bBound,
210 : : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > &
211 : : getter,
212 : : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > &
213 : : setter,
214 : : sal_Int32 nPosition )
215 : : : _xTDMgr( xTDMgr )
216 : : , _aTypeName( rTypeName )
217 : : , _aMemberName( rMemberName )
218 : : , _aMemberTypeName( rMemberTypeName )
219 : : , _bReadOnly( bReadOnly )
220 : : , _bBound( bBound )
221 : : , _nPosition( nPosition )
222 : : , _getter( getter )
223 : 8799 : , _setter( setter )
224 : : {
225 [ + - ]: 8799 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
226 : 8799 : }
227 : : SAL_WNODEPRECATED_DECLARATIONS_POP
228 : : virtual ~InterfaceAttributeImpl();
229 : :
230 : : // XTypeDescription
231 : : virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
232 : : virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
233 : :
234 : : // XInterfaceMemberTypeDescription
235 : : virtual OUString SAL_CALL getMemberName() throw(::com::sun::star::uno::RuntimeException);
236 : : virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
237 : :
238 : : // XInterfaceAttributeTypeDescription2
239 : : virtual sal_Bool SAL_CALL isReadOnly() throw(::com::sun::star::uno::RuntimeException);
240 : : virtual Reference< XTypeDescription > SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException);
241 : :
242 : 15873 : virtual sal_Bool SAL_CALL isBound() throw (RuntimeException)
243 : 15873 : { return _bBound; }
244 : :
245 : : virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL
246 : 21923 : getGetExceptions() throw (RuntimeException)
247 : : {
248 [ + + ]: 21923 : if (_getter.get() != 0) {
249 : 5 : return _getter->getExceptions();
250 : : } else {
251 : 21923 : return Sequence< Reference< XCompoundTypeDescription > >();
252 : : }
253 : : }
254 : :
255 : : virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL
256 : 21923 : getSetExceptions() throw (RuntimeException)
257 : : {
258 [ + + ]: 21923 : if (_setter.get() != 0) {
259 : 566 : return _setter->getExceptions();
260 : : } else {
261 : 21923 : return Sequence< Reference< XCompoundTypeDescription > >();
262 : : }
263 : : }
264 : : };
265 : :
266 [ + - ][ + - ]: 8545 : InterfaceAttributeImpl::~InterfaceAttributeImpl()
267 : : {
268 [ + - ]: 8545 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
269 [ - + ]: 17090 : }
270 : : // XTypeDescription
271 : : //__________________________________________________________________________________________________
272 : 30756 : TypeClass InterfaceAttributeImpl::getTypeClass()
273 : : throw(::com::sun::star::uno::RuntimeException)
274 : : {
275 : 30756 : return TypeClass_INTERFACE_ATTRIBUTE;
276 : : }
277 : : //__________________________________________________________________________________________________
278 : 63993 : OUString InterfaceAttributeImpl::getName()
279 : : throw(::com::sun::star::uno::RuntimeException)
280 : : {
281 : 63993 : return _aTypeName;
282 : : }
283 : :
284 : : // XInterfaceMemberTypeDescription
285 : : //__________________________________________________________________________________________________
286 : 15873 : OUString InterfaceAttributeImpl::getMemberName()
287 : : throw(::com::sun::star::uno::RuntimeException)
288 : : {
289 : 15873 : return _aMemberName;
290 : : }
291 : : //__________________________________________________________________________________________________
292 : 6050 : sal_Int32 InterfaceAttributeImpl::getPosition()
293 : : throw(::com::sun::star::uno::RuntimeException)
294 : : {
295 : 6050 : return _nPosition;
296 : : }
297 : :
298 : : // XInterfaceAttributeTypeDescription2
299 : : //__________________________________________________________________________________________________
300 : 21923 : sal_Bool InterfaceAttributeImpl::isReadOnly()
301 : : throw(::com::sun::star::uno::RuntimeException)
302 : : {
303 : 21923 : return _bReadOnly;
304 : : }
305 : : //__________________________________________________________________________________________________
306 : 21923 : Reference<XTypeDescription > InterfaceAttributeImpl::getType()
307 : : throw(::com::sun::star::uno::RuntimeException)
308 : : {
309 [ + + ][ + - ]: 21923 : if (!_xMemberTD.is() && !_aMemberTypeName.isEmpty())
[ + + ]
310 : : {
311 : : try
312 : : {
313 : 5958 : Reference< XTypeDescription > xMemberTD;
314 [ + - ][ + - ]: 5958 : if (_xTDMgr->getByHierarchicalName( _aMemberTypeName ) >>= xMemberTD)
[ + - ][ + - ]
315 : : {
316 [ + - ][ + - ]: 5958 : MutexGuard aGuard( getMutex() );
317 [ + - ]: 5958 : if (! _xMemberTD.is())
318 [ + - ]: 5958 : _xMemberTD = xMemberTD;
319 [ + - ]: 5958 : return _xMemberTD;
320 [ - + ][ # # ]: 5958 : }
321 : : }
322 : 0 : catch (NoSuchElementException &)
323 : : {
324 : : }
325 : : // never try again, if no td was found
326 : 0 : _aMemberTypeName = OUString();
327 : : }
328 : 21923 : return _xMemberTD;
329 : : }
330 : :
331 : :
332 : : //##################################################################################################
333 : : //##################################################################################################
334 : : //##################################################################################################
335 : :
336 : 50533 : void InterfaceTypeDescriptionImpl::checkInterfaceType(
337 : : Reference< XTypeDescription > const & type)
338 : : {
339 [ + - ][ + - ]: 50533 : if (resolveTypedefs(type)->getTypeClass() != TypeClass_INTERFACE) {
[ - + ]
340 : : throw RuntimeException(
341 : : OUString(
342 : : RTL_CONSTASCII_USTRINGPARAM(
343 : : "Interface base is not an interface type")),
344 [ # # ][ # # ]: 0 : static_cast< OWeakObject * >(this));
[ # # ]
345 : : }
346 : 50533 : }
347 : :
348 : : namespace {
349 : :
350 : 48531 : class BaseOffset {
351 : : public:
352 : : BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc);
353 : :
354 : 48531 : sal_Int32 get() const { return offset; }
355 : :
356 : : private:
357 : : void calculateBases(Reference< XInterfaceTypeDescription2 > const & desc);
358 : :
359 : : void calculate(Reference< XInterfaceTypeDescription2 > const & desc);
360 : :
361 : : std::set< rtl::OUString > set;
362 : : sal_Int32 offset;
363 : : };
364 : :
365 : 48531 : BaseOffset::BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc) {
366 : 48531 : offset = 0;
367 [ + - ]: 48531 : calculateBases(desc);
368 : 48531 : }
369 : :
370 : 122872 : void BaseOffset::calculateBases(
371 : : Reference< XInterfaceTypeDescription2 > const & desc)
372 : : {
373 [ + - ][ + - ]: 122872 : Sequence< Reference < XTypeDescription > > bases(desc->getBaseTypes());
374 [ + + ]: 199751 : for (sal_Int32 i = 0; i < bases.getLength(); ++i) {
375 : : calculate(
376 : : Reference< XInterfaceTypeDescription2 >(
377 [ + - ][ + - ]: 76879 : resolveTypedefs(bases[i]), UNO_QUERY_THROW));
[ + - ][ + - ]
378 [ + - ]: 122872 : }
379 : 122872 : }
380 : :
381 : 76879 : void BaseOffset::calculate(Reference< XInterfaceTypeDescription2 > const & desc)
382 : : {
383 [ + - ][ + + ]: 76879 : if (set.insert(desc->getName()).second) {
384 : 74341 : calculateBases(desc);
385 : 74341 : offset += desc->getMembers().getLength();
386 : : }
387 : 76879 : }
388 : :
389 : : }
390 : :
391 : : //__________________________________________________________________________________________________
392 : 49945 : InterfaceTypeDescriptionImpl::InterfaceTypeDescriptionImpl(
393 : : const Reference< XHierarchicalNameAccess > & xTDMgr,
394 : : const OUString & rName, const Sequence< OUString > & rBaseTypes,
395 : : const Sequence< OUString > & rOptionalBaseTypes,
396 : : const Sequence< sal_Int8 > & rBytes, bool published )
397 : : : _xTDMgr( xTDMgr )
398 : : , _aBytes( rBytes )
399 : : , _aName( rName )
400 : : , _aBaseTypes( rBaseTypes )
401 : : , _aOptionalBaseTypes( rOptionalBaseTypes )
402 : : , _membersInit( false )
403 [ + - ][ + - ]: 49945 : , _published( published )
[ + - ][ + - ]
[ + - ][ + - ]
404 : : {
405 [ + - ]: 49945 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
406 : 49945 : }
407 : : //__________________________________________________________________________________________________
408 [ + - ][ + - ]: 49153 : InterfaceTypeDescriptionImpl::~InterfaceTypeDescriptionImpl()
[ + - ][ + - ]
[ + - ][ + - ]
409 : : {
410 [ + - ]: 49153 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
411 [ - + ]: 98306 : }
412 : :
413 : : // XTypeDescription
414 : : //__________________________________________________________________________________________________
415 : 320062 : TypeClass InterfaceTypeDescriptionImpl::getTypeClass()
416 : : throw(::com::sun::star::uno::RuntimeException)
417 : : {
418 : 320062 : return TypeClass_INTERFACE;
419 : : }
420 : : //__________________________________________________________________________________________________
421 : 396644 : OUString InterfaceTypeDescriptionImpl::getName()
422 : : throw(::com::sun::star::uno::RuntimeException)
423 : : {
424 : 396644 : return _aName;
425 : : }
426 : :
427 : : // XInterfaceTypeDescription2
428 : : //__________________________________________________________________________________________________
429 : 0 : Reference< XTypeDescription > InterfaceTypeDescriptionImpl::getBaseType()
430 : : throw(::com::sun::star::uno::RuntimeException)
431 : : {
432 [ # # ]: 0 : Sequence< Reference< XTypeDescription > > aBaseTypes(getBaseTypes());
433 [ # # ][ # # ]: 0 : return aBaseTypes.getLength() >= 1 ? aBaseTypes[0] : 0;
[ # # ][ # # ]
434 : : }
435 : : //__________________________________________________________________________________________________
436 : 97245 : Uik SAL_CALL InterfaceTypeDescriptionImpl::getUik()
437 : : throw(::com::sun::star::uno::RuntimeException)
438 : : {
439 : 97245 : return Uik();
440 : : }
441 : : //__________________________________________________________________________________________________
442 : 227572 : Sequence< Reference< XInterfaceMemberTypeDescription > > InterfaceTypeDescriptionImpl::getMembers()
443 : : throw(::com::sun::star::uno::RuntimeException)
444 : : {
445 [ + - ][ + - ]: 227572 : osl::MutexGuard guard(getMutex());
446 [ + + ]: 227572 : if (!_membersInit) {
447 [ + - ][ + - ]: 48531 : _nBaseOffset = BaseOffset(this).get();
448 : : typereg::Reader reader(
449 : 48531 : _aBytes.getConstArray(), _aBytes.getLength(), false,
450 [ + - ]: 48531 : TYPEREG_VERSION_1);
451 : 48531 : sal_Int32 count = 0;
452 : 48531 : sal_uInt16 methodCount = reader.getMethodCount();
453 [ + + ]: 217777 : {for (sal_uInt16 i = 0; i < methodCount; ++i) {
454 : 169246 : RTMethodMode flags = reader.getMethodFlags(i);
455 [ + + ][ + + ]: 169246 : if (flags != RT_MODE_ATTRIBUTE_GET
456 : : && flags != RT_MODE_ATTRIBUTE_SET)
457 : : {
458 : 168353 : ++count;
459 : : }
460 : : }}
461 : 48531 : sal_uInt16 fieldCount = reader.getFieldCount();
462 : 48531 : count += fieldCount;
463 [ + - ]: 48531 : _members.realloc(count);
464 : 48531 : sal_Int32 index = 0;
465 [ + + ]: 57330 : {for (sal_uInt16 i = 0; i < fieldCount; ++i) {
466 [ + - ]: 8799 : rtl::OUString name(reader.getFieldName(i));
467 [ + - ][ + - ]: 8799 : rtl::OUStringBuffer typeName(getName());
468 [ + - ]: 8799 : typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
469 [ + - ]: 8799 : typeName.append(name);
470 : 8799 : RTFieldAccess flags = reader.getFieldFlags(i);
471 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
472 : : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription >
473 : 8799 : getter;
474 : : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription >
475 : 8799 : setter;
476 : : SAL_WNODEPRECATED_DECLARATIONS_POP
477 [ + + ]: 61757 : for (sal_uInt16 j = 0; j < methodCount; ++j) {
478 [ + - ][ + + ]: 52958 : if (reader.getMethodName(j) == name) {
479 [ + + - ]: 893 : switch (reader.getMethodFlags(j)) {
480 : : case RT_MODE_ATTRIBUTE_GET:
481 : : OSL_ASSERT(getter.get() == 0);
482 : : getter.reset(
483 : : new stoc::registry_tdprovider::FunctionDescription(
484 [ + - ][ + - ]: 5 : _xTDMgr, _aBytes, j));
485 : 5 : break;
486 : :
487 : : case RT_MODE_ATTRIBUTE_SET:
488 : : OSL_ASSERT(setter.get() == 0);
489 : : setter.reset(
490 : : new stoc::registry_tdprovider::FunctionDescription(
491 [ + - ][ + - ]: 888 : _xTDMgr, _aBytes, j));
492 : 888 : break;
493 : :
494 : : default:
495 : : OSL_ASSERT(false);
496 : 893 : break;
497 : : }
498 : : }
499 : : }
500 [ + - ]: 8799 : _members[index] = new InterfaceAttributeImpl(
501 : : _xTDMgr, typeName.makeStringAndClear(), name,
502 : : reader.getFieldTypeName(i).replace('/', '.'),
503 : : (flags & RT_ACCESS_READONLY) != 0,
504 : : (flags & RT_ACCESS_BOUND) != 0, getter, setter,
505 [ + - ][ + - ]: 17598 : _nBaseOffset + index);
[ + - ][ + - ]
[ + - ]
506 : 8799 : ++index;
507 [ + - ][ + - ]: 8799 : }}
508 [ + + ]: 217777 : {for (sal_uInt16 i = 0; i < methodCount; ++i) {
509 : 169246 : RTMethodMode flags = reader.getMethodFlags(i);
510 [ + + ][ + + ]: 169246 : if (flags != RT_MODE_ATTRIBUTE_GET
511 : : && flags != RT_MODE_ATTRIBUTE_SET)
512 : : {
513 [ + - ]: 168353 : rtl::OUString name(reader.getMethodName(i));
514 [ + - ][ + - ]: 168353 : rtl::OUStringBuffer typeName(getName());
515 [ + - ]: 168353 : typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
516 [ + - ]: 168353 : typeName.append(name);
517 [ + - ]: 168353 : _members[index] = new InterfaceMethodImpl(
518 : : _xTDMgr, typeName.makeStringAndClear(), name,
519 : : reader.getMethodReturnTypeName(i).replace('/', '.'),
520 [ + - ][ + - ]: 336706 : _aBytes, i, flags == RT_MODE_ONEWAY, _nBaseOffset + index);
[ + - ][ + - ]
[ + - ]
521 : 168353 : ++index;
522 : : }
523 : : }}
524 : 48531 : _membersInit = true;
525 : : }
526 [ + - ][ + - ]: 227572 : return _members;
527 : : }
528 : :
529 : : Sequence< Reference< XTypeDescription > >
530 : 241281 : InterfaceTypeDescriptionImpl::getBaseTypes() throw (RuntimeException) {
531 [ + - ][ + - ]: 241281 : MutexGuard guard(getMutex());
532 [ + + ][ + + ]: 241281 : if (_xBaseTDs.getLength() == 0 && _aBaseTypes.getLength() != 0) {
[ + + ]
533 [ + - ]: 48188 : Sequence< Reference< XTypeDescription > > tds(_aBaseTypes.getLength());
534 [ + + ]: 98721 : for (sal_Int32 i = 0; i < _aBaseTypes.getLength(); ++i) {
535 : : try {
536 [ + - ][ + - ]: 50533 : _xTDMgr->getByHierarchicalName(_aBaseTypes[i]) >>= tds[i];
[ + - ][ + - ]
[ + - ]
537 [ # # ]: 0 : } catch (const NoSuchElementException & e) {
538 : : throw RuntimeException(
539 : : (OUString(
540 : : RTL_CONSTASCII_USTRINGPARAM(
541 : : "com.sun.star.container.NoSuchElementException: "))
542 : : + e.Message),
543 [ # # # # : 0 : static_cast< OWeakObject * >(this));
# # ]
544 : : }
545 : : OSL_ASSERT(tds[i].is());
546 [ + - ][ + - ]: 50533 : checkInterfaceType(tds[i]);
547 : : }
548 [ + - ][ + - ]: 48188 : _xBaseTDs = tds;
549 : : }
550 [ + - ][ + - ]: 241281 : return _xBaseTDs;
551 : : }
552 : :
553 : : Sequence< Reference< XTypeDescription > >
554 : 0 : InterfaceTypeDescriptionImpl::getOptionalBaseTypes() throw (RuntimeException) {
555 [ # # ][ # # ]: 0 : MutexGuard guard(getMutex());
556 [ # # # # ]: 0 : if (_xOptionalBaseTDs.getLength() == 0
[ # # ]
557 : 0 : && _aOptionalBaseTypes.getLength() != 0)
558 : : {
559 : : Sequence< Reference< XTypeDescription > > tds(
560 [ # # ]: 0 : _aOptionalBaseTypes.getLength());
561 [ # # ]: 0 : for (sal_Int32 i = 0; i < _aOptionalBaseTypes.getLength(); ++i) {
562 : : try {
563 [ # # ][ # # ]: 0 : _xTDMgr->getByHierarchicalName(_aOptionalBaseTypes[i])
564 [ # # ][ # # ]: 0 : >>= tds[i];
[ # # ]
565 [ # # ]: 0 : } catch (const NoSuchElementException & e) {
566 : : throw RuntimeException(
567 : : (OUString(
568 : : RTL_CONSTASCII_USTRINGPARAM(
569 : : "com.sun.star.container.NoSuchElementException: "))
570 : : + e.Message),
571 [ # # # # : 0 : static_cast< OWeakObject * >(this));
# # ]
572 : : }
573 : : OSL_ASSERT(tds[i].is());
574 [ # # ][ # # ]: 0 : checkInterfaceType(tds[i]);
575 : : }
576 [ # # ][ # # ]: 0 : _xOptionalBaseTDs = tds;
577 : : }
578 [ # # ][ # # ]: 0 : return _xOptionalBaseTDs;
579 : : }
580 : :
581 : : }
582 : :
583 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|