LCOV - code coverage report
Current view: top level - libreoffice/stoc/source/corereflection - criface.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 276 424 65.1 %
Date: 2012-12-17 Functions: 33 45 73.3 %
Legend: Lines: hit not hit

          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 <sal/config.h>
      22             : #ifdef SAL_UNX
      23             : #include <sal/alloca.h>
      24             : #endif
      25             : #if !(defined(MACOSX) || defined(IOS) || defined(FREEBSD))
      26             : #include <malloc.h>
      27             : #endif
      28             : #include <rtl/alloc.h>
      29             : #include <typelib/typedescription.hxx>
      30             : #include <uno/data.h>
      31             : 
      32             : #include "base.hxx"
      33             : 
      34             : #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
      35             : #include "com/sun/star/uno/RuntimeException.hpp"
      36             : #include "cppuhelper/exc_hlp.hxx"
      37             : 
      38             : namespace stoc_corefl
      39             : {
      40             : 
      41             : //==================================================================================================
      42        6078 : class IdlAttributeFieldImpl
      43             :     : public IdlMemberImpl
      44             :     , public XIdlField
      45             :     , public XIdlField2
      46             : {
      47             : public:
      48        6320 :     typelib_InterfaceAttributeTypeDescription * getAttributeTypeDescr()
      49        6320 :         { return (typelib_InterfaceAttributeTypeDescription *)getTypeDescr(); }
      50             : 
      51        3149 :     IdlAttributeFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
      52             :                            typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
      53        3149 :         : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
      54        3149 :         {}
      55             : 
      56             :     // XInterface
      57             :     virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
      58             :     virtual void SAL_CALL acquire() throw();
      59             :     virtual void SAL_CALL release() throw();
      60             : 
      61             :     // XTypeProvider
      62             :     virtual Sequence< Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
      63             :     virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
      64             : 
      65             :     // XIdlMember
      66             :     virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() throw(::com::sun::star::uno::RuntimeException);
      67             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
      68             :     // XIdlField
      69             :     virtual Reference< XIdlClass > SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException);
      70             :     virtual FieldAccessMode SAL_CALL getAccessMode() throw(::com::sun::star::uno::RuntimeException);
      71             :     virtual Any SAL_CALL get( const Any & rObj ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
      72             :     virtual void SAL_CALL set( const Any & rObj, const Any & rValue ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
      73             :     // XIdlField2: getType, getAccessMode and get are equal to XIdlField
      74             :     virtual void SAL_CALL set( Any & rObj, const Any & rValue ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
      75             : 
      76             : private:
      77             :     void checkException(
      78             :         uno_Any * exception, Reference< XInterface > const & context);
      79             : };
      80             : 
      81             : // XInterface
      82             : //__________________________________________________________________________________________________
      83         102 : Any IdlAttributeFieldImpl::queryInterface( const Type & rType )
      84             :     throw(::com::sun::star::uno::RuntimeException)
      85             : {
      86             :     Any aRet( ::cppu::queryInterface( rType,
      87             :                                       static_cast< XIdlField * >( this ),
      88         102 :                                       static_cast< XIdlField2 * >( this ) ) );
      89         102 :     return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
      90             : }
      91             : //__________________________________________________________________________________________________
      92        8159 : void IdlAttributeFieldImpl::acquire() throw()
      93             : {
      94        8159 :     IdlMemberImpl::acquire();
      95        8159 : }
      96             : //__________________________________________________________________________________________________
      97        8049 : void IdlAttributeFieldImpl::release() throw()
      98             : {
      99        8049 :     IdlMemberImpl::release();
     100        8049 : }
     101             : 
     102             : // XTypeProvider
     103             : //__________________________________________________________________________________________________
     104           0 : Sequence< Type > IdlAttributeFieldImpl::getTypes()
     105             :     throw (::com::sun::star::uno::RuntimeException)
     106             : {
     107             :     static OTypeCollection * s_pTypes = 0;
     108           0 :     if (! s_pTypes)
     109             :     {
     110           0 :         MutexGuard aGuard( getMutexAccess() );
     111           0 :         if (! s_pTypes)
     112             :         {
     113             :             static OTypeCollection s_aTypes(
     114           0 :                 ::getCppuType( (const Reference< XIdlField2 > *)0 ),
     115           0 :                 ::getCppuType( (const Reference< XIdlField > *)0 ),
     116           0 :                 IdlMemberImpl::getTypes() );
     117           0 :             s_pTypes = &s_aTypes;
     118           0 :         }
     119             :     }
     120           0 :     return s_pTypes->getTypes();
     121             : }
     122             : //__________________________________________________________________________________________________
     123           0 : Sequence< sal_Int8 > IdlAttributeFieldImpl::getImplementationId()
     124             :     throw (::com::sun::star::uno::RuntimeException)
     125             : {
     126             :     static OImplementationId * s_pId = 0;
     127           0 :     if (! s_pId)
     128             :     {
     129           0 :         MutexGuard aGuard( getMutexAccess() );
     130           0 :         if (! s_pId)
     131             :         {
     132           0 :             static OImplementationId s_aId;
     133           0 :             s_pId = &s_aId;
     134           0 :         }
     135             :     }
     136           0 :     return s_pId->getImplementationId();
     137             : }
     138             : 
     139             : // XIdlMember
     140             : //__________________________________________________________________________________________________
     141           0 : Reference< XIdlClass > IdlAttributeFieldImpl::getDeclaringClass()
     142             :     throw(::com::sun::star::uno::RuntimeException)
     143             : {
     144           0 :     if (! _xDeclClass.is())
     145             :     {
     146           0 :         MutexGuard aGuard( getMutexAccess() );
     147           0 :         if (! _xDeclClass.is())
     148             :         {
     149           0 :             rtl::OUString aName(getAttributeTypeDescr()->aBase.aBase.pTypeName);
     150           0 :             sal_Int32 i = aName.indexOf(':');
     151             :             OSL_ASSERT(i >= 0);
     152           0 :             _xDeclClass = getReflection()->forName(aName.copy(0, i));
     153           0 :         }
     154             :     }
     155           0 :     return _xDeclClass;
     156             : }
     157             : //__________________________________________________________________________________________________
     158        3117 : OUString IdlAttributeFieldImpl::getName()
     159             :     throw(::com::sun::star::uno::RuntimeException)
     160             : {
     161        3117 :     return IdlMemberImpl::getName();
     162             : }
     163             : 
     164             : // XIdlField
     165             : //__________________________________________________________________________________________________
     166        3133 : Reference< XIdlClass > IdlAttributeFieldImpl::getType()
     167             :     throw(::com::sun::star::uno::RuntimeException)
     168             : {
     169             :     return getReflection()->forType(
     170        3133 :         getAttributeTypeDescr()->pAttributeTypeRef );
     171             : }
     172             : //__________________________________________________________________________________________________
     173        3117 : FieldAccessMode IdlAttributeFieldImpl::getAccessMode()
     174             :     throw(::com::sun::star::uno::RuntimeException)
     175             : {
     176        3117 :     return (((typelib_InterfaceAttributeTypeDescription *)getAttributeTypeDescr())->bReadOnly
     177        3117 :             ? FieldAccessMode_READONLY : FieldAccessMode_READWRITE);
     178             : }
     179             : //__________________________________________________________________________________________________
     180          26 : Any IdlAttributeFieldImpl::get( const Any & rObj )
     181             :     throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     182             : {
     183             :     uno_Interface * pUnoI = getReflection()->mapToUno(
     184          26 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     185             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     186          26 :     if (pUnoI)
     187             :     {
     188          26 :         TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
     189          26 :         typelib_TypeDescription * pTD = aTD.get();
     190             : 
     191             :         uno_Any aExc;
     192          26 :         uno_Any * pExc = &aExc;
     193          26 :         void * pReturn = alloca( pTD->nSize );
     194             : 
     195          26 :         (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), pReturn, 0, &pExc );
     196          26 :         (*pUnoI->release)( pUnoI );
     197             : 
     198             :         checkException(
     199             :             pExc,
     200          26 :             *static_cast< Reference< XInterface > const * >(rObj.getValue()));
     201          26 :         Any aRet;
     202             :         uno_any_destruct(
     203          26 :             &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     204          26 :         uno_any_constructAndConvert( &aRet, pReturn, pTD, getReflection()->getUno2Cpp().get() );
     205          26 :         uno_destructData( pReturn, pTD, 0 );
     206          52 :         return aRet;
     207             :     }
     208             :     throw IllegalArgumentException(
     209             :         OUString( RTL_CONSTASCII_USTRINGPARAM("illegal object given!") ),
     210           0 :         (XWeak *)(OWeakObject *)this, 0 );
     211             : }
     212             : //__________________________________________________________________________________________________
     213          22 : void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
     214             :     throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
     215             : {
     216          22 :     if (getAttributeTypeDescr()->bReadOnly)
     217             :     {
     218             :         throw IllegalAccessException(
     219             :             OUString( RTL_CONSTASCII_USTRINGPARAM("cannot set readonly attribute!") ),
     220           0 :             (XWeak *)(OWeakObject *)this );
     221             :     }
     222             : 
     223             :     uno_Interface * pUnoI = getReflection()->mapToUno(
     224          22 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     225             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     226          22 :     if (pUnoI)
     227             :     {
     228          22 :         TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
     229          22 :         typelib_TypeDescription * pTD = aTD.get();
     230             : 
     231             :         // construct uno value to be set
     232             :         void * pArgs[1];
     233          22 :         void * pArg = pArgs[0] = alloca( pTD->nSize );
     234             : 
     235             :         sal_Bool bAssign;
     236          22 :         if (pTD->eTypeClass == typelib_TypeClass_ANY)
     237             :         {
     238             :             uno_copyAndConvertData( pArg, (const_cast< Any * >(&rValue)),
     239           6 :                                     pTD, getReflection()->getCpp2Uno().get() );
     240           6 :             bAssign = sal_True;
     241             :         }
     242          16 :         else if (typelib_typedescriptionreference_equals( rValue.getValueTypeRef(), pTD->pWeakRef ))
     243             :         {
     244          16 :             uno_copyAndConvertData( pArg, (const_cast< void * >(rValue.getValue()) ),
     245          32 :                                     pTD, getReflection()->getCpp2Uno().get() );
     246          16 :             bAssign = sal_True;
     247             :         }
     248           0 :         else if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
     249             :         {
     250           0 :             Reference< XInterface > xObj;
     251             :             bAssign = extract(
     252             :                 rValue, (typelib_InterfaceTypeDescription *)pTD, xObj,
     253           0 :                 getReflection() );
     254           0 :             if (bAssign)
     255             :             {
     256           0 :                 *(void **)pArg = getReflection()->getCpp2Uno().mapInterface(
     257           0 :                     xObj.get(), (typelib_InterfaceTypeDescription *)pTD );
     258           0 :             }
     259             :         }
     260             :         else
     261             :         {
     262           0 :             typelib_TypeDescription * pValueTD = 0;
     263           0 :             TYPELIB_DANGER_GET( &pValueTD, rValue.getValueTypeRef() );
     264             :             // construct temp uno val to do proper assignment: todo opt
     265           0 :             void * pTemp = alloca( pValueTD->nSize );
     266             :             uno_copyAndConvertData(
     267           0 :                 pTemp, (void *)rValue.getValue(), pValueTD, getReflection()->getCpp2Uno().get() );
     268             :             uno_constructData(
     269           0 :                 pArg, pTD );
     270             :             // assignment does simple conversion
     271             :             bAssign = uno_assignData(
     272           0 :                 pArg, pTD, pTemp, pValueTD, 0, 0, 0 );
     273             :             uno_destructData(
     274           0 :                 pTemp, pValueTD, 0 );
     275           0 :             TYPELIB_DANGER_RELEASE( pValueTD );
     276             :         }
     277             : 
     278          22 :         if (bAssign)
     279             :         {
     280             :             uno_Any aExc;
     281          22 :             uno_Any * pExc = &aExc;
     282          22 :             (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), 0, pArgs, &pExc );
     283          22 :             (*pUnoI->release)( pUnoI );
     284             : 
     285          22 :             uno_destructData( pArg, pTD, 0 );
     286             :             checkException(
     287             :                 pExc,
     288             :                 *static_cast< Reference< XInterface > const * >(
     289          22 :                     rObj.getValue()));
     290          22 :             return;
     291             :         }
     292           0 :         (*pUnoI->release)( pUnoI );
     293             : 
     294             :         throw IllegalArgumentException(
     295             :             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal value given!") ),
     296          22 :             *(const Reference< XInterface > *)rObj.getValue(), 1 );
     297             :     }
     298             :     throw IllegalArgumentException(
     299             :         OUString( RTL_CONSTASCII_USTRINGPARAM("illegal destination object given!") ),
     300           0 :         (XWeak *)(OWeakObject *)this, 0 );
     301             : }
     302             : //__________________________________________________________________________________________________
     303           0 : void IdlAttributeFieldImpl::set( const Any & rObj, const Any & rValue )
     304             :     throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
     305             : {
     306           0 :     IdlAttributeFieldImpl::set( const_cast< Any & >( rObj ), rValue );
     307           0 : }
     308             : 
     309          48 : void IdlAttributeFieldImpl::checkException(
     310             :     uno_Any * exception, Reference< XInterface > const & context)
     311             : {
     312          48 :     if (exception != 0) {
     313           0 :         Any e;
     314           0 :         uno_any_destruct(&e, reinterpret_cast< uno_ReleaseFunc >(cpp_release));
     315             :         uno_type_any_constructAndConvert(
     316             :             &e, exception->pData, exception->pType,
     317           0 :             getReflection()->getUno2Cpp().get());
     318           0 :         uno_any_destruct(exception, 0);
     319           0 :         if (e.isExtractableTo(
     320           0 :                 getCppuType(static_cast< RuntimeException const * >(0))))
     321             :         {
     322           0 :             cppu::throwException(e);
     323             :         } else {
     324             :             throw WrappedTargetRuntimeException(
     325             :                 OUString(
     326             :                     RTL_CONSTASCII_USTRINGPARAM(
     327             :                         "non-RuntimeException occurred when accessing an"
     328             :                         " interface type attribute")),
     329           0 :                 context, e);
     330           0 :         }
     331             :     }
     332          48 : }
     333             : 
     334             : //##################################################################################################
     335             : //##################################################################################################
     336             : //##################################################################################################
     337             : 
     338             : 
     339             : //==================================================================================================
     340             : class IdlInterfaceMethodImpl
     341             :     : public IdlMemberImpl
     342             :     , public XIdlMethod
     343             : {
     344             :     Sequence< Reference< XIdlClass > > * _pExceptionTypes;
     345             :     Sequence< Reference< XIdlClass > > * _pParamTypes;
     346             :     Sequence< ParamInfo > *              _pParamInfos;
     347             : 
     348             : public:
     349      124829 :     typelib_InterfaceMethodTypeDescription * getMethodTypeDescr()
     350      124829 :         { return (typelib_InterfaceMethodTypeDescription *)getTypeDescr(); }
     351             : 
     352       75324 :     IdlInterfaceMethodImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
     353             :                             typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
     354             :         : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
     355             :         , _pExceptionTypes( 0 )
     356             :         , _pParamTypes( 0 )
     357       75324 :         , _pParamInfos( 0 )
     358       75324 :         {}
     359             :     virtual ~IdlInterfaceMethodImpl();
     360             : 
     361             :     // XInterface
     362             :     virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
     363             :     virtual void SAL_CALL acquire() throw();
     364             :     virtual void SAL_CALL release() throw();
     365             : 
     366             :     // XTypeProvider
     367             :     virtual Sequence< Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
     368             :     virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
     369             : 
     370             :     // XIdlMember
     371             :     virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() throw(::com::sun::star::uno::RuntimeException);
     372             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     373             :     // XIdlMethod
     374             :     virtual Reference< XIdlClass > SAL_CALL getReturnType() throw(::com::sun::star::uno::RuntimeException);
     375             :     virtual Sequence< Reference< XIdlClass > > SAL_CALL getParameterTypes() throw(::com::sun::star::uno::RuntimeException);
     376             :     virtual Sequence< ParamInfo > SAL_CALL getParameterInfos() throw(::com::sun::star::uno::RuntimeException);
     377             :     virtual Sequence< Reference< XIdlClass > > SAL_CALL getExceptionTypes() throw(::com::sun::star::uno::RuntimeException);
     378             :     virtual MethodMode SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException);
     379             :     virtual Any SAL_CALL invoke( const Any & rObj, Sequence< Any > & rArgs ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
     380             : };
     381             : //__________________________________________________________________________________________________
     382      220602 : IdlInterfaceMethodImpl::~IdlInterfaceMethodImpl()
     383             : {
     384       73534 :     delete _pParamInfos;
     385       73534 :     delete _pParamTypes;
     386       73534 :     delete _pExceptionTypes;
     387      147068 : }
     388             : 
     389             : // XInterface
     390             : //__________________________________________________________________________________________________
     391           0 : Any IdlInterfaceMethodImpl::queryInterface( const Type & rType )
     392             :     throw(::com::sun::star::uno::RuntimeException)
     393             : {
     394           0 :     Any aRet( ::cppu::queryInterface( rType, static_cast< XIdlMethod * >( this ) ) );
     395           0 :     return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
     396             : }
     397             : //__________________________________________________________________________________________________
     398      128563 : void IdlInterfaceMethodImpl::acquire() throw()
     399             : {
     400      128563 :     IdlMemberImpl::acquire();
     401      128563 : }
     402             : //__________________________________________________________________________________________________
     403      126555 : void IdlInterfaceMethodImpl::release() throw()
     404             : {
     405      126555 :     IdlMemberImpl::release();
     406      126555 : }
     407             : 
     408             : // XTypeProvider
     409             : //__________________________________________________________________________________________________
     410           0 : Sequence< Type > IdlInterfaceMethodImpl::getTypes()
     411             :     throw (::com::sun::star::uno::RuntimeException)
     412             : {
     413             :     static OTypeCollection * s_pTypes = 0;
     414           0 :     if (! s_pTypes)
     415             :     {
     416           0 :         MutexGuard aGuard( getMutexAccess() );
     417           0 :         if (! s_pTypes)
     418             :         {
     419             :             static OTypeCollection s_aTypes(
     420           0 :                 ::getCppuType( (const Reference< XIdlMethod > *)0 ),
     421           0 :                 IdlMemberImpl::getTypes() );
     422           0 :             s_pTypes = &s_aTypes;
     423           0 :         }
     424             :     }
     425           0 :     return s_pTypes->getTypes();
     426             : }
     427             : //__________________________________________________________________________________________________
     428           0 : Sequence< sal_Int8 > IdlInterfaceMethodImpl::getImplementationId()
     429             :     throw (::com::sun::star::uno::RuntimeException)
     430             : {
     431             :     static OImplementationId * s_pId = 0;
     432           0 :     if (! s_pId)
     433             :     {
     434           0 :         MutexGuard aGuard( getMutexAccess() );
     435           0 :         if (! s_pId)
     436             :         {
     437           0 :             static OImplementationId s_aId;
     438           0 :             s_pId = &s_aId;
     439           0 :         }
     440             :     }
     441           0 :     return s_pId->getImplementationId();
     442             : }
     443             : 
     444             : // XIdlMember
     445             : //__________________________________________________________________________________________________
     446      370235 : Reference< XIdlClass > IdlInterfaceMethodImpl::getDeclaringClass()
     447             :     throw(::com::sun::star::uno::RuntimeException)
     448             : {
     449      370235 :     if (! _xDeclClass.is())
     450             :     {
     451       75324 :         MutexGuard aGuard( getMutexAccess() );
     452       75324 :         if (! _xDeclClass.is())
     453             :         {
     454       75324 :             rtl::OUString aName(getMethodTypeDescr()->aBase.aBase.pTypeName);
     455       75324 :             sal_Int32 i = aName.indexOf(':');
     456             :             OSL_ASSERT(i >= 0);
     457       75324 :             _xDeclClass = getReflection()->forName(aName.copy(0, i));
     458       75324 :         }
     459             :     }
     460      370235 :     return _xDeclClass;
     461             : }
     462             : //__________________________________________________________________________________________________
     463      189140 : OUString IdlInterfaceMethodImpl::getName()
     464             :     throw(::com::sun::star::uno::RuntimeException)
     465             : {
     466      189140 :     return IdlMemberImpl::getName();
     467             : }
     468             : 
     469             : // XIdlMethod
     470             : //__________________________________________________________________________________________________
     471       10787 : Reference< XIdlClass > SAL_CALL IdlInterfaceMethodImpl::getReturnType()
     472             :     throw(::com::sun::star::uno::RuntimeException)
     473             : {
     474       10787 :     return getReflection()->forType( getMethodTypeDescr()->pReturnTypeRef );
     475             : }
     476             : //__________________________________________________________________________________________________
     477           0 : Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getExceptionTypes()
     478             :     throw(::com::sun::star::uno::RuntimeException)
     479             : {
     480           0 :     if (! _pExceptionTypes)
     481             :     {
     482           0 :         MutexGuard aGuard( getMutexAccess() );
     483           0 :         if (! _pExceptionTypes)
     484             :         {
     485           0 :             sal_Int32 nExc = getMethodTypeDescr()->nExceptions;
     486             :             Sequence< Reference< XIdlClass > > * pTempExceptionTypes =
     487           0 :                 new Sequence< Reference< XIdlClass > >( nExc );
     488           0 :             Reference< XIdlClass > * pExceptionTypes = pTempExceptionTypes->getArray();
     489             : 
     490             :             typelib_TypeDescriptionReference ** ppExc =
     491           0 :                 getMethodTypeDescr()->ppExceptions;
     492           0 :             IdlReflectionServiceImpl * pRefl = getReflection();
     493             : 
     494           0 :             while (nExc--)
     495           0 :                 pExceptionTypes[nExc] = pRefl->forType( ppExc[nExc] );
     496             : 
     497           0 :             _pExceptionTypes = pTempExceptionTypes;
     498           0 :         }
     499             :     }
     500           0 :     return *_pExceptionTypes;
     501             : }
     502             : //__________________________________________________________________________________________________
     503       18188 : Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getParameterTypes()
     504             :     throw(::com::sun::star::uno::RuntimeException)
     505             : {
     506       18188 :     if (! _pParamTypes)
     507             :     {
     508       18180 :         MutexGuard aGuard( getMutexAccess() );
     509       18180 :         if (! _pParamTypes)
     510             :         {
     511       18180 :             sal_Int32 nParams = getMethodTypeDescr()->nParams;
     512             :             Sequence< Reference< XIdlClass > > * pTempParamTypes =
     513       18180 :                 new Sequence< Reference< XIdlClass > >( nParams );
     514       18180 :             Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
     515             : 
     516             :             typelib_MethodParameter * pTypelibParams =
     517       18180 :                 getMethodTypeDescr()->pParams;
     518       18180 :             IdlReflectionServiceImpl * pRefl = getReflection();
     519             : 
     520       49669 :             while (nParams--)
     521       13309 :                 pParamTypes[nParams] = pRefl->forType( pTypelibParams[nParams].pTypeRef );
     522             : 
     523       18180 :             _pParamTypes = pTempParamTypes;
     524       18180 :         }
     525             :     }
     526       18188 :     return *_pParamTypes;
     527             : }
     528             : //__________________________________________________________________________________________________
     529         863 : Sequence< ParamInfo > IdlInterfaceMethodImpl::getParameterInfos()
     530             :     throw(::com::sun::star::uno::RuntimeException)
     531             : {
     532         863 :     if (! _pParamInfos)
     533             :     {
     534         684 :         MutexGuard aGuard( getMutexAccess() );
     535         684 :         if (! _pParamInfos)
     536             :         {
     537         684 :             sal_Int32 nParams = getMethodTypeDescr()->nParams;
     538         684 :             Sequence< ParamInfo > * pTempParamInfos = new Sequence< ParamInfo >( nParams );
     539         684 :             ParamInfo * pParamInfos = pTempParamInfos->getArray();
     540             : 
     541             :             typelib_MethodParameter * pTypelibParams =
     542         684 :                 getMethodTypeDescr()->pParams;
     543             : 
     544         684 :             if (_pParamTypes) // use param types
     545             :             {
     546         663 :                 const Reference< XIdlClass > * pParamTypes = _pParamTypes->getConstArray();
     547             : 
     548        3520 :                 while (nParams--)
     549             :                 {
     550        2194 :                     const typelib_MethodParameter & rParam = pTypelibParams[nParams];
     551        2194 :                     ParamInfo & rInfo = pParamInfos[nParams];
     552        2194 :                     rInfo.aName = rParam.pName;
     553        2194 :                     if (rParam.bIn)
     554        2194 :                         rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
     555             :                     else
     556           0 :                         rInfo.aMode = ParamMode_OUT;
     557        2194 :                     rInfo.aType = pParamTypes[nParams];
     558             :                 }
     559             :             }
     560             :             else // make also param types sequence if not already initialized
     561             :             {
     562             :                 Sequence< Reference< XIdlClass > > * pTempParamTypes =
     563          21 :                     new Sequence< Reference< XIdlClass > >( nParams );
     564          21 :                 Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
     565             : 
     566          21 :                 IdlReflectionServiceImpl * pRefl = getReflection();
     567             : 
     568          77 :                 while (nParams--)
     569             :                 {
     570          35 :                     const typelib_MethodParameter & rParam = pTypelibParams[nParams];
     571          35 :                     ParamInfo & rInfo = pParamInfos[nParams];
     572          35 :                     rInfo.aName = rParam.pName;
     573          35 :                     if (rParam.bIn)
     574          35 :                         rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
     575             :                     else
     576           0 :                         rInfo.aMode = ParamMode_OUT;
     577          35 :                     rInfo.aType = pParamTypes[nParams] = pRefl->forType( rParam.pTypeRef );
     578             :                 }
     579             : 
     580          21 :                 _pParamTypes = pTempParamTypes;
     581             :             }
     582             : 
     583         684 :             _pParamInfos = pTempParamInfos;
     584         684 :         }
     585             :     }
     586         863 :     return *_pParamInfos;
     587             : }
     588             : //__________________________________________________________________________________________________
     589           0 : MethodMode SAL_CALL IdlInterfaceMethodImpl::getMode()
     590             :     throw(::com::sun::star::uno::RuntimeException)
     591             : {
     592             :     return
     593           0 :         getMethodTypeDescr()->bOneWay ? MethodMode_ONEWAY : MethodMode_TWOWAY;
     594             : }
     595             : //__________________________________________________________________________________________________
     596         330 : Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & rArgs )
     597             :     throw(::com::sun::star::lang::IllegalArgumentException,
     598             :           ::com::sun::star::reflection::InvocationTargetException,
     599             :           ::com::sun::star::uno::RuntimeException)
     600             : {
     601         330 :     if (rObj.getValueTypeClass() == TypeClass_INTERFACE)
     602             :     {
     603             :         // acquire()/ release()
     604         660 :         if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
     605         330 :                                     "com.sun.star.uno.XInterface::acquire" ) == 0)
     606             :         {
     607           0 :             (*(const Reference< XInterface > *)rObj.getValue())->acquire();
     608           0 :             return Any();
     609             :         }
     610         660 :         else if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
     611         330 :                                          "com.sun.star.uno.XInterface::release" ) == 0)
     612             :         {
     613           0 :             (*(const Reference< XInterface > *)rObj.getValue())->release();
     614           0 :             return Any();
     615             :         }
     616             :     }
     617             : 
     618             :     uno_Interface * pUnoI = getReflection()->mapToUno(
     619         330 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     620             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     621         330 :     if (pUnoI)
     622             :     {
     623         330 :         sal_Int32 nParams = getMethodTypeDescr()->nParams;
     624         330 :         if (rArgs.getLength() != nParams)
     625             :         {
     626           0 :             (*pUnoI->release)( pUnoI );
     627             :             throw IllegalArgumentException(
     628             :                 OUString( RTL_CONSTASCII_USTRINGPARAM("arguments len differ!") ),
     629           0 :                 *(const Reference< XInterface > *)rObj.getValue(), 1 );
     630             :         }
     631             : 
     632         330 :         Any * pCppArgs = rArgs.getArray();
     633         330 :         typelib_MethodParameter * pParams = getMethodTypeDescr()->pParams;
     634         330 :         typelib_TypeDescription * pReturnType = 0;
     635         330 :         TYPELIB_DANGER_GET(
     636             :             &pReturnType, getMethodTypeDescr()->pReturnTypeRef );
     637             : 
     638         330 :         void * pUnoReturn = alloca( pReturnType->nSize );
     639         330 :         void ** ppUnoArgs = (void **)alloca( sizeof(void *) * nParams *2 );
     640         330 :         typelib_TypeDescription ** ppParamTypes = (typelib_TypeDescription **)(ppUnoArgs + nParams);
     641             : 
     642             :         // convert arguments
     643        1119 :         for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
     644             :         {
     645         789 :             ppParamTypes[nPos] = 0;
     646         789 :             TYPELIB_DANGER_GET( ppParamTypes + nPos, pParams[nPos].pTypeRef );
     647         789 :             typelib_TypeDescription * pTD = ppParamTypes[nPos];
     648             : 
     649         789 :             ppUnoArgs[nPos] = alloca( pTD->nSize );
     650         789 :             if (pParams[nPos].bIn)
     651             :             {
     652             :                 sal_Bool bAssign;
     653         789 :                 if (typelib_typedescriptionreference_equals(
     654         789 :                         pCppArgs[nPos].getValueTypeRef(), pTD->pWeakRef ))
     655             :                 {
     656             :                     uno_type_copyAndConvertData(
     657          75 :                         ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
     658         150 :                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
     659          75 :                     bAssign = sal_True;
     660             :                 }
     661         714 :                 else if (pTD->eTypeClass == typelib_TypeClass_ANY)
     662             :                 {
     663             :                     uno_type_any_constructAndConvert(
     664         706 :                         (uno_Any *)ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
     665        1412 :                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
     666         706 :                     bAssign = sal_True;
     667             :                 }
     668           8 :                 else if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
     669             :                 {
     670           8 :                     Reference< XInterface > xDest;
     671             :                     bAssign = extract(
     672             :                         pCppArgs[nPos], (typelib_InterfaceTypeDescription *)pTD,
     673           8 :                         xDest, getReflection() );
     674           8 :                     if (bAssign)
     675             :                     {
     676          16 :                         *(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface(
     677          16 :                             xDest.get(), (typelib_InterfaceTypeDescription *)pTD );
     678           8 :                     }
     679             :                 }
     680             :                 else
     681             :                 {
     682           0 :                     typelib_TypeDescription * pValueTD = 0;
     683           0 :                     TYPELIB_DANGER_GET( &pValueTD, pCppArgs[nPos].getValueTypeRef() );
     684             :                     // construct temp uno val to do proper assignment: todo opt
     685           0 :                     void * pTemp = alloca( pValueTD->nSize );
     686             :                     uno_copyAndConvertData(
     687           0 :                         pTemp, (void *)pCppArgs[nPos].getValue(), pValueTD,
     688           0 :                         getReflection()->getCpp2Uno().get() );
     689             :                     uno_constructData(
     690           0 :                         ppUnoArgs[nPos], pTD );
     691             :                     // assignment does simple conversion
     692             :                     bAssign = uno_assignData(
     693           0 :                         ppUnoArgs[nPos], pTD, pTemp, pValueTD, 0, 0, 0 );
     694             :                     uno_destructData(
     695           0 :                         pTemp, pValueTD, 0 );
     696           0 :                     TYPELIB_DANGER_RELEASE( pValueTD );
     697             :                 }
     698             : 
     699         789 :                 if (! bAssign)
     700             :                 {
     701             :                     IllegalArgumentException aExc(
     702             :                         OUString( RTL_CONSTASCII_USTRINGPARAM("cannot coerce argument type during corereflection call!") ),
     703           0 :                         *(const Reference< XInterface > *)rObj.getValue(), (sal_Int16)nPos );
     704             : 
     705             :                     // cleanup
     706           0 :                     while (nPos--)
     707             :                     {
     708           0 :                         if (pParams[nPos].bIn)
     709           0 :                             uno_destructData( ppUnoArgs[nPos], ppParamTypes[nPos], 0 );
     710           0 :                         TYPELIB_DANGER_RELEASE( ppParamTypes[nPos] );
     711             :                     }
     712           0 :                     TYPELIB_DANGER_RELEASE( pReturnType );
     713           0 :                     (*pUnoI->release)( pUnoI );
     714             : 
     715           0 :                     throw aExc;
     716             :                 }
     717             :             }
     718             :         }
     719             : 
     720             :         uno_Any aUnoExc;
     721         330 :         uno_Any * pUnoExc = &aUnoExc;
     722             : 
     723             :         (*pUnoI->pDispatcher)(
     724         330 :             pUnoI, getTypeDescr(), pUnoReturn, ppUnoArgs, &pUnoExc );
     725         330 :         (*pUnoI->release)( pUnoI );
     726             : 
     727         330 :         Any aRet;
     728         330 :         if (pUnoExc)
     729             :         {
     730             :             // cleanup
     731          16 :             while (nParams--)
     732             :             {
     733           8 :                 if (pParams[nParams].bIn)
     734           8 :                     uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
     735           8 :                 TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
     736             :             }
     737           4 :             TYPELIB_DANGER_RELEASE( pReturnType );
     738             : 
     739           4 :             InvocationTargetException aExc;
     740           4 :             aExc.Context = *(const Reference< XInterface > *)rObj.getValue();
     741           4 :             aExc.Message = OUString( RTL_CONSTASCII_USTRINGPARAM("exception occurred during invocation!") );
     742             :             uno_any_destruct(
     743             :                 &aExc.TargetException,
     744           4 :                 reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     745             :             uno_type_copyAndConvertData(
     746           4 :                 &aExc.TargetException, pUnoExc, ::getCppuType( (const Any *)0 ).getTypeLibType(),
     747           8 :                 getReflection()->getUno2Cpp().get() );
     748           4 :             uno_any_destruct( pUnoExc, 0 );
     749           4 :             throw aExc;
     750             :         }
     751             :         else
     752             :         {
     753             :             // reconvert arguments and cleanup
     754        1433 :             while (nParams--)
     755             :             {
     756         781 :                 if (pParams[nParams].bOut) // write back
     757             :                 {
     758             :                     uno_any_destruct(
     759           0 :                         &pCppArgs[nParams],
     760           0 :                         reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     761             :                     uno_any_constructAndConvert(
     762           0 :                         &pCppArgs[nParams], ppUnoArgs[nParams], ppParamTypes[nParams],
     763           0 :                         getReflection()->getUno2Cpp().get() );
     764             :                 }
     765         781 :                 uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
     766         781 :                 TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
     767             :             }
     768             :             uno_any_destruct(
     769         326 :                 &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     770             :             uno_any_constructAndConvert(
     771             :                 &aRet, pUnoReturn, pReturnType,
     772         326 :                 getReflection()->getUno2Cpp().get() );
     773         326 :             uno_destructData( pUnoReturn, pReturnType, 0 );
     774         326 :             TYPELIB_DANGER_RELEASE( pReturnType );
     775             :         }
     776         330 :         return aRet;
     777             :     }
     778             :     throw IllegalArgumentException(
     779             :         OUString( RTL_CONSTASCII_USTRINGPARAM("illegal destination object given!") ),
     780           0 :         (XWeak *)(OWeakObject *)this, 0 );
     781             : }
     782             : 
     783             : 
     784             : //##################################################################################################
     785             : //##################################################################################################
     786             : //##################################################################################################
     787             : 
     788             : 
     789             : //__________________________________________________________________________________________________
     790        6516 : InterfaceIdlClassImpl::~InterfaceIdlClassImpl()
     791             : {
     792        4520 :     for ( sal_Int32 nPos = _nMethods + _nAttributes; nPos--; )
     793         176 :         typelib_typedescription_release( _pSortedMemberInit[nPos].second );
     794             : 
     795        2172 :     delete [] _pSortedMemberInit;
     796        4344 : }
     797             : 
     798             : //__________________________________________________________________________________________________
     799       23633 : Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses()
     800             :     throw(::com::sun::star::uno::RuntimeException)
     801             : {
     802       23633 :     MutexGuard aGuard(getMutexAccess());
     803       23633 :     if (_xSuperClasses.getLength() == 0) {
     804       13669 :         typelib_InterfaceTypeDescription * pType = getTypeDescr();
     805       13669 :         _xSuperClasses.realloc(pType->nBaseTypes);
     806       17732 :         for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) {
     807        4063 :             _xSuperClasses[i] = getReflection()->forType(
     808        8126 :                 &pType->ppBaseTypes[i]->aBase);
     809             :             OSL_ASSERT(_xSuperClasses[i].is());
     810             :         }
     811             :     }
     812       23633 :     return Sequence< Reference< XIdlClass > >(_xSuperClasses);
     813             : }
     814             : //__________________________________________________________________________________________________
     815        3555 : void InterfaceIdlClassImpl::initMembers()
     816             : {
     817        3555 :     sal_Int32 nAll = getTypeDescr()->nAllMembers;
     818        3555 :     MemberInit * pSortedMemberInit = new MemberInit[nAll];
     819        3555 :     typelib_TypeDescriptionReference ** ppAllMembers = getTypeDescr()->ppAllMembers;
     820             : 
     821       27749 :     for ( sal_Int32 nPos = 0; nPos < nAll; ++nPos )
     822             :     {
     823             :         sal_Int32 nIndex;
     824       24194 :         if (ppAllMembers[nPos]->eTypeClass == typelib_TypeClass_INTERFACE_METHOD)
     825             :         {
     826             :             // methods to front
     827       23272 :             nIndex = _nMethods;
     828       23272 :             ++_nMethods;
     829             :         }
     830             :         else
     831             :         {
     832         922 :             ++_nAttributes;
     833         922 :             nIndex = (nAll - _nAttributes);
     834             :             // attributes at the back
     835             :         }
     836             : 
     837       24194 :         typelib_TypeDescription * pTD = 0;
     838       24194 :         typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] );
     839             :         OSL_ENSURE( pTD, "### cannot get type description!" );
     840       24194 :         pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName;
     841       24194 :         pSortedMemberInit[nIndex].second = pTD;
     842             :     }
     843             : 
     844        3555 :     _pSortedMemberInit = pSortedMemberInit;
     845        3555 : }
     846             : //__________________________________________________________________________________________________
     847          30 : sal_Bool InterfaceIdlClassImpl::isAssignableFrom( const Reference< XIdlClass > & xType )
     848             :     throw(::com::sun::star::uno::RuntimeException)
     849             : {
     850          30 :     if (xType.is() && xType->getTypeClass() == TypeClass_INTERFACE)
     851             :     {
     852          30 :         if (equals( xType ))
     853           3 :             return sal_True;
     854             :         else
     855             :         {
     856          27 :             const Sequence< Reference< XIdlClass > > & rSeq = xType->getSuperclasses();
     857          27 :             for (sal_Int32 i = 0; i < rSeq.getLength(); ++i) {
     858           0 :                 if (isAssignableFrom(rSeq[i])) {
     859           0 :                     return true;
     860             :                 }
     861          27 :             }
     862             :         }
     863             :     }
     864          27 :     return sal_False;
     865             : }
     866             : //__________________________________________________________________________________________________
     867           0 : Uik InterfaceIdlClassImpl::getUik()
     868             :     throw(::com::sun::star::uno::RuntimeException)
     869             : {
     870           0 :     return Uik(0, 0, 0, 0, 0);
     871             :         // Uiks are deprecated and this function must not be called
     872             : }
     873             : //__________________________________________________________________________________________________
     874       11790 : Sequence< Reference< XIdlMethod > > InterfaceIdlClassImpl::getMethods()
     875             :     throw(::com::sun::star::uno::RuntimeException)
     876             : {
     877       11790 :     MutexGuard aGuard( getMutexAccess() );
     878       11790 :     if (! _pSortedMemberInit)
     879           0 :         initMembers();
     880             : 
     881             :     // create methods sequence
     882       11790 :     Sequence< Reference< XIdlMethod > > aRet( _nMethods );
     883       11790 :     Reference< XIdlMethod > * pRet = aRet.getArray();
     884       98904 :     for ( sal_Int32 nPos = _nMethods; nPos--; )
     885             :     {
     886             : 
     887             :         /*_aName2Method[_pSortedMemberInit[nPos].first] = */pRet[nPos] = new IdlInterfaceMethodImpl(
     888      150648 :             getReflection(), _pSortedMemberInit[nPos].first,
     889      150648 :             _pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
     890             :     }
     891       11790 :     return aRet;
     892             : }
     893             : //__________________________________________________________________________________________________
     894       11790 : Sequence< Reference< XIdlField > > InterfaceIdlClassImpl::getFields()
     895             :     throw(::com::sun::star::uno::RuntimeException)
     896             : {
     897       11790 :     MutexGuard aGuard( getMutexAccess() );
     898       11790 :     if (! _pSortedMemberInit)
     899        3539 :         initMembers();
     900             : 
     901             :     // create fields sequence
     902       11790 :     Sequence< Reference< XIdlField > > aRet( _nAttributes );
     903       11790 :     Reference< XIdlField > * pRet = aRet.getArray();
     904       26697 :     for ( sal_Int32 nPos = _nAttributes; nPos--; )
     905             :     {
     906             :         /*_aName2Field[_pSortedMemberInit[_nMethods+nPos].first] = */pRet[_nAttributes-nPos-1] =
     907             :             new IdlAttributeFieldImpl(
     908        6234 :                 getReflection(), _pSortedMemberInit[_nMethods+nPos].first,
     909        6234 :                 _pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
     910             :     }
     911       11790 :     return aRet;
     912             : }
     913             : //__________________________________________________________________________________________________
     914           0 : Reference< XIdlMethod > InterfaceIdlClassImpl::getMethod( const OUString & rName )
     915             :     throw(::com::sun::star::uno::RuntimeException)
     916             : {
     917           0 :     MutexGuard aGuard( getMutexAccess() );
     918           0 :     if (! _pSortedMemberInit)
     919           0 :         initMembers();
     920             : 
     921           0 :     Reference< XIdlMethod > xRet;
     922             : 
     923             :     // try weak map
     924           0 :     const OUString2Method::const_iterator iFind( _aName2Method.find( rName ) );
     925           0 :     if (iFind != _aName2Method.end())
     926           0 :         xRet = (*iFind).second; // harden ref
     927             : 
     928           0 :     if (! xRet.is())
     929             :     {
     930           0 :         for ( sal_Int32 nPos = _nMethods; nPos--; )
     931             :         {
     932           0 :             if (_pSortedMemberInit[nPos].first == rName)
     933             :             {
     934           0 :                 _aName2Method[rName] = xRet = new IdlInterfaceMethodImpl(
     935           0 :                     getReflection(), rName,
     936           0 :                     _pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
     937           0 :                 break;
     938             :             }
     939             :         }
     940             :     }
     941           0 :     return xRet;
     942             : }
     943             : //__________________________________________________________________________________________________
     944          48 : Reference< XIdlField > InterfaceIdlClassImpl::getField( const OUString & rName )
     945             :     throw(::com::sun::star::uno::RuntimeException)
     946             : {
     947          48 :     MutexGuard aGuard( getMutexAccess() );
     948          48 :     if (! _pSortedMemberInit)
     949          16 :         initMembers();
     950             : 
     951          48 :     Reference< XIdlField > xRet;
     952             : 
     953             :     // try weak map
     954          48 :     const OUString2Field::const_iterator iFind( _aName2Field.find( rName ) );
     955          48 :     if (iFind != _aName2Field.end())
     956          16 :         xRet = (*iFind).second; // harden ref
     957             : 
     958          48 :     if (! xRet.is())
     959             :     {
     960          80 :         for ( sal_Int32 nPos = _nAttributes; nPos--; )
     961             :         {
     962          48 :             if (_pSortedMemberInit[_nMethods+nPos].first == rName)
     963             :             {
     964          32 :                 _aName2Field[rName] = xRet = new IdlAttributeFieldImpl(
     965          32 :                     getReflection(), rName,
     966          64 :                     _pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
     967          32 :                 break;
     968             :             }
     969             :         }
     970             :     }
     971          48 :     return xRet;
     972             : }
     973             : //__________________________________________________________________________________________________
     974           0 : void InterfaceIdlClassImpl::createObject( Any & rObj )
     975             :     throw(::com::sun::star::uno::RuntimeException)
     976             : {
     977             :     // interfaces cannot be constructed
     978           0 :     rObj.clear();
     979           0 : }
     980             : 
     981             : }
     982             : 
     983             : 
     984             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10