1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_UNO_MAPPING_H
24 #define INCLUDED_UNO_MAPPING_H
26 #include "cppu/cppudllapi.h"
27 #include "rtl/ustring.h"
35 struct _typelib_InterfaceTypeDescription
;
37 struct _uno_Environment
;
40 Function pointer declaration to acquire a UNO mapping.
42 typedef void (SAL_CALL
* uno_AcquireMappingFunc
)(struct _uno_Mapping
*);
45 Function pointer declaration to release a UNO mapping.
47 typedef void (SAL_CALL
* uno_ReleaseMappingFunc
)(struct _uno_Mapping
*);
49 /** Function pointer declaration to map an interface from one environment to another.
51 @param pMapping mapping
52 @param ppOut [inout] destination interface; existing interfaces are released
53 @param pInterface source interface
54 @param pInterfaceTypeDescr type description of the interface
56 typedef void (SAL_CALL
* uno_MapInterfaceFunc
)(
57 struct _uno_Mapping
* pMapping
,
58 void ** ppOut
, void * pInterface
,
59 struct _typelib_InterfaceTypeDescription
* pInterfaceTypeDescr
);
66 /** This is the binary specification of a mapping.
68 typedef struct SAL_DLLPUBLIC_RTTI _uno_Mapping
72 uno_AcquireMappingFunc acquire
;
74 /** Releases mapping. The last release may unload bridges.
76 uno_ReleaseMappingFunc release
;
80 uno_MapInterfaceFunc mapInterface
;
87 /** Gets an interface mapping from one environment to another.
89 @param ppMapping [inout] mapping; existing mapping will be released
90 @param pFrom source environment
91 @param pTo destination environment
92 (interfaces resulting in mapInterface() call can be used
93 in this language environment)
94 @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none)
96 CPPU_DLLPUBLIC
void SAL_CALL
uno_getMapping(
97 struct _uno_Mapping
** ppMapping
,
98 struct _uno_Environment
* pFrom
,
99 struct _uno_Environment
* pTo
,
100 rtl_uString
* pAddPurpose
)
101 SAL_THROW_EXTERN_C();
103 /** Callback function pointer declaration to get a mapping.
105 @param ppMapping inout mapping
106 @param pFrom source environment
107 @param pTo destination environment
108 @param pAddPurpose additional purpose
110 typedef void (SAL_CALL
* uno_getMappingFunc
)(
111 struct _uno_Mapping
** ppMapping
,
112 struct _uno_Environment
* pFrom
,
113 struct _uno_Environment
* pTo
,
114 rtl_uString
* pAddPurpose
);
116 /** Registers a callback being called each time a mapping is demanded.
118 @param pCallback callback function
120 CPPU_DLLPUBLIC
void SAL_CALL
uno_registerMappingCallback(
121 uno_getMappingFunc pCallback
)
122 SAL_THROW_EXTERN_C();
124 /** Revokes a mapping callback registration.
126 @param pCallback callback function
128 CPPU_DLLPUBLIC
void SAL_CALL
uno_revokeMappingCallback(
129 uno_getMappingFunc pCallback
)
130 SAL_THROW_EXTERN_C();
132 /** Function pointer declaration to free a mapping.
134 @param pMapping mapping to be freed
136 typedef void (SAL_CALL
* uno_freeMappingFunc
)( struct _uno_Mapping
* pMapping
);
138 /** Registers a mapping. A mapping registers itself on first acquire and revokes itself on last
139 release. The given freeMapping function is called by the runtime to cleanup any resources.
141 @param ppMapping inout mapping to be registered
142 @param freeMapping called by runtime to delete mapping
143 @param pFrom source environment
144 @param pTo destination environment
145 @param pAddPurpose additional purpose string; defaults to 0
147 CPPU_DLLPUBLIC
void SAL_CALL
uno_registerMapping(
148 struct _uno_Mapping
** ppMapping
, uno_freeMappingFunc freeMapping
,
149 struct _uno_Environment
* pFrom
, struct _uno_Environment
* pTo
, rtl_uString
* pAddPurpose
)
150 SAL_THROW_EXTERN_C();
152 /** Revokes a mapping. A mapping registers itself on first acquire and revokes itself on last
155 @param pMapping mapping to be revoked
157 CPPU_DLLPUBLIC
void SAL_CALL
uno_revokeMapping(
158 struct _uno_Mapping
* pMapping
)
159 SAL_THROW_EXTERN_C();
161 /** Gets an interface mapping from one language environment to another by corresponding environment
164 @param ppMapping [inout] mapping; existing mapping will be released
165 @param pFrom source environment type name
166 @param pTo destination environment type name
167 (interfaces resulting in mapInterface() call can be used
168 in this language environment)
169 @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none)
171 CPPU_DLLPUBLIC
void SAL_CALL
uno_getMappingByName(
172 struct _uno_Mapping
** ppMapping
,
175 rtl_uString
* pAddPurpose
)
176 SAL_THROW_EXTERN_C();
178 /* symbol exported by each language binding library */
179 #define UNO_EXT_GETMAPPING "uno_ext_getMapping"
181 /** Function pointer declaration to get a mapping from a loaded bridge. Bridges export a function
182 called uno_ext_getMapping() of this signature.
184 @param[in,out] ppMapping mapping; existing mapping will be released
185 @param[in] pFrom source environment
186 @param[in] pTo destination environment
188 typedef void (SAL_CALL
* uno_ext_getMappingFunc
)(
189 struct _uno_Mapping
** ppMapping
,
190 struct _uno_Environment
* pFrom
,
191 struct _uno_Environment
* pTo
);
193 #ifdef DISABLE_DYNLOADING
194 /* Static linking, this is the uno_ext_getMapping function in the C++/UNO bridge */
195 void SAL_CALL
CPPU_ENV_uno_ext_getMapping(
196 struct _uno_Mapping
** ppMapping
,
197 struct _uno_Environment
* pFrom
,
198 struct _uno_Environment
* pTo
)
199 SAL_THROW_EXTERN_C();
201 /* This is the uno_ext_getMapping function in the Java/UNO bridge */
202 void SAL_CALL
java_uno_ext_getMapping(
203 struct _uno_Mapping
** ppMapping
,
204 struct _uno_Environment
* pFrom
,
205 struct _uno_Environment
* pTo
)
206 SAL_THROW_EXTERN_C();
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */