LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/stoc/source/corereflection - criface.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 326 426 76.5 %
Date: 2013-07-09 Functions: 36 45 80.0 %
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        3340 : class IdlAttributeFieldImpl
      43             :     : public IdlMemberImpl
      44             :     , public XIdlField
      45             :     , public XIdlField2
      46             : {
      47             : public:
      48        6393 :     typelib_InterfaceAttributeTypeDescription * getAttributeTypeDescr()
      49        6393 :         { return (typelib_InterfaceAttributeTypeDescription *)getTypeDescr(); }
      50             : 
      51        2103 :     IdlAttributeFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
      52             :                            typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
      53        2103 :         : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
      54        2103 :         {}
      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         824 : 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         824 :                                       static_cast< XIdlField2 * >( this ) ) );
      89         824 :     return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
      90             : }
      91             : //__________________________________________________________________________________________________
      92        8809 : void IdlAttributeFieldImpl::acquire() throw()
      93             : {
      94        8809 :     IdlMemberImpl::acquire();
      95        8809 : }
      96             : //__________________________________________________________________________________________________
      97        8376 : void IdlAttributeFieldImpl::release() throw()
      98             : {
      99        8376 :     IdlMemberImpl::release();
     100        8376 : }
     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 :             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        1983 : OUString IdlAttributeFieldImpl::getName()
     159             :     throw(::com::sun::star::uno::RuntimeException)
     160             : {
     161        1983 :     return IdlMemberImpl::getName();
     162             : }
     163             : 
     164             : // XIdlField
     165             : //__________________________________________________________________________________________________
     166        2043 : Reference< XIdlClass > IdlAttributeFieldImpl::getType()
     167             :     throw(::com::sun::star::uno::RuntimeException)
     168             : {
     169             :     return getReflection()->forType(
     170        2043 :         getAttributeTypeDescr()->pAttributeTypeRef );
     171             : }
     172             : //__________________________________________________________________________________________________
     173        1983 : FieldAccessMode IdlAttributeFieldImpl::getAccessMode()
     174             :     throw(::com::sun::star::uno::RuntimeException)
     175             : {
     176        1983 :     return (((typelib_InterfaceAttributeTypeDescription *)getAttributeTypeDescr())->bReadOnly
     177        1983 :             ? FieldAccessMode_READONLY : FieldAccessMode_READWRITE);
     178             : }
     179             : //__________________________________________________________________________________________________
     180        1319 : 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        1319 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     185             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     186        1319 :     if (pUnoI)
     187             :     {
     188        1319 :         TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
     189        1319 :         typelib_TypeDescription * pTD = aTD.get();
     190             : 
     191             :         uno_Any aExc;
     192        1319 :         uno_Any * pExc = &aExc;
     193        1319 :         void * pReturn = alloca( pTD->nSize );
     194             : 
     195        1319 :         (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), pReturn, 0, &pExc );
     196        1319 :         (*pUnoI->release)( pUnoI );
     197             : 
     198             :         checkException(
     199             :             pExc,
     200        1319 :             *static_cast< Reference< XInterface > const * >(rObj.getValue()));
     201        2638 :         Any aRet;
     202             :         uno_any_destruct(
     203        1319 :             &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     204        1319 :         uno_any_constructAndConvert( &aRet, pReturn, pTD, getReflection()->getUno2Cpp().get() );
     205        1319 :         uno_destructData( pReturn, pTD, 0 );
     206        3957 :         return aRet;
     207             :     }
     208             :     throw IllegalArgumentException(
     209             :         OUString("illegal object given!"),
     210           0 :         (XWeak *)(OWeakObject *)this, 0 );
     211             : }
     212             : //__________________________________________________________________________________________________
     213         524 : 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         524 :     if (getAttributeTypeDescr()->bReadOnly)
     217             :     {
     218             :         throw IllegalAccessException(
     219             :             OUString("cannot set readonly attribute!"),
     220           0 :             (XWeak *)(OWeakObject *)this );
     221             :     }
     222             : 
     223             :     uno_Interface * pUnoI = getReflection()->mapToUno(
     224         524 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     225             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     226         524 :     if (pUnoI)
     227             :     {
     228         524 :         TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
     229         524 :         typelib_TypeDescription * pTD = aTD.get();
     230             : 
     231             :         // construct uno value to be set
     232             :         void * pArgs[1];
     233         524 :         void * pArg = pArgs[0] = alloca( pTD->nSize );
     234             : 
     235             :         sal_Bool bAssign;
     236         524 :         if (pTD->eTypeClass == typelib_TypeClass_ANY)
     237             :         {
     238             :             uno_copyAndConvertData( pArg, (const_cast< Any * >(&rValue)),
     239         311 :                                     pTD, getReflection()->getCpp2Uno().get() );
     240         311 :             bAssign = sal_True;
     241             :         }
     242         213 :         else if (typelib_typedescriptionreference_equals( rValue.getValueTypeRef(), pTD->pWeakRef ))
     243             :         {
     244         213 :             uno_copyAndConvertData( pArg, (const_cast< void * >(rValue.getValue()) ),
     245         426 :                                     pTD, getReflection()->getCpp2Uno().get() );
     246         213 :             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         524 :         if (bAssign)
     279             :         {
     280             :             uno_Any aExc;
     281         524 :             uno_Any * pExc = &aExc;
     282         524 :             (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), 0, pArgs, &pExc );
     283         524 :             (*pUnoI->release)( pUnoI );
     284             : 
     285         524 :             uno_destructData( pArg, pTD, 0 );
     286             :             checkException(
     287             :                 pExc,
     288             :                 *static_cast< Reference< XInterface > const * >(
     289         524 :                     rObj.getValue()));
     290        1048 :             return;
     291             :         }
     292           0 :         (*pUnoI->release)( pUnoI );
     293             : 
     294             :         throw IllegalArgumentException(
     295             :             OUString("illegal value given!"),
     296         524 :             *(const Reference< XInterface > *)rObj.getValue(), 1 );
     297             :     }
     298             :     throw IllegalArgumentException(
     299             :         OUString("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        1843 : void IdlAttributeFieldImpl::checkException(
     310             :     uno_Any * exception, Reference< XInterface > const & context)
     311             : {
     312        1843 :     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             :                         "non-RuntimeException occurred when accessing an"
     327             :                         " interface type attribute"),
     328           0 :                 context, e);
     329           0 :         }
     330             :     }
     331        1843 : }
     332             : 
     333             : //##################################################################################################
     334             : //##################################################################################################
     335             : //##################################################################################################
     336             : 
     337             : 
     338             : //==================================================================================================
     339             : class IdlInterfaceMethodImpl
     340             :     : public IdlMemberImpl
     341             :     , public XIdlMethod
     342             : {
     343             :     Sequence< Reference< XIdlClass > > * _pExceptionTypes;
     344             :     Sequence< Reference< XIdlClass > > * _pParamTypes;
     345             :     Sequence< ParamInfo > *              _pParamInfos;
     346             : 
     347             : public:
     348      115061 :     typelib_InterfaceMethodTypeDescription * getMethodTypeDescr()
     349      115061 :         { return (typelib_InterfaceMethodTypeDescription *)getTypeDescr(); }
     350             : 
     351       61729 :     IdlInterfaceMethodImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
     352             :                             typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
     353             :         : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
     354             :         , _pExceptionTypes( 0 )
     355             :         , _pParamTypes( 0 )
     356       61729 :         , _pParamInfos( 0 )
     357       61729 :         {}
     358             :     virtual ~IdlInterfaceMethodImpl();
     359             : 
     360             :     // XInterface
     361             :     virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
     362             :     virtual void SAL_CALL acquire() throw();
     363             :     virtual void SAL_CALL release() throw();
     364             : 
     365             :     // XTypeProvider
     366             :     virtual Sequence< Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
     367             :     virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
     368             : 
     369             :     // XIdlMember
     370             :     virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() throw(::com::sun::star::uno::RuntimeException);
     371             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
     372             :     // XIdlMethod
     373             :     virtual Reference< XIdlClass > SAL_CALL getReturnType() throw(::com::sun::star::uno::RuntimeException);
     374             :     virtual Sequence< Reference< XIdlClass > > SAL_CALL getParameterTypes() throw(::com::sun::star::uno::RuntimeException);
     375             :     virtual Sequence< ParamInfo > SAL_CALL getParameterInfos() throw(::com::sun::star::uno::RuntimeException);
     376             :     virtual Sequence< Reference< XIdlClass > > SAL_CALL getExceptionTypes() throw(::com::sun::star::uno::RuntimeException);
     377             :     virtual MethodMode SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException);
     378             :     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);
     379             : };
     380             : //__________________________________________________________________________________________________
     381      170790 : IdlInterfaceMethodImpl::~IdlInterfaceMethodImpl()
     382             : {
     383       56930 :     delete _pParamInfos;
     384       56930 :     delete _pParamTypes;
     385       56930 :     delete _pExceptionTypes;
     386      113860 : }
     387             : 
     388             : // XInterface
     389             : //__________________________________________________________________________________________________
     390          19 : Any IdlInterfaceMethodImpl::queryInterface( const Type & rType )
     391             :     throw(::com::sun::star::uno::RuntimeException)
     392             : {
     393          19 :     Any aRet( ::cppu::queryInterface( rType, static_cast< XIdlMethod * >( this ) ) );
     394          19 :     return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
     395             : }
     396             : //__________________________________________________________________________________________________
     397      112543 : void IdlInterfaceMethodImpl::acquire() throw()
     398             : {
     399      112543 :     IdlMemberImpl::acquire();
     400      112543 : }
     401             : //__________________________________________________________________________________________________
     402      106434 : void IdlInterfaceMethodImpl::release() throw()
     403             : {
     404      106434 :     IdlMemberImpl::release();
     405      106434 : }
     406             : 
     407             : // XTypeProvider
     408             : //__________________________________________________________________________________________________
     409           0 : Sequence< Type > IdlInterfaceMethodImpl::getTypes()
     410             :     throw (::com::sun::star::uno::RuntimeException)
     411             : {
     412             :     static OTypeCollection * s_pTypes = 0;
     413           0 :     if (! s_pTypes)
     414             :     {
     415           0 :         MutexGuard aGuard( getMutexAccess() );
     416           0 :         if (! s_pTypes)
     417             :         {
     418             :             static OTypeCollection s_aTypes(
     419           0 :                 ::getCppuType( (const Reference< XIdlMethod > *)0 ),
     420           0 :                 IdlMemberImpl::getTypes() );
     421           0 :             s_pTypes = &s_aTypes;
     422           0 :         }
     423             :     }
     424           0 :     return s_pTypes->getTypes();
     425             : }
     426             : //__________________________________________________________________________________________________
     427           0 : Sequence< sal_Int8 > IdlInterfaceMethodImpl::getImplementationId()
     428             :     throw (::com::sun::star::uno::RuntimeException)
     429             : {
     430             :     static OImplementationId * s_pId = 0;
     431           0 :     if (! s_pId)
     432             :     {
     433           0 :         MutexGuard aGuard( getMutexAccess() );
     434           0 :         if (! s_pId)
     435             :         {
     436           0 :             static OImplementationId s_aId;
     437           0 :             s_pId = &s_aId;
     438           0 :         }
     439             :     }
     440           0 :     return s_pId->getImplementationId();
     441             : }
     442             : 
     443             : // XIdlMember
     444             : //__________________________________________________________________________________________________
     445      297489 : Reference< XIdlClass > IdlInterfaceMethodImpl::getDeclaringClass()
     446             :     throw(::com::sun::star::uno::RuntimeException)
     447             : {
     448      297489 :     if (! _xDeclClass.is())
     449             :     {
     450       61710 :         MutexGuard aGuard( getMutexAccess() );
     451       61710 :         if (! _xDeclClass.is())
     452             :         {
     453       61710 :             OUString aName(getMethodTypeDescr()->aBase.aBase.pTypeName);
     454       61710 :             sal_Int32 i = aName.indexOf(':');
     455             :             OSL_ASSERT(i >= 0);
     456       61710 :             _xDeclClass = getReflection()->forName(aName.copy(0, i));
     457       61710 :         }
     458             :     }
     459      297489 :     return _xDeclClass;
     460             : }
     461             : //__________________________________________________________________________________________________
     462      160785 : OUString IdlInterfaceMethodImpl::getName()
     463             :     throw(::com::sun::star::uno::RuntimeException)
     464             : {
     465      160785 :     return IdlMemberImpl::getName();
     466             : }
     467             : 
     468             : // XIdlMethod
     469             : //__________________________________________________________________________________________________
     470       10849 : Reference< XIdlClass > SAL_CALL IdlInterfaceMethodImpl::getReturnType()
     471             :     throw(::com::sun::star::uno::RuntimeException)
     472             : {
     473       10849 :     return getReflection()->forType( getMethodTypeDescr()->pReturnTypeRef );
     474             : }
     475             : //__________________________________________________________________________________________________
     476          19 : Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getExceptionTypes()
     477             :     throw(::com::sun::star::uno::RuntimeException)
     478             : {
     479          19 :     if (! _pExceptionTypes)
     480             :     {
     481          19 :         MutexGuard aGuard( getMutexAccess() );
     482          19 :         if (! _pExceptionTypes)
     483             :         {
     484          19 :             sal_Int32 nExc = getMethodTypeDescr()->nExceptions;
     485             :             Sequence< Reference< XIdlClass > > * pTempExceptionTypes =
     486          19 :                 new Sequence< Reference< XIdlClass > >( nExc );
     487          19 :             Reference< XIdlClass > * pExceptionTypes = pTempExceptionTypes->getArray();
     488             : 
     489             :             typelib_TypeDescriptionReference ** ppExc =
     490          19 :                 getMethodTypeDescr()->ppExceptions;
     491          19 :             IdlReflectionServiceImpl * pRefl = getReflection();
     492             : 
     493          50 :             while (nExc--)
     494          12 :                 pExceptionTypes[nExc] = pRefl->forType( ppExc[nExc] );
     495             : 
     496          19 :             _pExceptionTypes = pTempExceptionTypes;
     497          19 :         }
     498             :     }
     499          19 :     return *_pExceptionTypes;
     500             : }
     501             : //__________________________________________________________________________________________________
     502       16091 : Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getParameterTypes()
     503             :     throw(::com::sun::star::uno::RuntimeException)
     504             : {
     505       16091 :     if (! _pParamTypes)
     506             :     {
     507       15963 :         MutexGuard aGuard( getMutexAccess() );
     508       15963 :         if (! _pParamTypes)
     509             :         {
     510       15963 :             sal_Int32 nParams = getMethodTypeDescr()->nParams;
     511             :             Sequence< Reference< XIdlClass > > * pTempParamTypes =
     512       15963 :                 new Sequence< Reference< XIdlClass > >( nParams );
     513       15963 :             Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
     514             : 
     515             :             typelib_MethodParameter * pTypelibParams =
     516       15963 :                 getMethodTypeDescr()->pParams;
     517       15963 :             IdlReflectionServiceImpl * pRefl = getReflection();
     518             : 
     519       44772 :             while (nParams--)
     520       12846 :                 pParamTypes[nParams] = pRefl->forType( pTypelibParams[nParams].pTypeRef );
     521             : 
     522       15963 :             _pParamTypes = pTempParamTypes;
     523       15963 :         }
     524             :     }
     525       16091 :     return *_pParamTypes;
     526             : }
     527             : //__________________________________________________________________________________________________
     528        2175 : Sequence< ParamInfo > IdlInterfaceMethodImpl::getParameterInfos()
     529             :     throw(::com::sun::star::uno::RuntimeException)
     530             : {
     531        2175 :     if (! _pParamInfos)
     532             :     {
     533        1243 :         MutexGuard aGuard( getMutexAccess() );
     534        1243 :         if (! _pParamInfos)
     535             :         {
     536        1243 :             sal_Int32 nParams = getMethodTypeDescr()->nParams;
     537        1243 :             Sequence< ParamInfo > * pTempParamInfos = new Sequence< ParamInfo >( nParams );
     538        1243 :             ParamInfo * pParamInfos = pTempParamInfos->getArray();
     539             : 
     540             :             typelib_MethodParameter * pTypelibParams =
     541        1243 :                 getMethodTypeDescr()->pParams;
     542             : 
     543        1243 :             if (_pParamTypes) // use param types
     544             :             {
     545        1044 :                 const Reference< XIdlClass > * pParamTypes = _pParamTypes->getConstArray();
     546             : 
     547        5556 :                 while (nParams--)
     548             :                 {
     549        3468 :                     const typelib_MethodParameter & rParam = pTypelibParams[nParams];
     550        3468 :                     ParamInfo & rInfo = pParamInfos[nParams];
     551        3468 :                     rInfo.aName = rParam.pName;
     552        3468 :                     if (rParam.bIn)
     553        3468 :                         rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
     554             :                     else
     555           0 :                         rInfo.aMode = ParamMode_OUT;
     556        3468 :                     rInfo.aType = pParamTypes[nParams];
     557             :                 }
     558             :             }
     559             :             else // make also param types sequence if not already initialized
     560             :             {
     561             :                 Sequence< Reference< XIdlClass > > * pTempParamTypes =
     562         199 :                     new Sequence< Reference< XIdlClass > >( nParams );
     563         199 :                 Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
     564             : 
     565         199 :                 IdlReflectionServiceImpl * pRefl = getReflection();
     566             : 
     567         704 :                 while (nParams--)
     568             :                 {
     569         306 :                     const typelib_MethodParameter & rParam = pTypelibParams[nParams];
     570         306 :                     ParamInfo & rInfo = pParamInfos[nParams];
     571         306 :                     rInfo.aName = rParam.pName;
     572         306 :                     if (rParam.bIn)
     573         306 :                         rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
     574             :                     else
     575           0 :                         rInfo.aMode = ParamMode_OUT;
     576         306 :                     rInfo.aType = pParamTypes[nParams] = pRefl->forType( rParam.pTypeRef );
     577             :                 }
     578             : 
     579         199 :                 _pParamTypes = pTempParamTypes;
     580             :             }
     581             : 
     582        1243 :             _pParamInfos = pTempParamInfos;
     583        1243 :         }
     584             :     }
     585        2175 :     return *_pParamInfos;
     586             : }
     587             : //__________________________________________________________________________________________________
     588           0 : MethodMode SAL_CALL IdlInterfaceMethodImpl::getMode()
     589             :     throw(::com::sun::star::uno::RuntimeException)
     590             : {
     591             :     return
     592           0 :         getMethodTypeDescr()->bOneWay ? MethodMode_ONEWAY : MethodMode_TWOWAY;
     593             : }
     594             : //__________________________________________________________________________________________________
     595        2684 : Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & rArgs )
     596             :     throw(::com::sun::star::lang::IllegalArgumentException,
     597             :           ::com::sun::star::reflection::InvocationTargetException,
     598             :           ::com::sun::star::uno::RuntimeException)
     599             : {
     600        2684 :     if (rObj.getValueTypeClass() == TypeClass_INTERFACE)
     601             :     {
     602             :         // acquire()/ release()
     603        5368 :         if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
     604        2684 :                                     "com.sun.star.uno.XInterface::acquire" ) == 0)
     605             :         {
     606           0 :             (*(const Reference< XInterface > *)rObj.getValue())->acquire();
     607           0 :             return Any();
     608             :         }
     609        5368 :         else if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
     610        2684 :                                          "com.sun.star.uno.XInterface::release" ) == 0)
     611             :         {
     612           0 :             (*(const Reference< XInterface > *)rObj.getValue())->release();
     613           0 :             return Any();
     614             :         }
     615             :     }
     616             : 
     617             :     uno_Interface * pUnoI = getReflection()->mapToUno(
     618        2684 :         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
     619             :     OSL_ENSURE( pUnoI, "### illegal destination object given!" );
     620        2684 :     if (pUnoI)
     621             :     {
     622        2684 :         sal_Int32 nParams = getMethodTypeDescr()->nParams;
     623        2684 :         if (rArgs.getLength() != nParams)
     624             :         {
     625           0 :             (*pUnoI->release)( pUnoI );
     626             :             throw IllegalArgumentException(
     627             :                 OUString("arguments len differ!"),
     628           0 :                 *(const Reference< XInterface > *)rObj.getValue(), 1 );
     629             :         }
     630             : 
     631        2684 :         Any * pCppArgs = rArgs.getArray();
     632        2684 :         typelib_MethodParameter * pParams = getMethodTypeDescr()->pParams;
     633        2684 :         typelib_TypeDescription * pReturnType = 0;
     634             :         TYPELIB_DANGER_GET(
     635        2684 :             &pReturnType, getMethodTypeDescr()->pReturnTypeRef );
     636             : 
     637        2684 :         void * pUnoReturn = alloca( pReturnType->nSize );
     638        2684 :         void ** ppUnoArgs = (void **)alloca( sizeof(void *) * nParams *2 );
     639        2684 :         typelib_TypeDescription ** ppParamTypes = (typelib_TypeDescription **)(ppUnoArgs + nParams);
     640             : 
     641             :         // convert arguments
     642        7328 :         for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
     643             :         {
     644        4644 :             ppParamTypes[nPos] = 0;
     645        4644 :             TYPELIB_DANGER_GET( ppParamTypes + nPos, pParams[nPos].pTypeRef );
     646        4644 :             typelib_TypeDescription * pTD = ppParamTypes[nPos];
     647             : 
     648        4644 :             ppUnoArgs[nPos] = alloca( pTD->nSize );
     649        4644 :             if (pParams[nPos].bIn)
     650             :             {
     651             :                 sal_Bool bAssign;
     652        4644 :                 if (typelib_typedescriptionreference_equals(
     653        4644 :                         pCppArgs[nPos].getValueTypeRef(), pTD->pWeakRef ))
     654             :                 {
     655             :                     uno_type_copyAndConvertData(
     656         405 :                         ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
     657         810 :                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
     658         405 :                     bAssign = sal_True;
     659             :                 }
     660        4239 :                 else if (pTD->eTypeClass == typelib_TypeClass_ANY)
     661             :                 {
     662             :                     uno_type_any_constructAndConvert(
     663        4096 :                         (uno_Any *)ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
     664        8192 :                         pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
     665        4096 :                     bAssign = sal_True;
     666             :                 }
     667         143 :                 else if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
     668             :                 {
     669         132 :                     Reference< XInterface > xDest;
     670             :                     bAssign = extract(
     671             :                         pCppArgs[nPos], (typelib_InterfaceTypeDescription *)pTD,
     672         132 :                         xDest, getReflection() );
     673         132 :                     if (bAssign)
     674             :                     {
     675         264 :                         *(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface(
     676         264 :                             xDest.get(), (typelib_InterfaceTypeDescription *)pTD );
     677         132 :                     }
     678             :                 }
     679             :                 else
     680             :                 {
     681          11 :                     typelib_TypeDescription * pValueTD = 0;
     682          11 :                     TYPELIB_DANGER_GET( &pValueTD, pCppArgs[nPos].getValueTypeRef() );
     683             :                     // construct temp uno val to do proper assignment: todo opt
     684          11 :                     void * pTemp = alloca( pValueTD->nSize );
     685             :                     uno_copyAndConvertData(
     686          11 :                         pTemp, (void *)pCppArgs[nPos].getValue(), pValueTD,
     687          22 :                         getReflection()->getCpp2Uno().get() );
     688             :                     uno_constructData(
     689          11 :                         ppUnoArgs[nPos], pTD );
     690             :                     // assignment does simple conversion
     691             :                     bAssign = uno_assignData(
     692          11 :                         ppUnoArgs[nPos], pTD, pTemp, pValueTD, 0, 0, 0 );
     693             :                     uno_destructData(
     694          11 :                         pTemp, pValueTD, 0 );
     695          11 :                     TYPELIB_DANGER_RELEASE( pValueTD );
     696             :                 }
     697             : 
     698        4644 :                 if (! bAssign)
     699             :                 {
     700             :                     IllegalArgumentException aExc(
     701             :                         OUString("cannot coerce argument type during corereflection call!"),
     702           0 :                         *(const Reference< XInterface > *)rObj.getValue(), (sal_Int16)nPos );
     703             : 
     704             :                     // cleanup
     705           0 :                     while (nPos--)
     706             :                     {
     707           0 :                         if (pParams[nPos].bIn)
     708           0 :                             uno_destructData( ppUnoArgs[nPos], ppParamTypes[nPos], 0 );
     709           0 :                         TYPELIB_DANGER_RELEASE( ppParamTypes[nPos] );
     710             :                     }
     711           0 :                     TYPELIB_DANGER_RELEASE( pReturnType );
     712           0 :                     (*pUnoI->release)( pUnoI );
     713             : 
     714           0 :                     throw aExc;
     715             :                 }
     716             :             }
     717             :         }
     718             : 
     719             :         uno_Any aUnoExc;
     720        2684 :         uno_Any * pUnoExc = &aUnoExc;
     721             : 
     722             :         (*pUnoI->pDispatcher)(
     723        2684 :             pUnoI, getTypeDescr(), pUnoReturn, ppUnoArgs, &pUnoExc );
     724        2684 :         (*pUnoI->release)( pUnoI );
     725             : 
     726        2684 :         Any aRet;
     727        2684 :         if (pUnoExc)
     728             :         {
     729             :             // cleanup
     730          16 :             while (nParams--)
     731             :             {
     732           8 :                 if (pParams[nParams].bIn)
     733           8 :                     uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
     734           8 :                 TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
     735             :             }
     736           4 :             TYPELIB_DANGER_RELEASE( pReturnType );
     737             : 
     738           4 :             InvocationTargetException aExc;
     739           4 :             aExc.Context = *(const Reference< XInterface > *)rObj.getValue();
     740           4 :             aExc.Message = OUString("exception occurred during invocation!");
     741             :             uno_any_destruct(
     742             :                 &aExc.TargetException,
     743           4 :                 reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     744             :             uno_type_copyAndConvertData(
     745           4 :                 &aExc.TargetException, pUnoExc, ::getCppuType( (const Any *)0 ).getTypeLibType(),
     746           8 :                 getReflection()->getUno2Cpp().get() );
     747           4 :             uno_any_destruct( pUnoExc, 0 );
     748           4 :             throw aExc;
     749             :         }
     750             :         else
     751             :         {
     752             :             // reconvert arguments and cleanup
     753        9996 :             while (nParams--)
     754             :             {
     755        4636 :                 if (pParams[nParams].bOut) // write back
     756             :                 {
     757             :                     uno_any_destruct(
     758           8 :                         &pCppArgs[nParams],
     759          16 :                         reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     760             :                     uno_any_constructAndConvert(
     761          24 :                         &pCppArgs[nParams], ppUnoArgs[nParams], ppParamTypes[nParams],
     762          32 :                         getReflection()->getUno2Cpp().get() );
     763             :                 }
     764        4636 :                 uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
     765        4636 :                 TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
     766             :             }
     767             :             uno_any_destruct(
     768        2680 :                 &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
     769             :             uno_any_constructAndConvert(
     770             :                 &aRet, pUnoReturn, pReturnType,
     771        2680 :                 getReflection()->getUno2Cpp().get() );
     772        2680 :             uno_destructData( pUnoReturn, pReturnType, 0 );
     773        2680 :             TYPELIB_DANGER_RELEASE( pReturnType );
     774             :         }
     775        2684 :         return aRet;
     776             :     }
     777             :     throw IllegalArgumentException(
     778             :         OUString("illegal destination object given!"),
     779           0 :         (XWeak *)(OWeakObject *)this, 0 );
     780             : }
     781             : 
     782             : 
     783             : //##################################################################################################
     784             : //##################################################################################################
     785             : //##################################################################################################
     786             : 
     787             : 
     788             : //__________________________________________________________________________________________________
     789       13911 : InterfaceIdlClassImpl::~InterfaceIdlClassImpl()
     790             : {
     791       11071 :     for ( sal_Int32 nPos = _nMethods + _nAttributes; nPos--; )
     792        1797 :         typelib_typedescription_release( _pSortedMemberInit[nPos].second );
     793             : 
     794        4637 :     delete [] _pSortedMemberInit;
     795        9274 : }
     796             : 
     797             : //__________________________________________________________________________________________________
     798       22049 : Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses()
     799             :     throw(::com::sun::star::uno::RuntimeException)
     800             : {
     801       22049 :     MutexGuard aGuard(getMutexAccess());
     802       22049 :     if (_xSuperClasses.getLength() == 0) {
     803       14872 :         typelib_InterfaceTypeDescription * pType = getTypeDescr();
     804       14872 :         _xSuperClasses.realloc(pType->nBaseTypes);
     805       20555 :         for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) {
     806       11366 :             _xSuperClasses[i] = getReflection()->forType(
     807       11366 :                 &pType->ppBaseTypes[i]->aBase);
     808             :             OSL_ASSERT(_xSuperClasses[i].is());
     809             :         }
     810             :     }
     811       22049 :     return Sequence< Reference< XIdlClass > >(_xSuperClasses);
     812             : }
     813             : //__________________________________________________________________________________________________
     814        5009 : void InterfaceIdlClassImpl::initMembers()
     815             : {
     816        5009 :     sal_Int32 nAll = getTypeDescr()->nAllMembers;
     817        5009 :     MemberInit * pSortedMemberInit = new MemberInit[nAll];
     818        5009 :     typelib_TypeDescriptionReference ** ppAllMembers = getTypeDescr()->ppAllMembers;
     819             : 
     820       39573 :     for ( sal_Int32 nPos = 0; nPos < nAll; ++nPos )
     821             :     {
     822             :         sal_Int32 nIndex;
     823       34564 :         if (ppAllMembers[nPos]->eTypeClass == typelib_TypeClass_INTERFACE_METHOD)
     824             :         {
     825             :             // methods to front
     826       33029 :             nIndex = _nMethods;
     827       33029 :             ++_nMethods;
     828             :         }
     829             :         else
     830             :         {
     831        1535 :             ++_nAttributes;
     832        1535 :             nIndex = (nAll - _nAttributes);
     833             :             // attributes at the back
     834             :         }
     835             : 
     836       34564 :         typelib_TypeDescription * pTD = 0;
     837       34564 :         typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] );
     838             :         OSL_ENSURE( pTD, "### cannot get type description!" );
     839       34564 :         pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName;
     840       34564 :         pSortedMemberInit[nIndex].second = pTD;
     841             :     }
     842             : 
     843        5009 :     _pSortedMemberInit = pSortedMemberInit;
     844        5009 : }
     845             : //__________________________________________________________________________________________________
     846          34 : sal_Bool InterfaceIdlClassImpl::isAssignableFrom( const Reference< XIdlClass > & xType )
     847             :     throw(::com::sun::star::uno::RuntimeException)
     848             : {
     849          34 :     if (xType.is() && xType->getTypeClass() == TypeClass_INTERFACE)
     850             :     {
     851          34 :         if (equals( xType ))
     852          18 :             return sal_True;
     853             :         else
     854             :         {
     855          16 :             const Sequence< Reference< XIdlClass > > & rSeq = xType->getSuperclasses();
     856          16 :             for (sal_Int32 i = 0; i < rSeq.getLength(); ++i) {
     857          10 :                 if (isAssignableFrom(rSeq[i])) {
     858          10 :                     return true;
     859             :                 }
     860           6 :             }
     861             :         }
     862             :     }
     863           6 :     return sal_False;
     864             : }
     865             : //__________________________________________________________________________________________________
     866           0 : Uik InterfaceIdlClassImpl::getUik()
     867             :     throw(::com::sun::star::uno::RuntimeException)
     868             : {
     869           0 :     return Uik(0, 0, 0, 0, 0);
     870             :         // Uiks are deprecated and this function must not be called
     871             : }
     872             : //__________________________________________________________________________________________________
     873        9809 : Sequence< Reference< XIdlMethod > > InterfaceIdlClassImpl::getMethods()
     874             :     throw(::com::sun::star::uno::RuntimeException)
     875             : {
     876        9809 :     MutexGuard aGuard( getMutexAccess() );
     877        9809 :     if (! _pSortedMemberInit)
     878           0 :         initMembers();
     879             : 
     880             :     // create methods sequence
     881        9809 :     Sequence< Reference< XIdlMethod > > aRet( _nMethods );
     882        9809 :     Reference< XIdlMethod > * pRet = aRet.getArray();
     883       81328 :     for ( sal_Int32 nPos = _nMethods; nPos--; )
     884             :     {
     885             : 
     886      185130 :         /*_aName2Method[_pSortedMemberInit[nPos].first] = */pRet[nPos] = new IdlInterfaceMethodImpl(
     887      123420 :             getReflection(), _pSortedMemberInit[nPos].first,
     888      246840 :             _pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
     889             :     }
     890        9809 :     return aRet;
     891             : }
     892             : //__________________________________________________________________________________________________
     893        9809 : Sequence< Reference< XIdlField > > InterfaceIdlClassImpl::getFields()
     894             :     throw(::com::sun::star::uno::RuntimeException)
     895             : {
     896        9809 :     MutexGuard aGuard( getMutexAccess() );
     897        9809 :     if (! _pSortedMemberInit)
     898        4948 :         initMembers();
     899             : 
     900             :     // create fields sequence
     901        9809 :     Sequence< Reference< XIdlField > > aRet( _nAttributes );
     902        9809 :     Reference< XIdlField > * pRet = aRet.getArray();
     903       21601 :     for ( sal_Int32 nPos = _nAttributes; nPos--; )
     904             :     {
     905        5949 :         /*_aName2Field[_pSortedMemberInit[_nMethods+nPos].first] = */pRet[_nAttributes-nPos-1] =
     906             :             new IdlAttributeFieldImpl(
     907        3966 :                 getReflection(), _pSortedMemberInit[_nMethods+nPos].first,
     908        7932 :                 _pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
     909             :     }
     910        9809 :     return aRet;
     911             : }
     912             : //__________________________________________________________________________________________________
     913          19 : Reference< XIdlMethod > InterfaceIdlClassImpl::getMethod( const OUString & rName )
     914             :     throw(::com::sun::star::uno::RuntimeException)
     915             : {
     916          19 :     MutexGuard aGuard( getMutexAccess() );
     917          19 :     if (! _pSortedMemberInit)
     918           1 :         initMembers();
     919             : 
     920          19 :     Reference< XIdlMethod > xRet;
     921             : 
     922             :     // try weak map
     923          19 :     const OUString2Method::const_iterator iFind( _aName2Method.find( rName ) );
     924          19 :     if (iFind != _aName2Method.end())
     925          15 :         xRet = (*iFind).second; // harden ref
     926             : 
     927          19 :     if (! xRet.is())
     928             :     {
     929          56 :         for ( sal_Int32 nPos = _nMethods; nPos--; )
     930             :         {
     931          37 :             if (_pSortedMemberInit[nPos].first == rName)
     932             :             {
     933          57 :                 _aName2Method[rName] = xRet = new IdlInterfaceMethodImpl(
     934          19 :                     getReflection(), rName,
     935          57 :                     _pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
     936          19 :                 break;
     937             :             }
     938             :         }
     939             :     }
     940          19 :     return xRet;
     941             : }
     942             : //__________________________________________________________________________________________________
     943         180 : Reference< XIdlField > InterfaceIdlClassImpl::getField( const OUString & rName )
     944             :     throw(::com::sun::star::uno::RuntimeException)
     945             : {
     946         180 :     MutexGuard aGuard( getMutexAccess() );
     947         180 :     if (! _pSortedMemberInit)
     948          60 :         initMembers();
     949             : 
     950         180 :     Reference< XIdlField > xRet;
     951             : 
     952             :     // try weak map
     953         180 :     const OUString2Field::const_iterator iFind( _aName2Field.find( rName ) );
     954         180 :     if (iFind != _aName2Field.end())
     955          60 :         xRet = (*iFind).second; // harden ref
     956             : 
     957         180 :     if (! xRet.is())
     958             :     {
     959         300 :         for ( sal_Int32 nPos = _nAttributes; nPos--; )
     960             :         {
     961         180 :             if (_pSortedMemberInit[_nMethods+nPos].first == rName)
     962             :             {
     963         360 :                 _aName2Field[rName] = xRet = new IdlAttributeFieldImpl(
     964         120 :                     getReflection(), rName,
     965         360 :                     _pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
     966         120 :                 break;
     967             :             }
     968             :         }
     969             :     }
     970         180 :     return xRet;
     971             : }
     972             : //__________________________________________________________________________________________________
     973           0 : void InterfaceIdlClassImpl::createObject( Any & rObj )
     974             :     throw(::com::sun::star::uno::RuntimeException)
     975             : {
     976             :     // interfaces cannot be constructed
     977           0 :     rObj.clear();
     978           0 : }
     979             : 
     980             : }
     981             : 
     982             : 
     983             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10