xref: /aoo41x/main/cppu/inc/uno/any2.h (revision cdf0e10c)
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_ANY2_H_
28*cdf0e10cSrcweir #define _UNO_ANY2_H_
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <sal/types.h>
31*cdf0e10cSrcweir #include <uno/data.h>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #ifdef __cplusplus
34*cdf0e10cSrcweir extern "C"
35*cdf0e10cSrcweir {
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #if defined( SAL_W32)
39*cdf0e10cSrcweir #pragma pack(push, 8)
40*cdf0e10cSrcweir #elif defined(SAL_OS2)
41*cdf0e10cSrcweir #pragma pack(push, 8)
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir struct _typelib_TypeDescriptionReference;
45*cdf0e10cSrcweir struct _typelib_TypeDescription;
46*cdf0e10cSrcweir struct _uno_Mapping;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir /** This is the binary specification of an UNO any.
49*cdf0e10cSrcweir */
50*cdf0e10cSrcweir typedef struct _uno_Any
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	/** type of value
53*cdf0e10cSrcweir 	*/
54*cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType;
55*cdf0e10cSrcweir 	/** pointer to value; this may point to pReserved and thus the uno_Any is not anytime
56*cdf0e10cSrcweir         mem-copyable! You may have to correct the pData pointer to pReserved. Otherwise you need
57*cdf0e10cSrcweir         not, because the data is stored in heap space.
58*cdf0e10cSrcweir 	*/
59*cdf0e10cSrcweir 	void * pData;
60*cdf0e10cSrcweir     /** reserved space for storing value
61*cdf0e10cSrcweir     */
62*cdf0e10cSrcweir     void * pReserved;
63*cdf0e10cSrcweir } uno_Any;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir #if defined( SAL_W32) ||  defined(SAL_OS2)
66*cdf0e10cSrcweir #pragma pack(pop)
67*cdf0e10cSrcweir #endif
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir /** Assign an any with a given value. Interfaces are acquired or released by the given callback
70*cdf0e10cSrcweir     functions.
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir 	@param pDest			pointer memory of destination any
73*cdf0e10cSrcweir 	@param pSource			pointer to source value; defaults (0) to default constructed value
74*cdf0e10cSrcweir 	@param pTypeDescr		type description of value; defaults (0) to void
75*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
76*cdf0e10cSrcweir                             defaults (0) to uno
77*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
78*cdf0e10cSrcweir                             defaults (0) to uno
79*cdf0e10cSrcweir */
80*cdf0e10cSrcweir void SAL_CALL uno_any_assign(
81*cdf0e10cSrcweir 	uno_Any * pDest, void * pSource,
82*cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr,
83*cdf0e10cSrcweir 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
84*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
85*cdf0e10cSrcweir /** Assign an any with a given value. Interfaces are acquired or released by the given callback
86*cdf0e10cSrcweir     functions.
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 	@param pDest			pointer memory of destination any
89*cdf0e10cSrcweir 	@param pSource			pointer to source value; defaults (0) to default constructed value
90*cdf0e10cSrcweir 	@param pTypeDescr		type description of value; defaults (0) to void
91*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
92*cdf0e10cSrcweir                             defaults (0) to uno
93*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
94*cdf0e10cSrcweir                             defaults (0) to uno
95*cdf0e10cSrcweir */
96*cdf0e10cSrcweir void SAL_CALL uno_type_any_assign(
97*cdf0e10cSrcweir 	uno_Any * pDest, void * pSource,
98*cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType,
99*cdf0e10cSrcweir 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
100*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir /** Constructs an any with a given value. Interfaces are acquired by the given callback function.
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 	@param pDest			pointer memory of destination any
105*cdf0e10cSrcweir 	@param pSource			pointer to source value; defaults (0) to default constructed value
106*cdf0e10cSrcweir 	@param pTypeDescr		type description of value; defaults (0) to void
107*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
108*cdf0e10cSrcweir                             defaults (0) to uno
109*cdf0e10cSrcweir */
110*cdf0e10cSrcweir void SAL_CALL uno_any_construct(
111*cdf0e10cSrcweir 	uno_Any * pDest, void * pSource,
112*cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr,
113*cdf0e10cSrcweir 	uno_AcquireFunc acquire )
114*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
115*cdf0e10cSrcweir /** Constructs an any with a given value. Interfaces are acquired by the given callback function.
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	@param pDest			pointer memory of destination any
118*cdf0e10cSrcweir 	@param pSource			pointer to source value; defaults (0) to default constructed value
119*cdf0e10cSrcweir 	@param pType			type of value; defaults (0) to void
120*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
121*cdf0e10cSrcweir                             defaults (0) to uno
122*cdf0e10cSrcweir */
123*cdf0e10cSrcweir void SAL_CALL uno_type_any_construct(
124*cdf0e10cSrcweir 	uno_Any * pDest, void * pSource,
125*cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType,
126*cdf0e10cSrcweir 	uno_AcquireFunc acquire )
127*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir /** Constructs an any with a given value and converts/ maps interfaces.
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	@param pDest			pointer memory of destination any
132*cdf0e10cSrcweir 	@param pSource			pointer to source value; defaults (0) to default constructed value
133*cdf0e10cSrcweir 	@param pTypeDescr		type description of value; defaults (0) to void
134*cdf0e10cSrcweir 	@param mapping			mapping to convert/ map interfaces
135*cdf0e10cSrcweir */
136*cdf0e10cSrcweir void SAL_CALL uno_any_constructAndConvert(
137*cdf0e10cSrcweir 	uno_Any * pDest, void * pSource,
138*cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr,
139*cdf0e10cSrcweir 	struct _uno_Mapping * mapping )
140*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
141*cdf0e10cSrcweir /** Constructs an any with a given value and converts/ maps interfaces.
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	@param pDest			pointer memory of destination any
144*cdf0e10cSrcweir 	@param pSource			pointer to source value; defaults (0) to default constructed value
145*cdf0e10cSrcweir 	@param pType			type of value; defaults (0) to void
146*cdf0e10cSrcweir 	@param mapping			mapping to convert/ map interfaces
147*cdf0e10cSrcweir */
148*cdf0e10cSrcweir void SAL_CALL uno_type_any_constructAndConvert(
149*cdf0e10cSrcweir 	uno_Any * pDest, void * pSource,
150*cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType,
151*cdf0e10cSrcweir 	struct _uno_Mapping * mapping )
152*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir /** Destructs an any.
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	@param pValue			pointer to any
157*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
158*cdf0e10cSrcweir                             defaults (0) to uno
159*cdf0e10cSrcweir */
160*cdf0e10cSrcweir void SAL_CALL uno_any_destruct(
161*cdf0e10cSrcweir 	uno_Any * pValue, uno_ReleaseFunc release )
162*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir /** Sets value to void.
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	@param pValue			pointer to any
167*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
168*cdf0e10cSrcweir                             defaults (0) to uno
169*cdf0e10cSrcweir */
170*cdf0e10cSrcweir void SAL_CALL uno_any_clear(
171*cdf0e10cSrcweir 	uno_Any * pValue, uno_ReleaseFunc release )
172*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir #ifdef __cplusplus
175*cdf0e10cSrcweir }
176*cdf0e10cSrcweir #endif
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir #endif
179