LCOV - code coverage report
Current view: top level - libreoffice/stoc/source/corereflection - criface.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 188 424 44.3 %
Date: 2012-12-27 Functions: 31 45 68.9 %
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        2336 : class IdlAttributeFieldImpl
      43             :     : public IdlMemberImpl
      44             :     , public XIdlField
      45             :     , public XIdlField2
      46             : {
      47             : public:
      48        2432 :     typelib_InterfaceAttributeTypeDescription * getAttributeTypeDescr()
      49        2432 :         { return (typelib_InterfaceAttributeTypeDescription *)getTypeDescr(); }
      50             : 
      51        1216 :     IdlAttributeFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
      52             :                            typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
      53        1216 :         : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
      54        1216 :         {}
      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          36 : 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          36 :                                       static_cast< XIdlField2 * >( this ) ) );
      89          36 :     return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
      90             : }
      91             : //__________________________________________________________________________________________________
      92        3119 : void IdlAttributeFieldImpl::acquire() throw()
      93             : {
      94        3119 :     IdlMemberImpl::acquire();
      95        3119 : }
      96             : //__________________________________________________________________________________________________
      97        3071 : void IdlAttributeFieldImpl::release() throw()
      98             : {
      99        3071 :     IdlMemberImpl::release();
     100        3071 : }
     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        1204 : OUString IdlAttributeFieldImpl::getName()
     159             :     throw(::com::sun::star::uno::RuntimeException)
     160             : {
     161        1204 :     return IdlMemberImpl::getName();
     162             : }
     163             : 
     164             : // XIdlField
     165             : //__________________________________________________________________________________________________
     166        1210 : Reference< XIdlClass > IdlAttributeFieldImpl::getType()
     167             :     throw(::com::sun::star::uno::RuntimeException)
     168             : {
     169             :     return getReflection()->forType(
     170        1210 :         getAttributeTypeDescr()->pAttributeTypeRef );
     171             : }
     172             : //__________________________________________________________________________________________________
     173        1204 : FieldAccessMode IdlAttributeFieldImpl::getAccessMode()
     174             :     throw(::com::sun::star::uno::RuntimeException)
     175             : {
     176        1204 :     return (((typelib_InterfaceAttributeTypeDescription *)getAttributeTypeDescr())->bReadOnly
     177        1204 :             ? FieldAccessMode_READONLY : FieldAccessMode_READWRITE);
     178             : }
     179             : //__________________________________________________________________________________________________
     180           6 : 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           6 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     185             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     186           6 :     if (pUnoI)
     187             :     {
     188           6 :         TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
     189           6 :         typelib_TypeDescription * pTD = aTD.get();
     190             : 
     191             :         uno_Any aExc;
     192           6 :         uno_Any * pExc = &aExc;
     193           6 :         void * pReturn = alloca( pTD->nSize );
     194             : 
     195           6 :         (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), pReturn, 0, &pExc );
     196           6 :         (*pUnoI->release)( pUnoI );
     197             : 
     198             :         checkException(
     199             :             pExc,
     200           6 :             *static_cast< Reference< XInterface > const * >(rObj.getValue()));
     201           6 :         Any aRet;
     202             :         uno_any_destruct(
     203           6 :             &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     204           6 :         uno_any_constructAndConvert( &aRet, pReturn, pTD, getReflection()->getUno2Cpp().get() );
     205           6 :         uno_destructData( pReturn, pTD, 0 );
     206          12 :         return aRet;
     207             :     }
     208             :     throw IllegalArgumentException(
     209             :         OUString( RTL_CONSTASCII_USTRINGPARAM("illegal object given!") ),
     210           0 :         (XWeak *)(OWeakObject *)this, 0 );
     211             : }
     212             : //__________________________________________________________________________________________________
     213           6 : 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           6 :     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           6 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     225             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     226           6 :     if (pUnoI)
     227             :     {
     228           6 :         TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
     229           6 :         typelib_TypeDescription * pTD = aTD.get();
     230             : 
     231             :         // construct uno value to be set
     232             :         void * pArgs[1];
     233           6 :         void * pArg = pArgs[0] = alloca( pTD->nSize );
     234             : 
     235             :         sal_Bool bAssign;
     236           6 :         if (pTD->eTypeClass == typelib_TypeClass_ANY)
     237             :         {
     238             :             uno_copyAndConvertData( pArg, (const_cast< Any * >(&rValue)),
     239           0 :                                     pTD, getReflection()->getCpp2Uno().get() );
     240           0 :             bAssign = sal_True;
     241             :         }
     242           6 :         else if (typelib_typedescriptionreference_equals( rValue.getValueTypeRef(), pTD->pWeakRef ))
     243             :         {
     244           6 :             uno_copyAndConvertData( pArg, (const_cast< void * >(rValue.getValue()) ),
     245          12 :                                     pTD, getReflection()->getCpp2Uno().get() );
     246           6 :             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           6 :         if (bAssign)
     279             :         {
     280             :             uno_Any aExc;
     281           6 :             uno_Any * pExc = &aExc;
     282           6 :             (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), 0, pArgs, &pExc );
     283           6 :             (*pUnoI->release)( pUnoI );
     284             : 
     285           6 :             uno_destructData( pArg, pTD, 0 );
     286             :             checkException(
     287             :                 pExc,
     288             :                 *static_cast< Reference< XInterface > const * >(
     289           6 :                     rObj.getValue()));
     290           6 :             return;
     291             :         }
     292           0 :         (*pUnoI->release)( pUnoI );
     293             : 
     294             :         throw IllegalArgumentException(
     295             :             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal value given!") ),
     296           6 :             *(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          12 : void IdlAttributeFieldImpl::checkException(
     310             :     uno_Any * exception, Reference< XInterface > const & context)
     311             : {
     312          12 :     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          12 : }
     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       47026 :     typelib_InterfaceMethodTypeDescription * getMethodTypeDescr()
     350       47026 :         { return (typelib_InterfaceMethodTypeDescription *)getTypeDescr(); }
     351             : 
     352       28437 :     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       28437 :         , _pParamInfos( 0 )
     358       28437 :         {}
     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       83226 : IdlInterfaceMethodImpl::~IdlInterfaceMethodImpl()
     383             : {
     384       27742 :     delete _pParamInfos;
     385       27742 :     delete _pParamTypes;
     386       27742 :     delete _pExceptionTypes;
     387       55484 : }
     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       48500 : void IdlInterfaceMethodImpl::acquire() throw()
     399             : {
     400       48500 :     IdlMemberImpl::acquire();
     401       48500 : }
     402             : //__________________________________________________________________________________________________
     403       47749 : void IdlInterfaceMethodImpl::release() throw()
     404             : {
     405       47749 :     IdlMemberImpl::release();
     406       47749 : }
     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      141180 : Reference< XIdlClass > IdlInterfaceMethodImpl::getDeclaringClass()
     447             :     throw(::com::sun::star::uno::RuntimeException)
     448             : {
     449      141180 :     if (! _xDeclClass.is())
     450             :     {
     451       28437 :         MutexGuard aGuard( getMutexAccess() );
     452       28437 :         if (! _xDeclClass.is())
     453             :         {
     454       28437 :             rtl::OUString aName(getMethodTypeDescr()->aBase.aBase.pTypeName);
     455       28437 :             sal_Int32 i = aName.indexOf(':');
     456             :             OSL_ASSERT(i >= 0);
     457       28437 :             _xDeclClass = getReflection()->forName(aName.copy(0, i));
     458       28437 :         }
     459             :     }
     460      141180 :     return _xDeclClass;
     461             : }
     462             : //__________________________________________________________________________________________________
     463       70507 : OUString IdlInterfaceMethodImpl::getName()
     464             :     throw(::com::sun::star::uno::RuntimeException)
     465             : {
     466       70507 :     return IdlMemberImpl::getName();
     467             : }
     468             : 
     469             : // XIdlMethod
     470             : //__________________________________________________________________________________________________
     471        4049 : Reference< XIdlClass > SAL_CALL IdlInterfaceMethodImpl::getReturnType()
     472             :     throw(::com::sun::star::uno::RuntimeException)
     473             : {
     474        4049 :     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        6943 : Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getParameterTypes()
     504             :     throw(::com::sun::star::uno::RuntimeException)
     505             : {
     506        6943 :     if (! _pParamTypes)
     507             :     {
     508        6943 :         MutexGuard aGuard( getMutexAccess() );
     509        6943 :         if (! _pParamTypes)
     510             :         {
     511        6943 :             sal_Int32 nParams = getMethodTypeDescr()->nParams;
     512             :             Sequence< Reference< XIdlClass > > * pTempParamTypes =
     513        6943 :                 new Sequence< Reference< XIdlClass > >( nParams );
     514        6943 :             Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
     515             : 
     516             :             typelib_MethodParameter * pTypelibParams =
     517        6943 :                 getMethodTypeDescr()->pParams;
     518        6943 :             IdlReflectionServiceImpl * pRefl = getReflection();
     519             : 
     520       19216 :             while (nParams--)
     521        5330 :                 pParamTypes[nParams] = pRefl->forType( pTypelibParams[nParams].pTypeRef );
     522             : 
     523        6943 :             _pParamTypes = pTempParamTypes;
     524        6943 :         }
     525             :     }
     526        6943 :     return *_pParamTypes;
     527             : }
     528             : //__________________________________________________________________________________________________
     529         327 : Sequence< ParamInfo > IdlInterfaceMethodImpl::getParameterInfos()
     530             :     throw(::com::sun::star::uno::RuntimeException)
     531             : {
     532         327 :     if (! _pParamInfos)
     533             :     {
     534         327 :         MutexGuard aGuard( getMutexAccess() );
     535         327 :         if (! _pParamInfos)
     536             :         {
     537         327 :             sal_Int32 nParams = getMethodTypeDescr()->nParams;
     538         327 :             Sequence< ParamInfo > * pTempParamInfos = new Sequence< ParamInfo >( nParams );
     539         327 :             ParamInfo * pParamInfos = pTempParamInfos->getArray();
     540             : 
     541             :             typelib_MethodParameter * pTypelibParams =
     542         327 :                 getMethodTypeDescr()->pParams;
     543             : 
     544         327 :             if (_pParamTypes) // use param types
     545             :             {
     546         327 :                 const Reference< XIdlClass > * pParamTypes = _pParamTypes->getConstArray();
     547             : 
     548        1746 :                 while (nParams--)
     549             :                 {
     550        1092 :                     const typelib_MethodParameter & rParam = pTypelibParams[nParams];
     551        1092 :                     ParamInfo & rInfo = pParamInfos[nParams];
     552        1092 :                     rInfo.aName = rParam.pName;
     553        1092 :                     if (rParam.bIn)
     554        1092 :                         rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
     555             :                     else
     556           0 :                         rInfo.aMode = ParamMode_OUT;
     557        1092 :                     rInfo.aType = pParamTypes[nParams];
     558             :                 }
     559             :             }
     560             :             else // make also param types sequence if not already initialized
     561             :             {
     562             :                 Sequence< Reference< XIdlClass > > * pTempParamTypes =
     563           0 :                     new Sequence< Reference< XIdlClass > >( nParams );
     564           0 :                 Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
     565             : 
     566           0 :                 IdlReflectionServiceImpl * pRefl = getReflection();
     567             : 
     568           0 :                 while (nParams--)
     569             :                 {
     570           0 :                     const typelib_MethodParameter & rParam = pTypelibParams[nParams];
     571           0 :                     ParamInfo & rInfo = pParamInfos[nParams];
     572           0 :                     rInfo.aName = rParam.pName;
     573           0 :                     if (rParam.bIn)
     574           0 :                         rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
     575             :                     else
     576           0 :                         rInfo.aMode = ParamMode_OUT;
     577           0 :                     rInfo.aType = pParamTypes[nParams] = pRefl->forType( rParam.pTypeRef );
     578             :                 }
     579             : 
     580           0 :                 _pParamTypes = pTempParamTypes;
     581             :             }
     582             : 
     583         327 :             _pParamInfos = pTempParamInfos;
     584         327 :         }
     585             :     }
     586         327 :     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           0 : 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           0 :     if (rObj.getValueTypeClass() == TypeClass_INTERFACE)
     602             :     {
     603             :         // acquire()/ release()
     604           0 :         if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
     605           0 :                                     "com.sun.star.uno.XInterface::acquire" ) == 0)
     606             :         {
     607           0 :             (*(const Reference< XInterface > *)rObj.getValue())->acquire();
     608           0 :             return Any();
     609             :         }
     610           0 :         else if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
     611           0 :                                          "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           0 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     620             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     621           0 :     if (pUnoI)
     622             :     {
     623           0 :         sal_Int32 nParams = getMethodTypeDescr()->nParams;
     624           0 :         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           0 :         Any * pCppArgs = rArgs.getArray();
     633           0 :         typelib_MethodParameter * pParams = getMethodTypeDescr()->pParams;
     634           0 :         typelib_TypeDescription * pReturnType = 0;
     635           0 :         TYPELIB_DANGER_GET(
     636             :             &pReturnType, getMethodTypeDescr()->pReturnTypeRef );
     637             : 
     638           0 :         void * pUnoReturn = alloca( pReturnType->nSize );
     639           0 :         void ** ppUnoArgs = (void **)alloca( sizeof(void *) * nParams *2 );
     640           0 :         typelib_TypeDescription ** ppParamTypes = (typelib_TypeDescription **)(ppUnoArgs + nParams);
     641             : 
     642             :         // convert arguments
     643           0 :         for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
     644             :         {
     645           0 :             ppParamTypes[nPos] = 0;
     646           0 :             TYPELIB_DANGER_GET( ppParamTypes + nPos, pParams[nPos].pTypeRef );
     647           0 :             typelib_TypeDescription * pTD = ppParamTypes[nPos];
     648             : 
     649           0 :             ppUnoArgs[nPos] = alloca( pTD->nSize );
     650           0 :             if (pParams[nPos].bIn)
     651             :             {
     652             :                 sal_Bool bAssign;
     653           0 :                 if (typelib_typedescriptionreference_equals(
     654           0 :                         pCppArgs[nPos].getValueTypeRef(), pTD->pWeakRef ))
     655             :                 {
     656             :                     uno_type_copyAndConvertData(
     657           0 :                         ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
     658           0 :                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
     659           0 :                     bAssign = sal_True;
     660             :                 }
     661           0 :                 else if (pTD->eTypeClass == typelib_TypeClass_ANY)
     662             :                 {
     663             :                     uno_type_any_constructAndConvert(
     664           0 :                         (uno_Any *)ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
     665           0 :                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
     666           0 :                     bAssign = sal_True;
     667             :                 }
     668           0 :                 else if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
     669             :                 {
     670           0 :                     Reference< XInterface > xDest;
     671             :                     bAssign = extract(
     672             :                         pCppArgs[nPos], (typelib_InterfaceTypeDescription *)pTD,
     673           0 :                         xDest, getReflection() );
     674           0 :                     if (bAssign)
     675             :                     {
     676           0 :                         *(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface(
     677           0 :                             xDest.get(), (typelib_InterfaceTypeDescription *)pTD );
     678           0 :                     }
     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           0 :                 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           0 :         uno_Any * pUnoExc = &aUnoExc;
     722             : 
     723             :         (*pUnoI->pDispatcher)(
     724           0 :             pUnoI, getTypeDescr(), pUnoReturn, ppUnoArgs, &pUnoExc );
     725           0 :         (*pUnoI->release)( pUnoI );
     726             : 
     727           0 :         Any aRet;
     728           0 :         if (pUnoExc)
     729             :         {
     730             :             // cleanup
     731           0 :             while (nParams--)
     732             :             {
     733           0 :                 if (pParams[nParams].bIn)
     734           0 :                     uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
     735           0 :                 TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
     736             :             }
     737           0 :             TYPELIB_DANGER_RELEASE( pReturnType );
     738             : 
     739           0 :             InvocationTargetException aExc;
     740           0 :             aExc.Context = *(const Reference< XInterface > *)rObj.getValue();
     741           0 :             aExc.Message = OUString( RTL_CONSTASCII_USTRINGPARAM("exception occurred during invocation!") );
     742             :             uno_any_destruct(
     743             :                 &aExc.TargetException,
     744           0 :                 reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     745             :             uno_type_copyAndConvertData(
     746           0 :                 &aExc.TargetException, pUnoExc, ::getCppuType( (const Any *)0 ).getTypeLibType(),
     747           0 :                 getReflection()->getUno2Cpp().get() );
     748           0 :             uno_any_destruct( pUnoExc, 0 );
     749           0 :             throw aExc;
     750             :         }
     751             :         else
     752             :         {
     753             :             // reconvert arguments and cleanup
     754           0 :             while (nParams--)
     755             :             {
     756           0 :                 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           0 :                 uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
     766           0 :                 TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
     767             :             }
     768             :             uno_any_destruct(
     769           0 :                 &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     770             :             uno_any_constructAndConvert(
     771             :                 &aRet, pUnoReturn, pReturnType,
     772           0 :                 getReflection()->getUno2Cpp().get() );
     773           0 :             uno_destructData( pUnoReturn, pReturnType, 0 );
     774           0 :             TYPELIB_DANGER_RELEASE( pReturnType );
     775             :         }
     776           0 :         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        2688 : InterfaceIdlClassImpl::~InterfaceIdlClassImpl()
     791             : {
     792        1858 :     for ( sal_Int32 nPos = _nMethods + _nAttributes; nPos--; )
     793          66 :         typelib_typedescription_release( _pSortedMemberInit[nPos].second );
     794             : 
     795         896 :     delete [] _pSortedMemberInit;
     796        1792 : }
     797             : 
     798             : //__________________________________________________________________________________________________
     799        8782 : Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses()
     800             :     throw(::com::sun::star::uno::RuntimeException)
     801             : {
     802        8782 :     MutexGuard aGuard(getMutexAccess());
     803        8782 :     if (_xSuperClasses.getLength() == 0) {
     804        4589 :         typelib_InterfaceTypeDescription * pType = getTypeDescr();
     805        4589 :         _xSuperClasses.realloc(pType->nBaseTypes);
     806        5633 :         for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) {
     807        1044 :             _xSuperClasses[i] = getReflection()->forType(
     808        2088 :                 &pType->ppBaseTypes[i]->aBase);
     809             :             OSL_ASSERT(_xSuperClasses[i].is());
     810             :         }
     811             :     }
     812        8782 :     return Sequence< Reference< XIdlClass > >(_xSuperClasses);
     813             : }
     814             : //__________________________________________________________________________________________________
     815         925 : void InterfaceIdlClassImpl::initMembers()
     816             : {
     817         925 :     sal_Int32 nAll = getTypeDescr()->nAllMembers;
     818         925 :     MemberInit * pSortedMemberInit = new MemberInit[nAll];
     819         925 :     typelib_TypeDescriptionReference ** ppAllMembers = getTypeDescr()->ppAllMembers;
     820             : 
     821        7406 :     for ( sal_Int32 nPos = 0; nPos < nAll; ++nPos )
     822             :     {
     823             :         sal_Int32 nIndex;
     824        6481 :         if (ppAllMembers[nPos]->eTypeClass == typelib_TypeClass_INTERFACE_METHOD)
     825             :         {
     826             :             // methods to front
     827        6253 :             nIndex = _nMethods;
     828        6253 :             ++_nMethods;
     829             :         }
     830             :         else
     831             :         {
     832         228 :             ++_nAttributes;
     833         228 :             nIndex = (nAll - _nAttributes);
     834             :             // attributes at the back
     835             :         }
     836             : 
     837        6481 :         typelib_TypeDescription * pTD = 0;
     838        6481 :         typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] );
     839             :         OSL_ENSURE( pTD, "### cannot get type description!" );
     840        6481 :         pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName;
     841        6481 :         pSortedMemberInit[nIndex].second = pTD;
     842             :     }
     843             : 
     844         925 :     _pSortedMemberInit = pSortedMemberInit;
     845         925 : }
     846             : //__________________________________________________________________________________________________
     847           0 : sal_Bool InterfaceIdlClassImpl::isAssignableFrom( const Reference< XIdlClass > & xType )
     848             :     throw(::com::sun::star::uno::RuntimeException)
     849             : {
     850           0 :     if (xType.is() && xType->getTypeClass() == TypeClass_INTERFACE)
     851             :     {
     852           0 :         if (equals( xType ))
     853           0 :             return sal_True;
     854             :         else
     855             :         {
     856           0 :             const Sequence< Reference< XIdlClass > > & rSeq = xType->getSuperclasses();
     857           0 :             for (sal_Int32 i = 0; i < rSeq.getLength(); ++i) {
     858           0 :                 if (isAssignableFrom(rSeq[i])) {
     859           0 :                     return true;
     860             :                 }
     861           0 :             }
     862             :         }
     863             :     }
     864           0 :     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        4413 : Sequence< Reference< XIdlMethod > > InterfaceIdlClassImpl::getMethods()
     875             :     throw(::com::sun::star::uno::RuntimeException)
     876             : {
     877        4413 :     MutexGuard aGuard( getMutexAccess() );
     878        4413 :     if (! _pSortedMemberInit)
     879           0 :         initMembers();
     880             : 
     881             :     // create methods sequence
     882        4413 :     Sequence< Reference< XIdlMethod > > aRet( _nMethods );
     883        4413 :     Reference< XIdlMethod > * pRet = aRet.getArray();
     884       37263 :     for ( sal_Int32 nPos = _nMethods; nPos--; )
     885             :     {
     886             : 
     887             :         /*_aName2Method[_pSortedMemberInit[nPos].first] = */pRet[nPos] = new IdlInterfaceMethodImpl(
     888       56874 :             getReflection(), _pSortedMemberInit[nPos].first,
     889       56874 :             _pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
     890             :     }
     891        4413 :     return aRet;
     892             : }
     893             : //__________________________________________________________________________________________________
     894        4413 : Sequence< Reference< XIdlField > > InterfaceIdlClassImpl::getFields()
     895             :     throw(::com::sun::star::uno::RuntimeException)
     896             : {
     897        4413 :     MutexGuard aGuard( getMutexAccess() );
     898        4413 :     if (! _pSortedMemberInit)
     899         919 :         initMembers();
     900             : 
     901             :     // create fields sequence
     902        4413 :     Sequence< Reference< XIdlField > > aRet( _nAttributes );
     903        4413 :     Reference< XIdlField > * pRet = aRet.getArray();
     904       10030 :     for ( sal_Int32 nPos = _nAttributes; nPos--; )
     905             :     {
     906             :         /*_aName2Field[_pSortedMemberInit[_nMethods+nPos].first] = */pRet[_nAttributes-nPos-1] =
     907             :             new IdlAttributeFieldImpl(
     908        2408 :                 getReflection(), _pSortedMemberInit[_nMethods+nPos].first,
     909        2408 :                 _pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
     910             :     }
     911        4413 :     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          18 : Reference< XIdlField > InterfaceIdlClassImpl::getField( const OUString & rName )
     945             :     throw(::com::sun::star::uno::RuntimeException)
     946             : {
     947          18 :     MutexGuard aGuard( getMutexAccess() );
     948          18 :     if (! _pSortedMemberInit)
     949           6 :         initMembers();
     950             : 
     951          18 :     Reference< XIdlField > xRet;
     952             : 
     953             :     // try weak map
     954          18 :     const OUString2Field::const_iterator iFind( _aName2Field.find( rName ) );
     955          18 :     if (iFind != _aName2Field.end())
     956           6 :         xRet = (*iFind).second; // harden ref
     957             : 
     958          18 :     if (! xRet.is())
     959             :     {
     960          30 :         for ( sal_Int32 nPos = _nAttributes; nPos--; )
     961             :         {
     962          18 :             if (_pSortedMemberInit[_nMethods+nPos].first == rName)
     963             :             {
     964          12 :                 _aName2Field[rName] = xRet = new IdlAttributeFieldImpl(
     965          12 :                     getReflection(), rName,
     966          24 :                     _pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
     967          12 :                 break;
     968             :             }
     969             :         }
     970             :     }
     971          18 :     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