1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _UNO_MAPPING_H_ 28*cdf0e10cSrcweir #define _UNO_MAPPING_H_ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <sal/types.h> 31*cdf0e10cSrcweir #include <rtl/ustring.h> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #ifdef __cplusplus 35*cdf0e10cSrcweir extern "C" 36*cdf0e10cSrcweir { 37*cdf0e10cSrcweir #endif 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir struct _typelib_InterfaceTypeDescription; 40*cdf0e10cSrcweir struct _uno_Mapping; 41*cdf0e10cSrcweir struct _uno_Environment; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir /** 44*cdf0e10cSrcweir Function pointer declaration to acquire a UNO mapping. 45*cdf0e10cSrcweir */ 46*cdf0e10cSrcweir typedef void (SAL_CALL * uno_AcquireMappingFunc)(struct _uno_Mapping *); 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir /** 49*cdf0e10cSrcweir Function pointer declaration to release a UNO mapping. 50*cdf0e10cSrcweir */ 51*cdf0e10cSrcweir typedef void (SAL_CALL * uno_ReleaseMappingFunc)(struct _uno_Mapping *); 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir /** Function pointer declaration to map an interface from one environment to another. 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir @param pMapping mapping 56*cdf0e10cSrcweir @param ppOut [inout] destination interface; existing interfaces are released 57*cdf0e10cSrcweir @param pInterface source interface 58*cdf0e10cSrcweir @param pInterfaceTypeDescr type description of the interface 59*cdf0e10cSrcweir */ 60*cdf0e10cSrcweir typedef void (SAL_CALL * uno_MapInterfaceFunc)( 61*cdf0e10cSrcweir struct _uno_Mapping * pMapping, 62*cdf0e10cSrcweir void ** ppOut, void * pInterface, 63*cdf0e10cSrcweir struct _typelib_InterfaceTypeDescription * pInterfaceTypeDescr ); 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir #if defined( SAL_W32) 67*cdf0e10cSrcweir #pragma pack(push, 8) 68*cdf0e10cSrcweir #elif defined(SAL_OS2) 69*cdf0e10cSrcweir #pragma pack(push, 8) 70*cdf0e10cSrcweir #endif 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir /** This is the binary specification of a mapping. 73*cdf0e10cSrcweir */ 74*cdf0e10cSrcweir typedef struct _uno_Mapping 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir /** Acquires mapping 77*cdf0e10cSrcweir */ 78*cdf0e10cSrcweir uno_AcquireMappingFunc acquire; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir /** Releases mapping. The last release may unload bridges. 81*cdf0e10cSrcweir */ 82*cdf0e10cSrcweir uno_ReleaseMappingFunc release; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir /** mapping function 85*cdf0e10cSrcweir */ 86*cdf0e10cSrcweir uno_MapInterfaceFunc mapInterface; 87*cdf0e10cSrcweir } uno_Mapping; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir #if defined( SAL_W32) || defined(SAL_OS2) 90*cdf0e10cSrcweir #pragma pack(pop) 91*cdf0e10cSrcweir #endif 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir /** Gets an interface mapping from one environment to another. 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir @param ppMapping [inout] mapping; existing mapping will be released 96*cdf0e10cSrcweir @param pFrom source environment 97*cdf0e10cSrcweir @param pTo destination environment 98*cdf0e10cSrcweir (interfaces resulting in mapInterface() call can be used 99*cdf0e10cSrcweir in this language environment) 100*cdf0e10cSrcweir @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none) 101*cdf0e10cSrcweir */ 102*cdf0e10cSrcweir void SAL_CALL uno_getMapping( 103*cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 104*cdf0e10cSrcweir struct _uno_Environment * pFrom, 105*cdf0e10cSrcweir struct _uno_Environment * pTo, 106*cdf0e10cSrcweir rtl_uString * pAddPurpose ) 107*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir /** Callback function pointer declaration to get a mapping. 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir @param ppMapping inout mapping 112*cdf0e10cSrcweir @param pFrom source environment 113*cdf0e10cSrcweir @param pTo destination environment 114*cdf0e10cSrcweir @param pAddPurpose additional purpose 115*cdf0e10cSrcweir */ 116*cdf0e10cSrcweir typedef void (SAL_CALL * uno_getMappingFunc)( 117*cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 118*cdf0e10cSrcweir struct _uno_Environment * pFrom, 119*cdf0e10cSrcweir struct _uno_Environment * pTo, 120*cdf0e10cSrcweir rtl_uString * pAddPurpose ); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir /** Registers a callback being called each time a mapping is demanded. 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir @param pCallback callback function 125*cdf0e10cSrcweir */ 126*cdf0e10cSrcweir void SAL_CALL uno_registerMappingCallback( 127*cdf0e10cSrcweir uno_getMappingFunc pCallback ) 128*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir /** Revokes a mapping callback registration. 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir @param pCallback callback function 133*cdf0e10cSrcweir */ 134*cdf0e10cSrcweir void SAL_CALL uno_revokeMappingCallback( 135*cdf0e10cSrcweir uno_getMappingFunc pCallback ) 136*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir /** Function pointer declaration to free a mapping. 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir @param pMapping mapping to be freed 141*cdf0e10cSrcweir */ 142*cdf0e10cSrcweir typedef void (SAL_CALL * uno_freeMappingFunc)( struct _uno_Mapping * pMapping ); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir /** Registers a mapping. A mapping registers itself on first acquire and revokes itself on last 145*cdf0e10cSrcweir release. The given freeMapping function is called by the runtime to cleanup any resources. 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir @param ppMapping inout mapping to be registered 148*cdf0e10cSrcweir @param freeMapping called by runtime to delete mapping 149*cdf0e10cSrcweir @param pFrom source environment 150*cdf0e10cSrcweir @param pTo destination environment 151*cdf0e10cSrcweir @param pAddPurpose additional purpose string; defaults to 0 152*cdf0e10cSrcweir */ 153*cdf0e10cSrcweir void SAL_CALL uno_registerMapping( 154*cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, uno_freeMappingFunc freeMapping, 155*cdf0e10cSrcweir struct _uno_Environment * pFrom, struct _uno_Environment * pTo, rtl_uString * pAddPurpose ) 156*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir /** Revokes a mapping. A mapping registers itself on first acquire and revokes itself on last 159*cdf0e10cSrcweir release. 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir @param pMapping mapping to be revoked 162*cdf0e10cSrcweir */ 163*cdf0e10cSrcweir void SAL_CALL uno_revokeMapping( 164*cdf0e10cSrcweir struct _uno_Mapping * pMapping ) 165*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir /** Gets an interface mapping from one language environment to another by corresponding environment 168*cdf0e10cSrcweir type names. 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir @param ppMapping [inout] mapping; existing mapping will be released 171*cdf0e10cSrcweir @param pFrom source environment type name 172*cdf0e10cSrcweir @param pTo destination environment type name 173*cdf0e10cSrcweir (interfaces resulting in mapInterface() call can be used 174*cdf0e10cSrcweir in this language environment) 175*cdf0e10cSrcweir @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none) 176*cdf0e10cSrcweir */ 177*cdf0e10cSrcweir void SAL_CALL uno_getMappingByName( 178*cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 179*cdf0e10cSrcweir rtl_uString * pFrom, 180*cdf0e10cSrcweir rtl_uString * pTo, 181*cdf0e10cSrcweir rtl_uString * pAddPurpose ) 182*cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir /* symbol exported by each language binding library */ 185*cdf0e10cSrcweir #define UNO_EXT_GETMAPPING "uno_ext_getMapping" 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir /** Function pointer declaration to get a mapping from a loaded bridge. Bridges export a function 188*cdf0e10cSrcweir called uno_ext_getMapping() of this signature. 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir @param ppMapping [inout] mapping; existing mapping will be released 191*cdf0e10cSrcweir @pFrom source environment 192*cdf0e10cSrcweir @pTo destination environment 193*cdf0e10cSrcweir */ 194*cdf0e10cSrcweir typedef void (SAL_CALL * uno_ext_getMappingFunc)( 195*cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 196*cdf0e10cSrcweir struct _uno_Environment * pFrom, 197*cdf0e10cSrcweir struct _uno_Environment * pTo ); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir #ifdef __cplusplus 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir #endif 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir #endif 204