LibreOffice
LibreOffice 24.2 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 
20 /*
21  * This file is part of LibreOffice published API.
22  */
23 #ifndef INCLUDED_UNO_ENVIRONMENT_H
24 #define INCLUDED_UNO_ENVIRONMENT_H
25 
26 #include "cppu/cppudllapi.h"
27 #include "rtl/ustring.h"
28 
29 #include <stdarg.h>
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 struct _uno_ExtEnvironment;
38 
39 #if defined( _WIN32)
40 #pragma pack(push, 8)
41 #endif
42 
45 typedef struct SAL_DLLPUBLIC_RTTI _uno_Environment
46 {
49  void * pReserved;
50 
53  rtl_uString * pTypeName;
54 
57  void * pContext;
58 
62 
67  void (SAL_CALL * acquire)( struct _uno_Environment * pEnv );
68 
74  void (SAL_CALL * release)( struct _uno_Environment * pEnv );
75 
81  void (SAL_CALL * acquireWeak)( struct _uno_Environment * pEnv );
82 
87  void (SAL_CALL * releaseWeak)( struct _uno_Environment * pEnv );
88 
95  void (SAL_CALL * harden)(
96  struct _uno_Environment ** ppHardEnv,
97  struct _uno_Environment * pEnv );
98 
104  void (SAL_CALL * dispose)( struct _uno_Environment * pEnv );
105 
106  /* ===== the following part will be late initialized by a matching bridge ===== *
107  * ===== and is NOT for public use. ===== */
108 
114  void (SAL_CALL * environmentDisposing)( struct _uno_Environment * pEnv );
116 
126 typedef void (SAL_CALL * uno_freeProxyFunc)( struct _uno_ExtEnvironment * pEnv, void * pProxy );
127 
133 typedef void * (SAL_CALL * uno_memAlloc)( sal_Size nBytes );
134 
137 typedef struct SAL_DLLPUBLIC_RTTI _uno_ExtEnvironment
138 {
142 
150  void (SAL_CALL * registerInterface)(
151  struct _uno_ExtEnvironment * pEnv,
152  void ** ppInterface,
153  rtl_uString * pOId,
154  struct _typelib_InterfaceTypeDescription * pTypeDescr );
155 
165  void (SAL_CALL * registerProxyInterface)(
166  struct _uno_ExtEnvironment * pEnv,
167  void ** ppProxy,
168  uno_freeProxyFunc freeProxy,
169  rtl_uString * pOId,
170  struct _typelib_InterfaceTypeDescription * pTypeDescr );
171 
178  void (SAL_CALL * revokeInterface)(
179  struct _uno_ExtEnvironment * pEnv,
180  void * pInterface );
181 
187  void (SAL_CALL * getObjectIdentifier)(
188  struct _uno_ExtEnvironment * pEnv,
189  rtl_uString ** ppOId,
190  void * pInterface );
191 
200  void (SAL_CALL * getRegisteredInterface)(
201  struct _uno_ExtEnvironment * pEnv,
202  void ** ppInterface,
203  rtl_uString * pOId,
204  struct _typelib_InterfaceTypeDescription * pTypeDescr );
205 
214  void (SAL_CALL * getRegisteredInterfaces)(
215  struct _uno_ExtEnvironment * pEnv,
216  void *** pppInterfaces,
217  sal_Int32 * pnLen,
218  uno_memAlloc memAlloc );
219 
220  /* ===== the following part will be late initialized by a matching bridge ===== */
221 
228  void (SAL_CALL * computeObjectIdentifier)(
229  struct _uno_ExtEnvironment * pEnv,
230  rtl_uString ** ppOId, void * pInterface );
231 
237  void (SAL_CALL * acquireInterface)(
238  struct _uno_ExtEnvironment * pEnv,
239  void * pInterface );
240 
246  void (SAL_CALL * releaseInterface)(
247  struct _uno_ExtEnvironment * pEnv,
248  void * pInterface );
249 
251 
252 #if defined( _WIN32)
253 #pragma pack(pop)
254 #endif
255 
261 typedef void (SAL_CALL * uno_initEnvironmentFunc)( uno_Environment * pEnv );
262 #define UNO_INIT_ENVIRONMENT "uno_initEnvironment"
263 
264 #ifdef DISABLE_DYNLOADING
265 /* We link statically and have just the C++ environment */
266 void SAL_CALL CPPU_ENV_uno_initEnvironment( uno_Environment * Env )
268 
269 /* We might also have the Java environment */
270 void SAL_CALL java_uno_initEnvironment( uno_Environment * Env )
272 #endif
273 
281 CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment(
282  uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
284 
294  uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc,
295  rtl_uString * pEnvDcp )
297 
305  uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
307 
314 CPPU_DLLPUBLIC void SAL_CALL uno_dumpEnvironment(
315  void * stream, uno_Environment * pEnv, const char * pFilter )
324  void * stream, rtl_uString * pEnvDcp, const char * pFilter )
326 
327 
328 
337 CPPU_DLLPUBLIC void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl_uString * pTypeName)
339 
342 typedef void SAL_CALL uno_EnvCallee(va_list * pParam);
343 
351 CPPU_DLLPUBLIC void SAL_CALL uno_Environment_invoke_v(uno_Environment * pEnv, uno_EnvCallee * pCallee, va_list * pParam)
353 
361 CPPU_DLLPUBLIC void SAL_CALL uno_Environment_invoke (uno_Environment * pEnv, uno_EnvCallee * pCallee, ...)
363 
371 
380 CPPU_DLLPUBLIC int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_uString ** pReason)
382 
383 #ifdef __cplusplus
384 }
385 #endif
386 
387 #endif
388 
389 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CPPU_DLLPUBLIC void uno_dumpEnvironmentByName(void *stream, rtl_uString *pEnvDcp, const char *pFilter) SAL_THROW_EXTERN_C()
Dumps out environment information, i.e.
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:334
void(* release)(struct _uno_Environment *pEnv)
Releases this environment; last release of environment will revoke the environment from runtime...
Definition: environment.h:74
CPPU_DLLPUBLIC void uno_Environment_enter(uno_Environment *pEnv) SAL_THROW_EXTERN_C()
Enter an environment explicitly.
void uno_EnvCallee(va_list *pParam)
Typedef for variable argument function.
Definition: environment.h:342
void * pContext
free context pointer to be used for specific classes of environments (e.g., a jvm pointer) ...
Definition: environment.h:57
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:200
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.
void * pReserved
reserved for future use (0 if not used)
Definition: environment.h:49
CPPU_DLLPUBLIC void uno_Environment_invoke(uno_Environment *pEnv, uno_EnvCallee *pCallee,...) SAL_THROW_EXTERN_C()
Invoke the passed function in the given environment.
void *(* uno_memAlloc)(sal_Size nBytes)
Generic function pointer declaration to allocate memory.
Definition: environment.h:133
CPPU_DLLPUBLIC void uno_getEnvironment(uno_Environment **ppEnv, rtl_uString *pEnvDcp, void *pContext) SAL_THROW_EXTERN_C()
Gets a specific environment.
CPPU_DLLPUBLIC void uno_dumpEnvironment(void *stream, uno_Environment *pEnv, const char *pFilter) SAL_THROW_EXTERN_C()
Dumps out environment information, i.e.
void(* environmentDisposing)(struct _uno_Environment *pEnv)
CALLBACK function pointer: Disposing callback function pointer that can be set to get signalled befor...
Definition: environment.h:114
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...
struct SAL_DLLPUBLIC_RTTI _uno_Environment uno_Environment
The binary specification of a UNO environment.
void(* releaseInterface)(struct _uno_ExtEnvironment *pEnv, void *pInterface)
Function to release an interface.
Definition: environment.h:246
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:13
struct SAL_DLLPUBLIC_RTTI _uno_ExtEnvironment uno_ExtEnvironment
The binary specification of a UNO environment supporting interface registration.
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:228
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:126
void(* acquireWeak)(struct _uno_Environment *pEnv)
Acquires this environment weakly.
Definition: environment.h:81
void(* harden)(struct _uno_Environment **ppHardEnv, struct _uno_Environment *pEnv)
Makes hard reference out of weak referenced environment.
Definition: environment.h:95
Type description of an interface.
Definition: typedescription.h:374
CPPU_DLLPUBLIC void uno_createEnvironment(uno_Environment **ppEnv, rtl_uString *pEnvDcp, void *pContext) SAL_THROW_EXTERN_C()
Creates an environment.
CPPU_DLLPUBLIC void uno_getCurrentEnvironment(uno_Environment **ppEnv, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
Returns the current Environment.
The binary specification of a UNO environment supporting interface registration.
Definition: environment.h:137
rtl_uString * pTypeName
type name of environment
Definition: environment.h:53
struct _uno_ExtEnvironment * pExtEnv
pointer to extended environment (interface registration functionality), if supported ...
Definition: environment.h:61
void(* acquireInterface)(struct _uno_ExtEnvironment *pEnv, void *pInterface)
Function to acquire an interface.
Definition: environment.h:237
void(* dispose)(struct _uno_Environment *pEnv)
Call this function to EXPLICITLY dispose this environment (e.g., release all interfaces).
Definition: environment.h:104
The binary specification of a UNO environment.
Definition: environment.h:45
uno_Environment aBase
inherits all members of a uno_Environment
Definition: environment.h:141
void(* releaseWeak)(struct _uno_Environment *pEnv)
Releases this environment weakly in correspondence to acquireWeak().
Definition: environment.h:87
void(* getObjectIdentifier)(struct _uno_ExtEnvironment *pEnv, rtl_uString **ppOId, void *pInterface)
Provides the object id of a given interface.
Definition: environment.h:187
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(* uno_initEnvironmentFunc)(uno_Environment *pEnv)
Function exported by some bridge library providing acquireInterface(), releaseInterface(); may set a ...
Definition: environment.h:261