xref: /trunk/main/cppu/inc/uno/data.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_DATA_H_
28*cdf0e10cSrcweir #define _UNO_DATA_H_
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <sal/types.h>
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #ifdef __cplusplus
33*cdf0e10cSrcweir extern "C"
34*cdf0e10cSrcweir {
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir struct _typelib_TypeDescriptionReference;
38*cdf0e10cSrcweir struct _typelib_TypeDescription;
39*cdf0e10cSrcweir struct _typelib_InterfaceTypeDescription;
40*cdf0e10cSrcweir struct _uno_Mapping;
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir /** Generic function pointer declaration to query for an interface.
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir 	@param pInterface interface
45*cdf0e10cSrcweir 	@param pTypedemanded interface type
46*cdf0e10cSrcweir 	@return interface pointer
47*cdf0e10cSrcweir */
48*cdf0e10cSrcweir typedef void * (SAL_CALL * uno_QueryInterfaceFunc)(
49*cdf0e10cSrcweir 	void * pInterface, struct _typelib_TypeDescriptionReference * pType );
50*cdf0e10cSrcweir /** Generic function pointer declaration to acquire an interface.
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 	@param pInterface interface to be acquired
53*cdf0e10cSrcweir */
54*cdf0e10cSrcweir typedef void (SAL_CALL * uno_AcquireFunc)(
55*cdf0e10cSrcweir 	void * pInterface );
56*cdf0e10cSrcweir /** Generic function pointer declaration to release an interface.
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir 	@param pInterface interface to be release
59*cdf0e10cSrcweir */
60*cdf0e10cSrcweir typedef void (SAL_CALL * uno_ReleaseFunc)(
61*cdf0e10cSrcweir 	void * pInterface );
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir /** Tests if two values are equal. May compare different types (e.g., short to long).
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	@param pVal1			pointer to a value
66*cdf0e10cSrcweir 	@param pVal1TypeDescr	type description of pVal1
67*cdf0e10cSrcweir 	@param pVal2			pointer to another value
68*cdf0e10cSrcweir 	@param pVal2TypeDescr	type description of pVal2
69*cdf0e10cSrcweir 	@param queryInterface	function called each time two interfaces are tested whether they belong
70*cdf0e10cSrcweir 							to the same object; defaults (0) to uno
71*cdf0e10cSrcweir 	@param release			function to release queried interfaces; defaults (0) to uno
72*cdf0e10cSrcweir 	@return true if values are equal
73*cdf0e10cSrcweir */
74*cdf0e10cSrcweir sal_Bool SAL_CALL uno_equalData(
75*cdf0e10cSrcweir 	void * pVal1, struct _typelib_TypeDescription * pVal1TypeDescr,
76*cdf0e10cSrcweir 	void * pVal2, struct _typelib_TypeDescription * pVal2TypeDescr,
77*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
78*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
79*cdf0e10cSrcweir /** Tests if two values are equal. May compare different types (e.g., short to long).
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	@param pVal1			pointer to a value
82*cdf0e10cSrcweir 	@param pVal1Type		type of pVal1
83*cdf0e10cSrcweir 	@param pVal2			pointer to another value
84*cdf0e10cSrcweir 	@param pVal2Type		type of pVal2
85*cdf0e10cSrcweir 	@param queryInterface	function called each time two interfaces are tested whether they belong
86*cdf0e10cSrcweir 							to the same object; defaults (0) to uno
87*cdf0e10cSrcweir 	@param release			function to release queried interfaces; defaults (0) to uno
88*cdf0e10cSrcweir 	@return true if values are equal
89*cdf0e10cSrcweir */
90*cdf0e10cSrcweir sal_Bool SAL_CALL uno_type_equalData(
91*cdf0e10cSrcweir 	void * pVal1, struct _typelib_TypeDescriptionReference * pVal1Type,
92*cdf0e10cSrcweir 	void * pVal2, struct _typelib_TypeDescriptionReference * pVal2Type,
93*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
94*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
97*cdf0e10cSrcweir     or equal to the size of the source value.
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
100*cdf0e10cSrcweir 	@param pSource			pointer to source value
101*cdf0e10cSrcweir 	@param pTypeDescr		type description of source
102*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
103*cdf0e10cSrcweir                             defaults (0) to uno
104*cdf0e10cSrcweir */
105*cdf0e10cSrcweir void SAL_CALL uno_copyData(
106*cdf0e10cSrcweir 	void * pDest, void * pSource,
107*cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr, uno_AcquireFunc acquire )
108*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
109*cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
110*cdf0e10cSrcweir     or equal to the size of the source value.
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
113*cdf0e10cSrcweir 	@param pSource			pointer to source value
114*cdf0e10cSrcweir 	@param pType			type of source
115*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
116*cdf0e10cSrcweir                             defaults (0) to uno
117*cdf0e10cSrcweir */
118*cdf0e10cSrcweir void SAL_CALL uno_type_copyData(
119*cdf0e10cSrcweir 	void * pDest, void * pSource,
120*cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType, uno_AcquireFunc acquire )
121*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
124*cdf0e10cSrcweir     or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
127*cdf0e10cSrcweir 	@param pSource			pointer to source value
128*cdf0e10cSrcweir 	@param pTypeDescr		type description of source
129*cdf0e10cSrcweir 	@param mapping			mapping to convert/ map interfaces
130*cdf0e10cSrcweir */
131*cdf0e10cSrcweir void SAL_CALL uno_copyAndConvertData(
132*cdf0e10cSrcweir 	void * pDest, void * pSource,
133*cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr, struct _uno_Mapping * mapping )
134*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
135*cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
136*cdf0e10cSrcweir     or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
139*cdf0e10cSrcweir 	@param pSource			pointer to source value
140*cdf0e10cSrcweir 	@param pType			type of source
141*cdf0e10cSrcweir 	@param mapping			mapping to convert/ map interfaces
142*cdf0e10cSrcweir */
143*cdf0e10cSrcweir void SAL_CALL uno_type_copyAndConvertData(
144*cdf0e10cSrcweir 	void * pDest, void * pSource,
145*cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType, struct _uno_Mapping * mapping )
146*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir /** Destructs a given value; does NOT free its memory!
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	@param pValue			value to be destructed
151*cdf0e10cSrcweir 	@param pTypeDescr		type description of value
152*cdf0e10cSrcweir 	@param release			function called each time an interface pointer needs to be released;
153*cdf0e10cSrcweir                             defaults (0) to uno
154*cdf0e10cSrcweir */
155*cdf0e10cSrcweir void SAL_CALL uno_destructData(
156*cdf0e10cSrcweir 	void * pValue, struct _typelib_TypeDescription * pTypeDescr, uno_ReleaseFunc release )
157*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
158*cdf0e10cSrcweir /** Destructs a given value; does NOT free its memory!
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 	@param pValue			value to be destructed
161*cdf0e10cSrcweir 	@param pType			type of value
162*cdf0e10cSrcweir 	@param release			function called each time an interface pointer needs to be released;
163*cdf0e10cSrcweir                             defaults (0) to uno
164*cdf0e10cSrcweir */
165*cdf0e10cSrcweir void SAL_CALL uno_type_destructData(
166*cdf0e10cSrcweir 	void * pValue, struct _typelib_TypeDescriptionReference * pType, uno_ReleaseFunc release )
167*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	@param pMem				pointer to memory of value to be constructed
172*cdf0e10cSrcweir 	@param pTypeDescr		type description of value to be constructed
173*cdf0e10cSrcweir */
174*cdf0e10cSrcweir void SAL_CALL uno_constructData(
175*cdf0e10cSrcweir 	void * pMem, struct _typelib_TypeDescription * pTypeDescr )
176*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
177*cdf0e10cSrcweir /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	@param pMem				pointer to memory of value to be constructed
180*cdf0e10cSrcweir 	@param pType			type of value to be constructed
181*cdf0e10cSrcweir */
182*cdf0e10cSrcweir void SAL_CALL uno_type_constructData(
183*cdf0e10cSrcweir 	void * pMem, struct _typelib_TypeDescriptionReference * pType )
184*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir /** Assigns a destination value with a source value.
187*cdf0e10cSrcweir     Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
188*cdf0e10cSrcweir     Querying for demanded interface type is allowed.
189*cdf0e10cSrcweir     Assignment from any value to a value of type Any and vice versa is allowed.
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir 	@param pDest			pointer to destination value
192*cdf0e10cSrcweir 	@param pDestTypeDescr	type description of destination value
193*cdf0e10cSrcweir 	@param pSource			pointer to source value; if 0, then destination value will be assigned
194*cdf0e10cSrcweir                             to default value
195*cdf0e10cSrcweir 	@param pSourceTypeDescr	type destination of source value
196*cdf0e10cSrcweir 	@param queryInterface	function called each time an interface needs to be queried;
197*cdf0e10cSrcweir                             defaults (0) to uno
198*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
199*cdf0e10cSrcweir                             defaults (0) to uno
200*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
201*cdf0e10cSrcweir                             defaults (0) to uno
202*cdf0e10cSrcweir 	@return true if destination has been successfully assigned
203*cdf0e10cSrcweir */
204*cdf0e10cSrcweir sal_Bool SAL_CALL uno_assignData(
205*cdf0e10cSrcweir 	void * pDest, struct _typelib_TypeDescription * pDestTypeDescr,
206*cdf0e10cSrcweir 	void * pSource, struct _typelib_TypeDescription * pSourceTypeDescr,
207*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
208*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
209*cdf0e10cSrcweir /** Assigns a destination value with a source value.
210*cdf0e10cSrcweir     Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
211*cdf0e10cSrcweir     Querying for demanded interface type is allowed.
212*cdf0e10cSrcweir     Assignment from any value to a value of type Any and vice versa is allowed.
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	@param pDest			pointer to destination value
215*cdf0e10cSrcweir 	@param pDestType		type of destination value
216*cdf0e10cSrcweir 	@param pSource			pointer to source value; if 0, then destination value will be assigned
217*cdf0e10cSrcweir                             to default value
218*cdf0e10cSrcweir 	@param pSourceType		type of source value
219*cdf0e10cSrcweir 	@param queryInterface	function called each time an interface needs to be queried;
220*cdf0e10cSrcweir                             defaults (0) to uno
221*cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
222*cdf0e10cSrcweir                             defaults (0) to uno
223*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
224*cdf0e10cSrcweir                             defaults (0) to uno
225*cdf0e10cSrcweir 	@return true if destination has been successfully assigned
226*cdf0e10cSrcweir */
227*cdf0e10cSrcweir sal_Bool SAL_CALL uno_type_assignData(
228*cdf0e10cSrcweir 	void * pDest, struct _typelib_TypeDescriptionReference * pDestType,
229*cdf0e10cSrcweir 	void * pSource, struct _typelib_TypeDescriptionReference * pSourceType,
230*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
231*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir /** Tests whether a value of given type is assignable from given value.
234*cdf0e10cSrcweir     Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
235*cdf0e10cSrcweir     Querying for demanded interface type is allowed.
236*cdf0e10cSrcweir     Assignment from any value to a value of type Any and vice versa is allowed.
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	@param pAssignable      type
239*cdf0e10cSrcweir 	@param pFrom			pointer to value
240*cdf0e10cSrcweir 	@param pFromType		type of value
241*cdf0e10cSrcweir 	@param queryInterface	function called each time an interface needs to be queried;
242*cdf0e10cSrcweir                             defaults (0) to uno
243*cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
244*cdf0e10cSrcweir                             defaults (0) to uno
245*cdf0e10cSrcweir 	@return true if value is destination has been successfully assigned
246*cdf0e10cSrcweir */
247*cdf0e10cSrcweir sal_Bool SAL_CALL uno_type_isAssignableFromData(
248*cdf0e10cSrcweir     struct _typelib_TypeDescriptionReference * pAssignable,
249*cdf0e10cSrcweir 	void * pFrom, struct _typelib_TypeDescriptionReference * pFromType,
250*cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
251*cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir #ifdef __cplusplus
254*cdf0e10cSrcweir }
255*cdf0e10cSrcweir #endif
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir #endif
258