Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / uno / mapping.h
blob5a55fbf68b45b9bbb6c8720ef92f68cf963aff87
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_UNO_MAPPING_H
20 #define INCLUDED_UNO_MAPPING_H
22 #include <cppu/cppudllapi.h>
23 #include <rtl/ustring.h>
26 #ifdef __cplusplus
27 extern "C"
29 #endif
31 struct _typelib_InterfaceTypeDescription;
32 struct _uno_Mapping;
33 struct _uno_Environment;
35 /**
36 Function pointer declaration to acquire a UNO mapping.
38 typedef void (SAL_CALL * uno_AcquireMappingFunc)(struct _uno_Mapping *);
40 /**
41 Function pointer declaration to release a UNO mapping.
43 typedef void (SAL_CALL * uno_ReleaseMappingFunc)(struct _uno_Mapping *);
45 /** Function pointer declaration to map an interface from one environment to another.
47 @param pMapping mapping
48 @param ppOut [inout] destination interface; existing interfaces are released
49 @param pInterface source interface
50 @param pInterfaceTypeDescr type description of the interface
52 typedef void (SAL_CALL * uno_MapInterfaceFunc)(
53 struct _uno_Mapping * pMapping,
54 void ** ppOut, void * pInterface,
55 struct _typelib_InterfaceTypeDescription * pInterfaceTypeDescr );
58 #if defined( SAL_W32)
59 #pragma pack(push, 8)
60 #endif
62 /** This is the binary specification of a mapping.
64 typedef struct SAL_DLLPUBLIC_RTTI _uno_Mapping
66 /** Acquires mapping
68 uno_AcquireMappingFunc acquire;
70 /** Releases mapping. The last release may unload bridges.
72 uno_ReleaseMappingFunc release;
74 /** mapping function
76 uno_MapInterfaceFunc mapInterface;
77 } uno_Mapping;
79 #if defined( SAL_W32)
80 #pragma pack(pop)
81 #endif
83 /** Gets an interface mapping from one environment to another.
85 @param ppMapping [inout] mapping; existing mapping will be released
86 @param pFrom source environment
87 @param pTo destination environment
88 (interfaces resulting in mapInterface() call can be used
89 in this language environment)
90 @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none)
92 CPPU_DLLPUBLIC void SAL_CALL uno_getMapping(
93 struct _uno_Mapping ** ppMapping,
94 struct _uno_Environment * pFrom,
95 struct _uno_Environment * pTo,
96 rtl_uString * pAddPurpose )
97 SAL_THROW_EXTERN_C();
99 /** Callback function pointer declaration to get a mapping.
101 @param ppMapping inout mapping
102 @param pFrom source environment
103 @param pTo destination environment
104 @param pAddPurpose additional purpose
106 typedef void (SAL_CALL * uno_getMappingFunc)(
107 struct _uno_Mapping ** ppMapping,
108 struct _uno_Environment * pFrom,
109 struct _uno_Environment * pTo,
110 rtl_uString * pAddPurpose );
112 /** Registers a callback being called each time a mapping is demanded.
114 @param pCallback callback function
116 CPPU_DLLPUBLIC void SAL_CALL uno_registerMappingCallback(
117 uno_getMappingFunc pCallback )
118 SAL_THROW_EXTERN_C();
120 /** Revokes a mapping callback registration.
122 @param pCallback callback function
124 CPPU_DLLPUBLIC void SAL_CALL uno_revokeMappingCallback(
125 uno_getMappingFunc pCallback )
126 SAL_THROW_EXTERN_C();
128 /** Function pointer declaration to free a mapping.
130 @param pMapping mapping to be freed
132 typedef void (SAL_CALL * uno_freeMappingFunc)( struct _uno_Mapping * pMapping );
134 /** Registers a mapping. A mapping registers itself on first acquire and revokes itself on last
135 release. The given freeMapping function is called by the runtime to cleanup any resources.
137 @param ppMapping inout mapping to be registered
138 @param freeMapping called by runtime to delete mapping
139 @param pFrom source environment
140 @param pTo destination environment
141 @param pAddPurpose additional purpose string; defaults to 0
143 CPPU_DLLPUBLIC void SAL_CALL uno_registerMapping(
144 struct _uno_Mapping ** ppMapping, uno_freeMappingFunc freeMapping,
145 struct _uno_Environment * pFrom, struct _uno_Environment * pTo, rtl_uString * pAddPurpose )
146 SAL_THROW_EXTERN_C();
148 /** Revokes a mapping. A mapping registers itself on first acquire and revokes itself on last
149 release.
151 @param pMapping mapping to be revoked
153 CPPU_DLLPUBLIC void SAL_CALL uno_revokeMapping(
154 struct _uno_Mapping * pMapping )
155 SAL_THROW_EXTERN_C();
157 /** Gets an interface mapping from one language environment to another by corresponding environment
158 type names.
160 @param ppMapping [inout] mapping; existing mapping will be released
161 @param pFrom source environment type name
162 @param pTo destination environment type name
163 (interfaces resulting in mapInterface() call can be used
164 in this language environment)
165 @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none)
167 CPPU_DLLPUBLIC void SAL_CALL uno_getMappingByName(
168 struct _uno_Mapping ** ppMapping,
169 rtl_uString * pFrom,
170 rtl_uString * pTo,
171 rtl_uString * pAddPurpose )
172 SAL_THROW_EXTERN_C();
174 /* symbol exported by each language binding library */
175 #define UNO_EXT_GETMAPPING "uno_ext_getMapping"
177 /** Function pointer declaration to get a mapping from a loaded bridge. Bridges export a function
178 called uno_ext_getMapping() of this signature.
180 @param[in,out] ppMapping mapping; existing mapping will be released
181 @param[in] pFrom source environment
182 @param[in] pTo destination environment
184 typedef void (SAL_CALL * uno_ext_getMappingFunc)(
185 struct _uno_Mapping ** ppMapping,
186 struct _uno_Environment * pFrom,
187 struct _uno_Environment * pTo );
189 #ifdef DISABLE_DYNLOADING
190 /* Static linking, this is the uno_ext_getMapping function in the C++/UNO bridge */
191 void SAL_CALL CPPU_ENV_uno_ext_getMapping(
192 struct _uno_Mapping ** ppMapping,
193 struct _uno_Environment * pFrom,
194 struct _uno_Environment * pTo )
195 SAL_THROW_EXTERN_C();
197 /* This is the uno_ext_getMapping function in the Java/UNO bridge */
198 void SAL_CALL java_uno_ext_getMapping(
199 struct _uno_Mapping ** ppMapping,
200 struct _uno_Environment * pFrom,
201 struct _uno_Environment * pTo )
202 SAL_THROW_EXTERN_C();
204 #endif
206 #ifdef __cplusplus
208 #endif
210 #endif
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */