LCOV - code coverage report
Current view: top level - cppu/source/helper/purpenv - helper_purpenv_Environment.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 196 0.0 %
Date: 2012-08-25 Functions: 0 43 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include "cppu/helper/purpenv/Environment.hxx"
      22                 :            : 
      23                 :            : #include "osl/diagnose.h"
      24                 :            : #include "uno/lbnames.h"
      25                 :            : 
      26                 :            : #include "typelib/typedescription.h"
      27                 :            : #include "osl/interlck.h"
      28                 :            : 
      29                 :            : #ifdef debug
      30                 :            : # define LOG_LIFECYCLE_cppu_helper_purpenv_Base
      31                 :            : #endif
      32                 :            : 
      33                 :            : #ifdef LOG_LIFECYCLE_cppu_helper_purpenv_Base
      34                 :            : #  include <iostream>
      35                 :            : #  define LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(x) x
      36                 :            : 
      37                 :            : #else
      38                 :            : #  define LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(x)
      39                 :            : 
      40                 :            : #endif
      41                 :            : 
      42                 :            : 
      43                 :            : extern "C" {
      44                 :            : typedef void SAL_CALL EnvFun_P   (uno_Environment *);
      45                 :            : typedef void SAL_CALL EnvFun_PP_P(uno_Environment ** ppHardEnv, uno_Environment *);
      46                 :            : typedef void SAL_CALL ExtEnv_registerProxyInterface (uno_ExtEnvironment                 *,
      47                 :            :                                                      void                              ** ppProxy,
      48                 :            :                                                      uno_freeProxyFunc                    freeProxy,
      49                 :            :                                                      rtl_uString * pOId,
      50                 :            :                                                      typelib_InterfaceTypeDescription   * pTypeDescr);
      51                 :            : typedef void SAL_CALL ExtEnv_revokeInterface        (uno_ExtEnvironment                 *,
      52                 :            :                                                      void                               * pInterface);
      53                 :            : typedef void SAL_CALL ExtEnv_getObjectIdentifier    (uno_ExtEnvironment                 *,
      54                 :            :                                                      rtl_uString                       **,
      55                 :            :                                                      void                               *);
      56                 :            : typedef void SAL_CALL ExtEnv_getRegisteredInterface (uno_ExtEnvironment                 *,
      57                 :            :                                                      void                              **,
      58                 :            :                                                      rtl_uString                        *,
      59                 :            :                                                      typelib_InterfaceTypeDescription   *);
      60                 :            : typedef void SAL_CALL ExtEnv_getRegisteredInterfaces(uno_ExtEnvironment                 *,
      61                 :            :                                                      void                             *** pppInterfaces,
      62                 :            :                                                      sal_Int32                          * pnLen,
      63                 :            :                                                      uno_memAlloc                         memAlloc);
      64                 :            : typedef void SAL_CALL ExtEnv_computeObjectIdentifier(uno_ExtEnvironment                 *,
      65                 :            :                                                      rtl_uString                       ** ppOId,
      66                 :            :                                                      void                               * pInterface);
      67                 :            : typedef void SAL_CALL ExtEnv_acquireInterface       (uno_ExtEnvironment                 *,
      68                 :            :                                                      void                               * pInterface);
      69                 :            : typedef void SAL_CALL ExtEnv_releaseInterface       (uno_ExtEnvironment                 *,
      70                 :            :                                                      void                               * pInterface);
      71                 :            : }
      72                 :            : 
      73                 :            : class Base : public cppu::Enterable
      74                 :            : {
      75                 :            : public:
      76                 :            :     explicit Base(uno_Environment * pEnv, cppu::Enterable * pEnterable);
      77                 :            : 
      78                 :            :     void acquireWeak(void);
      79                 :            :     void releaseWeak(void);
      80                 :            :     void harden     (uno_Environment ** ppHardEnv);
      81                 :            :     void acquire    (void);
      82                 :            :     void release    (void);
      83                 :            : 
      84                 :            :     void registerProxyInterface (void                                  ** ppProxy,
      85                 :            :                                  uno_freeProxyFunc                        freeProxy,
      86                 :            :                                  rtl::OUString                    const & oid,
      87                 :            :                                  typelib_InterfaceTypeDescription       * pTypeDescr);
      88                 :            :     void revokeInterface        (void                                   * pInterface);
      89                 :            :     void getObjectIdentifier    (void                                   * pInterface,
      90                 :            :                                  rtl::OUString                          * pOid);
      91                 :            :     void getRegisteredInterface (void                                  **,
      92                 :            :                                  rtl::OUString                    const & oid,
      93                 :            :                                  typelib_InterfaceTypeDescription       *);
      94                 :            :     void getRegisteredInterfaces(void                                 ***,
      95                 :            :                                  sal_Int32                              * pnLen,
      96                 :            :                                  uno_memAlloc                             memAlloc);
      97                 :            :     void computeObjectIdentifier(void                                   * pInterface,
      98                 :            :                                  rtl::OUString                          * pOid);
      99                 :            :     void acquireInterface       (void                                   * pInterface);
     100                 :            :     void releaseInterface       (void                                   * pInterface);
     101                 :            : 
     102                 :            :     virtual void v_enter     (void);
     103                 :            :     virtual void v_leave     (void);
     104                 :            :     virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam);
     105                 :            :     virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam);
     106                 :            :     virtual int  v_isValid   (rtl::OUString * pReason);
     107                 :            : 
     108                 :            : protected:
     109                 :            :     oslInterlockedCount    m_nRef;
     110                 :            :     uno_Environment      * m_pEnv;
     111                 :            :     cppu::Enterable      * m_pEnterable;
     112                 :            : 
     113                 :            :     EnvFun_P    * m_env_acquire;
     114                 :            :     EnvFun_P    * m_env_release;
     115                 :            :     EnvFun_PP_P * m_env_harden;
     116                 :            :     EnvFun_P    * m_env_acquireWeak;
     117                 :            :     EnvFun_P    * m_env_releaseWeak;
     118                 :            : 
     119                 :            :     ExtEnv_registerProxyInterface  * m_env_registerProxyInterface;
     120                 :            :     ExtEnv_revokeInterface         * m_env_revokeInterface;
     121                 :            :     ExtEnv_getObjectIdentifier     * m_env_getObjectIdentifier;
     122                 :            :     ExtEnv_getRegisteredInterface  * m_env_getRegisteredInterface;
     123                 :            :     ExtEnv_getRegisteredInterfaces * m_env_getRegisteredInterfaces;
     124                 :            :     ExtEnv_computeObjectIdentifier * m_env_computeObjectIdentifier;
     125                 :            :     ExtEnv_acquireInterface        * m_env_acquireInterface;
     126                 :            :     ExtEnv_releaseInterface        * m_env_releaseInterface;
     127                 :            : 
     128                 :            :     virtual  ~Base();
     129                 :            : };
     130                 :            : 
     131                 :            : extern "C" {
     132                 :          0 : static void SAL_CALL s_acquire(uno_Environment * pEnv) //SAL_THROW_EXTERN_C()
     133                 :            : {
     134                 :          0 :     Base * pBase = static_cast<Base *>(pEnv->pReserved);
     135                 :          0 :     pBase->acquire();
     136                 :          0 : }
     137                 :            : 
     138                 :          0 : static void SAL_CALL s_release(uno_Environment * pEnv) SAL_THROW_EXTERN_C()
     139                 :            : {
     140                 :          0 :     Base * pBase = static_cast<Base *>(pEnv->pReserved);
     141                 :          0 :     pBase->release();
     142                 :          0 : }
     143                 :            : 
     144                 :          0 : static void SAL_CALL s_harden(uno_Environment ** ppHardEnv, uno_Environment * pEnv) SAL_THROW_EXTERN_C()
     145                 :            : {
     146                 :          0 :     Base * pBase = static_cast<Base *>(pEnv->pReserved);
     147                 :          0 :     pBase->harden(ppHardEnv);
     148                 :          0 : }
     149                 :            : 
     150                 :          0 : static void SAL_CALL s_acquireWeak(uno_Environment * pEnv) SAL_THROW_EXTERN_C()
     151                 :            : {
     152                 :          0 :     Base * pBase = static_cast<Base *>(pEnv->pReserved);
     153                 :          0 :     pBase->acquireWeak();
     154                 :          0 : }
     155                 :            : 
     156                 :          0 : static void SAL_CALL s_releaseWeak(uno_Environment * pEnv) SAL_THROW_EXTERN_C()
     157                 :            : {
     158                 :          0 :     Base * pBase = static_cast<Base *>(pEnv->pReserved);
     159                 :          0 :     pBase->releaseWeak();
     160                 :          0 : }
     161                 :            : 
     162                 :            : 
     163                 :          0 : static void SAL_CALL s_registerProxyInterface(uno_ExtEnvironment                * pExtEnv,
     164                 :            :                                                          void                             ** ppProxy,
     165                 :            :                                                          uno_freeProxyFunc                   freeProxy,
     166                 :            :                                                          rtl_uString                       * pOId,
     167                 :            :                                                          typelib_InterfaceTypeDescription  * pTypeDescr)
     168                 :            : {
     169                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     170                 :          0 :     pBase->registerProxyInterface(ppProxy, freeProxy, pOId, pTypeDescr);
     171                 :          0 : }
     172                 :            : 
     173                 :          0 : static void SAL_CALL s_revokeInterface(uno_ExtEnvironment * pExtEnv, void * pInterface)
     174                 :            : {
     175                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     176                 :          0 :     pBase->revokeInterface(pInterface);
     177                 :          0 : }
     178                 :            : 
     179                 :          0 : static void SAL_CALL s_getObjectIdentifier(uno_ExtEnvironment *  pExtEnv,
     180                 :            :                                                       rtl_uString        ** ppOId,
     181                 :            :                                                       void               *  pInterface)
     182                 :            : {
     183                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     184                 :          0 :     pBase->getObjectIdentifier(pInterface, reinterpret_cast<rtl::OUString *>(ppOId));
     185                 :          0 : }
     186                 :            : 
     187                 :          0 : static void SAL_CALL s_getRegisteredInterface(uno_ExtEnvironment *  pExtEnv,
     188                 :            :                                                          void               ** ppInterface,
     189                 :            :                                                          rtl_uString        *  pOId,
     190                 :            :                                                          typelib_InterfaceTypeDescription * pTypeDescr)
     191                 :            : {
     192                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     193                 :          0 :     pBase->getRegisteredInterface(ppInterface, pOId, pTypeDescr);
     194                 :          0 : }
     195                 :            : 
     196                 :          0 : static void SAL_CALL s_getRegisteredInterfaces(uno_ExtEnvironment   * pExtEnv,
     197                 :            :                                                           void               *** pppInterface,
     198                 :            :                                                           sal_Int32            * pnLen,
     199                 :            :                                                           uno_memAlloc           memAlloc)
     200                 :            : {
     201                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     202                 :          0 :     pBase->getRegisteredInterfaces(pppInterface, pnLen, memAlloc);
     203                 :          0 : }
     204                 :            : 
     205                 :          0 : static void SAL_CALL s_computeObjectIdentifier(uno_ExtEnvironment *  pExtEnv,
     206                 :            :                                                           rtl_uString        ** ppOId,
     207                 :            :                                                           void               *  pInterface)
     208                 :            : {
     209                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     210                 :          0 :     pBase->computeObjectIdentifier(pInterface, reinterpret_cast<rtl::OUString *>(ppOId));
     211                 :          0 : }
     212                 :            : 
     213                 :          0 : static void SAL_CALL s_acquireInterface(uno_ExtEnvironment * pExtEnv, void * pInterface) {
     214                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     215                 :          0 :     pBase->acquireInterface(pInterface);
     216                 :          0 : }
     217                 :            : 
     218                 :          0 : static void SAL_CALL s_releaseInterface(uno_ExtEnvironment * pExtEnv, void * pInterface) {
     219                 :          0 :     Base * pBase = static_cast<Base *>(pExtEnv->aBase.pReserved);
     220                 :          0 :     pBase->releaseInterface(pInterface);
     221                 :          0 : }
     222                 :            : 
     223                 :            : }
     224                 :            : 
     225                 :          0 : Base::Base(uno_Environment * pEnv, cppu::Enterable * pEnterable)
     226                 :            :     :m_nRef(1),
     227                 :            :      m_pEnv(pEnv),
     228                 :            :      m_pEnterable     (pEnterable),
     229                 :            :      m_env_acquire    (pEnv->acquire),
     230                 :            :      m_env_release    (pEnv->release),
     231                 :            :      m_env_harden     (pEnv->harden),
     232                 :            :      m_env_acquireWeak(pEnv->acquireWeak),
     233                 :            :      m_env_releaseWeak(pEnv->releaseWeak),
     234                 :            :      m_env_registerProxyInterface (pEnv->pExtEnv->registerProxyInterface),
     235                 :            :      m_env_revokeInterface        (pEnv->pExtEnv->revokeInterface),
     236                 :            :      m_env_getObjectIdentifier    (pEnv->pExtEnv->getObjectIdentifier),
     237                 :            :      m_env_getRegisteredInterface (pEnv->pExtEnv->getRegisteredInterface),
     238                 :            :      m_env_getRegisteredInterfaces(pEnv->pExtEnv->getRegisteredInterfaces),
     239                 :            :      m_env_computeObjectIdentifier(pEnv->pExtEnv->computeObjectIdentifier),
     240                 :            :      m_env_acquireInterface       (pEnv->pExtEnv->acquireInterface),
     241                 :          0 :      m_env_releaseInterface       (pEnv->pExtEnv->releaseInterface)
     242                 :            : {
     243                 :            :     LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(fprintf(stderr, "LIFE: %s -> %p\n", "cppu::helper::purpenv::Base::Base(uno_Environment * pEnv)", this));
     244                 :            :     OSL_ENSURE(
     245                 :            :         rtl_ustr_ascii_compare_WithLength(pEnv->pTypeName->buffer, rtl_str_getLength(UNO_LB_UNO), UNO_LB_UNO)
     246                 :            :             == 0,
     247                 :            :             "### wrong environment type!");
     248                 :            : 
     249                 :          0 :     pEnv->acquire     = s_acquire;
     250                 :          0 :     pEnv->release     = s_release;
     251                 :          0 :     pEnv->harden      = s_harden;
     252                 :          0 :     pEnv->acquireWeak = s_acquireWeak;
     253                 :          0 :     pEnv->releaseWeak = s_releaseWeak;
     254                 :            : 
     255                 :          0 :     pEnv->pExtEnv->registerProxyInterface  = s_registerProxyInterface;
     256                 :          0 :     pEnv->pExtEnv->revokeInterface         = s_revokeInterface;
     257                 :          0 :     pEnv->pExtEnv->getObjectIdentifier     = s_getObjectIdentifier;
     258                 :          0 :     pEnv->pExtEnv->getRegisteredInterface  = s_getRegisteredInterface;
     259                 :          0 :     pEnv->pExtEnv->getRegisteredInterfaces = s_getRegisteredInterfaces;
     260                 :          0 :     pEnv->pExtEnv->computeObjectIdentifier = s_computeObjectIdentifier;
     261                 :          0 :     pEnv->pExtEnv->acquireInterface        = s_acquireInterface;
     262                 :          0 :     pEnv->pExtEnv->releaseInterface        = s_releaseInterface;
     263                 :            : 
     264                 :          0 :     pEnv->pReserved = this;
     265                 :          0 : }
     266                 :            : 
     267                 :          0 : Base::~Base()
     268                 :            : {
     269                 :            :     LOG_LIFECYCLE_cppu_helper_purpenv_Base_emit(fprintf(stderr, "LIFE: %s -> %p\n", "cppu::helper::purpenv::Base::~Base()", this));
     270                 :            : 
     271                 :          0 :     m_pEnv->acquire     = m_env_acquire;
     272                 :          0 :     m_pEnv->release     = m_env_release;
     273                 :          0 :     m_pEnv->harden      = m_env_harden;
     274                 :          0 :     m_pEnv->acquireWeak = m_env_acquireWeak;
     275                 :          0 :     m_pEnv->releaseWeak = m_env_releaseWeak;
     276                 :            : 
     277                 :          0 :     m_pEnv->pReserved = NULL;
     278                 :            : 
     279                 :          0 :     delete m_pEnterable;
     280                 :          0 :     m_pEnv->release(m_pEnv);
     281                 :          0 : }
     282                 :            : 
     283                 :          0 : void Base::acquire(void)
     284                 :            : {
     285                 :          0 :     m_env_acquire(m_pEnv);
     286                 :            : 
     287                 :          0 :     osl_incrementInterlockedCount(&m_nRef);
     288                 :          0 : }
     289                 :            : 
     290                 :          0 : void Base::release(void)
     291                 :            : {
     292                 :          0 :     if (osl_decrementInterlockedCount(&m_nRef) == 0)
     293                 :          0 :         delete this;
     294                 :            : 
     295                 :            :     else
     296                 :          0 :         m_env_release(m_pEnv);
     297                 :          0 : }
     298                 :            : 
     299                 :          0 : void Base::harden(uno_Environment ** ppHardEnv)
     300                 :            : {
     301                 :          0 :     m_env_harden(ppHardEnv, m_pEnv);
     302                 :          0 :     osl_incrementInterlockedCount(&m_nRef);
     303                 :          0 : }
     304                 :            : 
     305                 :          0 : void Base::acquireWeak(void)
     306                 :            : {
     307                 :          0 :     m_env_acquireWeak(m_pEnv);
     308                 :          0 : }
     309                 :            : 
     310                 :          0 : void Base::releaseWeak(void)
     311                 :            : {
     312                 :          0 :     m_env_releaseWeak(m_pEnv);
     313                 :          0 : }
     314                 :            : 
     315                 :            : 
     316                 :          0 : extern "C" { static void s_registerProxyInterface_v(va_list * pParam)
     317                 :            : {
     318                 :          0 :     uno_ExtEnvironment                   * pExtEnv    = va_arg(*pParam, uno_ExtEnvironment *);
     319                 :          0 :     void                                ** ppProxy    = va_arg(*pParam, void **);
     320                 :          0 :     uno_freeProxyFunc                      freeProxy  = va_arg(*pParam, uno_freeProxyFunc);
     321                 :          0 :     rtl_uString                          * pOId       = va_arg(*pParam, rtl_uString *);
     322                 :          0 :     typelib_InterfaceTypeDescription     * pTypeDescr = va_arg(*pParam, typelib_InterfaceTypeDescription *);
     323                 :            :     ExtEnv_registerProxyInterface  * pRegisterProxyInterface
     324                 :          0 :         = va_arg(*pParam, ExtEnv_registerProxyInterface *);
     325                 :            : 
     326                 :          0 :     pRegisterProxyInterface(pExtEnv, ppProxy, freeProxy, pOId, pTypeDescr);
     327                 :          0 : }}
     328                 :            : 
     329                 :          0 : void Base::registerProxyInterface(void                                  ** ppProxy,
     330                 :            :                                   uno_freeProxyFunc                        freeProxy,
     331                 :            :                                   rtl::OUString                    const & oid,
     332                 :            :                                   typelib_InterfaceTypeDescription       * pTypeDescr)
     333                 :            : {
     334                 :            :      uno_Environment_invoke(m_pEnv,
     335                 :            :                            s_registerProxyInterface_v,
     336                 :            :                            m_pEnv->pExtEnv,
     337                 :            :                            ppProxy,
     338                 :            :                            freeProxy,
     339                 :            :                            oid.pData,
     340                 :            :                            pTypeDescr,
     341                 :          0 :                            m_env_registerProxyInterface);
     342                 :          0 : }
     343                 :            : 
     344                 :            : 
     345                 :          0 : extern "C" { static void s_revokeInterface_v(va_list * pParam)
     346                 :            : {
     347                 :          0 :     uno_ExtEnvironment * pExtEnv    = va_arg(*pParam, uno_ExtEnvironment *);
     348                 :          0 :     void               * pInterface = va_arg(*pParam, void *);
     349                 :          0 :     ExtEnv_revokeInterface * pRevokeInterface = va_arg(*pParam, ExtEnv_revokeInterface *);
     350                 :            : 
     351                 :          0 :     pRevokeInterface(pExtEnv, pInterface);
     352                 :          0 : }}
     353                 :            : 
     354                 :          0 : void Base::revokeInterface(void * pInterface)
     355                 :            : {
     356                 :            :      uno_Environment_invoke(m_pEnv,
     357                 :            :                            s_revokeInterface_v,
     358                 :            :                            m_pEnv->pExtEnv,
     359                 :            :                            pInterface,
     360                 :          0 :                            m_env_revokeInterface);
     361                 :          0 : }
     362                 :            : 
     363                 :            : 
     364                 :          0 : extern "C" { static void s_getObjectIdentifier_v(va_list * pParam)
     365                 :            : {
     366                 :          0 :     uno_ExtEnvironment * pExtEnv    = va_arg(*pParam, uno_ExtEnvironment *);
     367                 :          0 :     void               * pInterface = va_arg(*pParam, void *);
     368                 :          0 :     rtl::OUString      * pOId       = va_arg(*pParam, rtl::OUString *);
     369                 :            :     ExtEnv_getObjectIdentifier * pGetObjectIdentifier
     370                 :          0 :         = va_arg(*pParam, ExtEnv_getObjectIdentifier *);
     371                 :            : 
     372                 :          0 :     pGetObjectIdentifier(pExtEnv, reinterpret_cast<rtl_uString **>(pOId), pInterface);
     373                 :          0 : }}
     374                 :            : 
     375                 :          0 : void Base::getObjectIdentifier(void * pInterface, rtl::OUString * pOid)
     376                 :            : {
     377                 :            :      uno_Environment_invoke(m_pEnv,
     378                 :            :                            s_getObjectIdentifier_v,
     379                 :            :                            m_pEnv->pExtEnv,
     380                 :            :                            pInterface,
     381                 :            :                            pOid,
     382                 :          0 :                            m_env_getObjectIdentifier);
     383                 :          0 : }
     384                 :            : 
     385                 :            : 
     386                 :          0 : extern "C" { static void s_getRegisteredInterface_v(va_list * pParam)
     387                 :            : {
     388                 :          0 :     uno_ExtEnvironment                   * pExtEnv     = va_arg(*pParam, uno_ExtEnvironment *);
     389                 :          0 :     void                                ** ppInterface = va_arg(*pParam, void **);
     390                 :          0 :     rtl_uString                          * pOId        = va_arg(*pParam, rtl_uString *);
     391                 :          0 :     typelib_InterfaceTypeDescription     * pTypeDescr  = va_arg(*pParam, typelib_InterfaceTypeDescription *);
     392                 :            :     ExtEnv_getRegisteredInterface  * pGetRegisteredInterface
     393                 :          0 :         = va_arg(*pParam, ExtEnv_getRegisteredInterface *);
     394                 :            : 
     395                 :          0 :     pGetRegisteredInterface(pExtEnv, ppInterface, pOId, pTypeDescr);
     396                 :          0 : }}
     397                 :            : 
     398                 :          0 : void Base::getRegisteredInterface(void ** ppInterface,
     399                 :            :                                   rtl::OUString const & oid,
     400                 :            :                                   typelib_InterfaceTypeDescription * pTypeDescr)
     401                 :            : {
     402                 :            :      uno_Environment_invoke(m_pEnv,
     403                 :            :                            s_getRegisteredInterface_v,
     404                 :            :                            m_pEnv->pExtEnv,
     405                 :            :                            ppInterface,
     406                 :            :                            oid.pData,
     407                 :            :                            pTypeDescr,
     408                 :          0 :                            m_env_getRegisteredInterface);
     409                 :          0 : }
     410                 :            : 
     411                 :            : 
     412                 :          0 : extern "C" { static void s_getRegisteredInterfaces_v(va_list * pParam)
     413                 :            : {
     414                 :          0 :     uno_ExtEnvironment   * pExtEnv      = va_arg(*pParam, uno_ExtEnvironment *);
     415                 :          0 :     void               *** pppInterface = va_arg(*pParam, void ***);
     416                 :          0 :     sal_Int32            * pnLen        = va_arg(*pParam, sal_Int32 *);
     417                 :          0 :     uno_memAlloc           memAlloc     = va_arg(*pParam, uno_memAlloc);
     418                 :            :     ExtEnv_getRegisteredInterfaces * pGetRegisteredInterfaces
     419                 :          0 :         = va_arg(*pParam, ExtEnv_getRegisteredInterfaces *);
     420                 :            : 
     421                 :          0 :     pGetRegisteredInterfaces(pExtEnv, pppInterface, pnLen, memAlloc);
     422                 :          0 : }}
     423                 :            : 
     424                 :          0 : void Base::getRegisteredInterfaces(void         *** pppInterface,
     425                 :            :                                    sal_Int32      * pnLen,
     426                 :            :                                    uno_memAlloc     memAlloc)
     427                 :            : {
     428                 :            :      uno_Environment_invoke(m_pEnv,
     429                 :            :                            s_getRegisteredInterfaces_v,
     430                 :            :                            m_pEnv->pExtEnv,
     431                 :            :                            pppInterface,
     432                 :            :                            pnLen,
     433                 :            :                            memAlloc,
     434                 :          0 :                            m_env_getRegisteredInterfaces);
     435                 :          0 : }
     436                 :            : 
     437                 :            : 
     438                 :          0 : extern "C" { static void s_computeObjectIdentifier_v(va_list * pParam)
     439                 :            : {
     440                 :          0 :     uno_ExtEnvironment * pExtEnv    = va_arg(*pParam, uno_ExtEnvironment *);
     441                 :          0 :     void               * pInterface = va_arg(*pParam, void *);
     442                 :          0 :     rtl::OUString      * pOId       = va_arg(*pParam, rtl::OUString *);
     443                 :            :     ExtEnv_computeObjectIdentifier * pComputeObjectIdentifier
     444                 :          0 :         = va_arg(*pParam, ExtEnv_computeObjectIdentifier *);
     445                 :            : 
     446                 :          0 :     pComputeObjectIdentifier(pExtEnv, reinterpret_cast<rtl_uString **>(pOId), pInterface);
     447                 :          0 : }}
     448                 :            : 
     449                 :          0 : void Base::computeObjectIdentifier(void * pInterface, rtl::OUString * pOid)
     450                 :            : {
     451                 :            :      uno_Environment_invoke(m_pEnv,
     452                 :            :                            s_computeObjectIdentifier_v,
     453                 :            :                            m_pEnv->pExtEnv,
     454                 :            :                            pInterface,
     455                 :            :                            pOid,
     456                 :          0 :                            m_env_computeObjectIdentifier);
     457                 :          0 : }
     458                 :            : 
     459                 :            : 
     460                 :          0 : extern "C" { static void s_acquireInterface_v(va_list * pParam)
     461                 :            : {
     462                 :          0 :     uno_ExtEnvironment * pExtEnv    = va_arg(*pParam, uno_ExtEnvironment *);
     463                 :          0 :     void               * pInterface = va_arg(*pParam, void *);
     464                 :            :     ExtEnv_acquireInterface * pAcquireInterface
     465                 :          0 :         = va_arg(*pParam, ExtEnv_acquireInterface *);
     466                 :            : 
     467                 :          0 :     pAcquireInterface(pExtEnv, pInterface);
     468                 :          0 : }}
     469                 :            : 
     470                 :          0 : void Base::acquireInterface(void * pInterface)
     471                 :            : {
     472                 :          0 :      uno_Environment_invoke(m_pEnv, s_acquireInterface_v, m_pEnv->pExtEnv, pInterface, m_env_acquireInterface);
     473                 :          0 : }
     474                 :            : 
     475                 :            : 
     476                 :          0 : extern "C" { static void s_releaseInterface_v(va_list * pParam)
     477                 :            : {
     478                 :          0 :     uno_ExtEnvironment * pExtEnv    = va_arg(*pParam, uno_ExtEnvironment *);
     479                 :          0 :     void               * pInterface = va_arg(*pParam, void *);
     480                 :            :     ExtEnv_releaseInterface * pReleaseInterface
     481                 :          0 :         = va_arg(*pParam, ExtEnv_releaseInterface *);
     482                 :            : 
     483                 :          0 :     pReleaseInterface(pExtEnv, pInterface);
     484                 :          0 : }}
     485                 :            : 
     486                 :          0 : void Base::releaseInterface(void * pInterface)
     487                 :            : {
     488                 :            :      uno_Environment_invoke(m_pEnv,
     489                 :            :                            s_releaseInterface_v,
     490                 :            :                            m_pEnv->pExtEnv,
     491                 :            :                            pInterface,
     492                 :          0 :                            m_env_releaseInterface);
     493                 :          0 : }
     494                 :            : 
     495                 :          0 : void Base::v_enter(void)
     496                 :            : {
     497                 :          0 :     m_pEnterable->enter();
     498                 :          0 : }
     499                 :            : 
     500                 :          0 : void Base::v_leave(void)
     501                 :            : {
     502                 :          0 :     m_pEnterable->leave();
     503                 :          0 : }
     504                 :            : 
     505                 :          0 : void Base::v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam)
     506                 :            : {
     507                 :          0 :     m_pEnterable->callInto_v(pCallee, pParam);
     508                 :          0 : }
     509                 :            : 
     510                 :          0 : void Base::v_callOut_v(uno_EnvCallee * pCallee, va_list * pParam)
     511                 :            : {
     512                 :          0 :     m_pEnterable->callOut_v(pCallee, pParam);
     513                 :          0 : }
     514                 :            : 
     515                 :          0 : int Base::v_isValid(rtl::OUString * pReason)
     516                 :            : {
     517                 :          0 :     return m_pEnterable->isValid(pReason);
     518                 :            : }
     519                 :            : 
     520                 :            : namespace cppu { namespace helper { namespace purpenv {
     521                 :            : 
     522                 :          0 : void Environment_initWithEnterable(uno_Environment * pEnvironment, cppu::Enterable * pEnterable)
     523                 :            : {
     524                 :          0 :     new Base(pEnvironment, pEnterable);
     525                 :          0 : }
     526                 :            : 
     527                 :            : }}}
     528                 :            : 
     529                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10