LibreOffice
LibreOffice 6.0 SDK C/C++ API Reference
environment.h
Go to the documentation of this file.
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 #ifndef INCLUDED_UNO_ENVIRONMENT_H
20 #define INCLUDED_UNO_ENVIRONMENT_H
21 
22 #include <cppu/cppudllapi.h>
23 #include <rtl/ustring.h>
24 
25 #include <stdarg.h>
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 struct _uno_ExtEnvironment;
34 
35 #if defined( SAL_W32)
36 #pragma pack(push, 8)
37 #endif
38 
41 typedef struct SAL_DLLPUBLIC_RTTI _uno_Environment
42 {
45  void * pReserved;
46 
49  rtl_uString * pTypeName;
50 
53  void * pContext;
54 
58 
63  void (SAL_CALL * acquire)( struct _uno_Environment * pEnv );
64 
70  void (SAL_CALL * release)( struct _uno_Environment * pEnv );
71 
77  void (SAL_CALL * acquireWeak)( struct _uno_Environment * pEnv );
78 
83  void (SAL_CALL * releaseWeak)( struct _uno_Environment * pEnv );
84 
91  void (SAL_CALL * harden)(
92  struct _uno_Environment ** ppHardEnv,
93  struct _uno_Environment * pEnv );
94 
100  void (SAL_CALL * dispose)( struct _uno_Environment * pEnv );
101 
102  /* ===== the following part will be late initialized by a matching bridge ===== *
103  * ===== and is NOT for public use. ===== */
104 
110  void (SAL_CALL * environmentDisposing)( struct _uno_Environment * pEnv );
112 
122 typedef void (SAL_CALL * uno_freeProxyFunc)( struct _uno_ExtEnvironment * pEnv, void * pProxy );
123 
129 typedef void * (SAL_CALL * uno_memAlloc)( sal_Size nBytes );
130 
133 typedef struct SAL_DLLPUBLIC_RTTI _uno_ExtEnvironment
134 {
138 
146  void (SAL_CALL * registerInterface)(
147  struct _uno_ExtEnvironment * pEnv,
148  void ** ppInterface,
149  rtl_uString * pOId,
150  struct _typelib_InterfaceTypeDescription * pTypeDescr );
151 
161  void (SAL_CALL * registerProxyInterface)(
162  struct _uno_ExtEnvironment * pEnv,
163  void ** ppProxy,
164  uno_freeProxyFunc freeProxy,
165  rtl_uString * pOId,
166  struct _typelib_InterfaceTypeDescription * pTypeDescr );
167 
174  void (SAL_CALL * revokeInterface)(
175  struct _uno_ExtEnvironment * pEnv,
176  void * pInterface );
177 
183  void (SAL_CALL * getObjectIdentifier)(
184  struct _uno_ExtEnvironment * pEnv,
185  rtl_uString ** ppOId,
186  void * pInterface );
187 
196  void (SAL_CALL * getRegisteredInterface)(
197  struct _uno_ExtEnvironment * pEnv,
198  void ** ppInterface,
199  rtl_uString * pOId,
200  struct _typelib_InterfaceTypeDescription * pTypeDescr );
201 
210  void (SAL_CALL * getRegisteredInterfaces)(
211  struct _uno_ExtEnvironment * pEnv,
212  void *** pppInterfaces,
213  sal_Int32 * pnLen,
214  uno_memAlloc memAlloc );
215 
216  /* ===== the following part will be late initialized by a matching bridge ===== */
217 
224  void (SAL_CALL * computeObjectIdentifier)(
225  struct _uno_ExtEnvironment * pEnv,
226  rtl_uString ** ppOId, void * pInterface );
227 
233  void (SAL_CALL * acquireInterface)(
234  struct _uno_ExtEnvironment * pEnv,
235  void * pInterface );
236 
242  void (SAL_CALL * releaseInterface)(
243  struct _uno_ExtEnvironment * pEnv,
244  void * pInterface );
245 
247 
248 #if defined( SAL_W32)
249 #pragma pack(pop)
250 #endif
251 
257 typedef void (SAL_CALL * uno_initEnvironmentFunc)( uno_Environment * pEnv );
258 #define UNO_INIT_ENVIRONMENT "uno_initEnvironment"
259 
260 #ifdef DISABLE_DYNLOADING
261 /* We link statically and have just the C++ environment */
262 void SAL_CALL CPPU_ENV_uno_initEnvironment( uno_Environment * Env )
264 
265 /* We might also have the Java environment */
266 void SAL_CALL java_uno_initEnvironment( uno_Environment * Env )
268 #endif
269 
277 CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment(
278  uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
280 
290  uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc,
291  rtl_uString * pEnvDcp )
293 
301  uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
303 
310 CPPU_DLLPUBLIC void SAL_CALL uno_dumpEnvironment(
311  void * stream, uno_Environment * pEnv, const sal_Char * pFilter )
320  void * stream, rtl_uString * pEnvDcp, const sal_Char * pFilter )
322 
323 
324 
333 CPPU_DLLPUBLIC void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl_uString * pTypeName)
335 
338 typedef void SAL_CALL uno_EnvCallee(va_list * pParam);
339 
347 CPPU_DLLPUBLIC void SAL_CALL uno_Environment_invoke_v(uno_Environment * pEnv, uno_EnvCallee * pCallee, va_list * pParam)
349 
357 CPPU_DLLPUBLIC void SAL_CALL uno_Environment_invoke (uno_Environment * pEnv, uno_EnvCallee * pCallee, ...)
359 
367 
376 CPPU_DLLPUBLIC int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_uString ** pReason)
377  SAL_THROW_EXTERN_C();
378 
379 #ifdef __cplusplus
380 }
381 #endif
382 
383 #endif
384 
385 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CPPU_DLLPUBLIC void uno_createEnvironment(uno_Environment **ppEnv, rtl_uString *pEnvDcp, void *pContext) SAL_THROW_EXTERN_C()
Creates an environment.
CPPU_DLLPUBLIC void uno_Environment_invoke(uno_Environment *pEnv, uno_EnvCallee *pCallee,...) SAL_THROW_EXTERN_C()
Invoke the passed function in the given environment.
char sal_Char
A legacy synonym for char.
Definition: types.h:121
The binary specification of an UNO environment.
Definition: environment.h:41
struct SAL_DLLPUBLIC_RTTI _uno_ExtEnvironment uno_ExtEnvironment
The binary specification of an UNO environment supporting interface registration. ...
void(* uno_freeProxyFunc)(struct _uno_ExtEnvironment *pEnv, void *pProxy)
Generic function pointer declaration to free a proxy object if it is not needed by the environment an...
Definition: environment.h:122
CPPU_DLLPUBLIC void uno_getEnvironment(uno_Environment **ppEnv, rtl_uString *pEnvDcp, void *pContext) SAL_THROW_EXTERN_C()
Gets a specific environment.
rtl_uString * pTypeName
type name of environment
Definition: environment.h:49
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:10
void(* releaseInterface)(struct _uno_ExtEnvironment *pEnv, void *pInterface)
Function to release an interface.
Definition: environment.h:242
void uno_EnvCallee(va_list *pParam)
Typedef for variable argument function.
Definition: environment.h:338
Type description of an interface.
Definition: typedescription.h:370
CPPU_DLLPUBLIC void uno_getRegisteredEnvironments(uno_Environment ***pppEnvs, sal_Int32 *pnLen, uno_memAlloc memAlloc, rtl_uString *pEnvDcp) SAL_THROW_EXTERN_C()
Gets all specified environments.
CPPU_DLLPUBLIC void uno_Environment_invoke_v(uno_Environment *pEnv, uno_EnvCallee *pCallee, va_list *pParam) SAL_THROW_EXTERN_C()
Invoke the passed function in the given environment.
void(* acquireWeak)(struct _uno_Environment *pEnv)
Acquires this environment weakly.
Definition: environment.h:77
uno_Environment aBase
inherits all members of an uno_Environment
Definition: environment.h:137
void * pContext
free context pointer to be used for specific classes of environments (e.g., a jvm pointer) ...
Definition: environment.h:53
void(* computeObjectIdentifier)(struct _uno_ExtEnvironment *pEnv, rtl_uString **ppOId, void *pInterface)
Computes an object id of the given interface; is called by the environment implementation.
Definition: environment.h:224
CPPU_DLLPUBLIC int uno_Environment_isValid(uno_Environment *pEnv, rtl_uString **pReason) SAL_THROW_EXTERN_C()
Check if a particular environment is currently valid, so that objects of that environment might be ca...
CPPU_DLLPUBLIC void uno_Environment_enter(uno_Environment *pEnv) SAL_THROW_EXTERN_C()
Enter an environment explicitly.
struct _uno_ExtEnvironment * pExtEnv
pointer to extended environment (interface registration functionality), if supported ...
Definition: environment.h:57
CPPU_DLLPUBLIC void uno_dumpEnvironment(void *stream, uno_Environment *pEnv, const sal_Char *pFilter) SAL_THROW_EXTERN_C()
Dumps out environment information, i.e.
void(* uno_initEnvironmentFunc)(uno_Environment *pEnv)
Function exported by some bridge library providing acquireInterface(), releaseInterface(); may set a ...
Definition: environment.h:257
void(* releaseWeak)(struct _uno_Environment *pEnv)
Releases this environment weakly in correspondence to acquireWeak().
Definition: environment.h:83
void * pReserved
reserved for future use (0 if not used)
Definition: environment.h:45
void(* release)(struct _uno_Environment *pEnv)
Releases this environment; last release of environment will revoke the environment from runtime...
Definition: environment.h:70
void(* getRegisteredInterface)(struct _uno_ExtEnvironment *pEnv, void **ppInterface, rtl_uString *pOId, struct _typelib_InterfaceTypeDescription *pTypeDescr)
Retrieves an interface identified by its object id and type from this environment.
Definition: environment.h:196
void(* environmentDisposing)(struct _uno_Environment *pEnv)
CALLBACK function pointer: Disposing callback function pointer that can be set to get signalled befor...
Definition: environment.h:110
void *(* uno_memAlloc)(sal_Size nBytes)
Generic function pointer declaration to allocate memory.
Definition: environment.h:129
The binary specification of an UNO environment supporting interface registration. ...
Definition: environment.h:133
void(* harden)(struct _uno_Environment **ppHardEnv, struct _uno_Environment *pEnv)
Makes hard reference out of weak referenced environment.
Definition: environment.h:91
void(* dispose)(struct _uno_Environment *pEnv)
Call this function to EXPLICITLY dispose this environment (e.g., release all interfaces).
Definition: environment.h:100
void(* acquireInterface)(struct _uno_ExtEnvironment *pEnv, void *pInterface)
Function to acquire an interface.
Definition: environment.h:233
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:352
CPPU_DLLPUBLIC void uno_dumpEnvironmentByName(void *stream, rtl_uString *pEnvDcp, const sal_Char *pFilter) SAL_THROW_EXTERN_C()
Dumps out environment information, i.e.
struct SAL_DLLPUBLIC_RTTI _uno_Environment uno_Environment
The binary specification of an UNO environment.
void(* getObjectIdentifier)(struct _uno_ExtEnvironment *pEnv, rtl_uString **ppOId, void *pInterface)
Provides the object id of a given interface.
Definition: environment.h:183
CPPU_DLLPUBLIC void uno_getCurrentEnvironment(uno_Environment **ppEnv, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
Returns the current Environment.