xref: /trunk/main/cppu/inc/uno/data.h (revision 514f4c20)
1*514f4c20SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*514f4c20SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*514f4c20SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*514f4c20SAndrew Rist  * distributed with this work for additional information
6*514f4c20SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*514f4c20SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*514f4c20SAndrew Rist  * "License"); you may not use this file except in compliance
9*514f4c20SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*514f4c20SAndrew Rist  *
11*514f4c20SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*514f4c20SAndrew Rist  *
13*514f4c20SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*514f4c20SAndrew Rist  * software distributed under the License is distributed on an
15*514f4c20SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*514f4c20SAndrew Rist  * KIND, either express or implied.  See the License for the
17*514f4c20SAndrew Rist  * specific language governing permissions and limitations
18*514f4c20SAndrew Rist  * under the License.
19*514f4c20SAndrew Rist  *
20*514f4c20SAndrew Rist  *************************************************************/
21*514f4c20SAndrew Rist 
22*514f4c20SAndrew Rist 
23cdf0e10cSrcweir #ifndef _UNO_DATA_H_
24cdf0e10cSrcweir #define _UNO_DATA_H_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <sal/types.h>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifdef __cplusplus
29cdf0e10cSrcweir extern "C"
30cdf0e10cSrcweir {
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir struct _typelib_TypeDescriptionReference;
34cdf0e10cSrcweir struct _typelib_TypeDescription;
35cdf0e10cSrcweir struct _typelib_InterfaceTypeDescription;
36cdf0e10cSrcweir struct _uno_Mapping;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir /** Generic function pointer declaration to query for an interface.
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 	@param pInterface interface
41cdf0e10cSrcweir 	@param pTypedemanded interface type
42cdf0e10cSrcweir 	@return interface pointer
43cdf0e10cSrcweir */
44cdf0e10cSrcweir typedef void * (SAL_CALL * uno_QueryInterfaceFunc)(
45cdf0e10cSrcweir 	void * pInterface, struct _typelib_TypeDescriptionReference * pType );
46cdf0e10cSrcweir /** Generic function pointer declaration to acquire an interface.
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	@param pInterface interface to be acquired
49cdf0e10cSrcweir */
50cdf0e10cSrcweir typedef void (SAL_CALL * uno_AcquireFunc)(
51cdf0e10cSrcweir 	void * pInterface );
52cdf0e10cSrcweir /** Generic function pointer declaration to release an interface.
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	@param pInterface interface to be release
55cdf0e10cSrcweir */
56cdf0e10cSrcweir typedef void (SAL_CALL * uno_ReleaseFunc)(
57cdf0e10cSrcweir 	void * pInterface );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir /** Tests if two values are equal. May compare different types (e.g., short to long).
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	@param pVal1			pointer to a value
62cdf0e10cSrcweir 	@param pVal1TypeDescr	type description of pVal1
63cdf0e10cSrcweir 	@param pVal2			pointer to another value
64cdf0e10cSrcweir 	@param pVal2TypeDescr	type description of pVal2
65cdf0e10cSrcweir 	@param queryInterface	function called each time two interfaces are tested whether they belong
66cdf0e10cSrcweir 							to the same object; defaults (0) to uno
67cdf0e10cSrcweir 	@param release			function to release queried interfaces; defaults (0) to uno
68cdf0e10cSrcweir 	@return true if values are equal
69cdf0e10cSrcweir */
70cdf0e10cSrcweir sal_Bool SAL_CALL uno_equalData(
71cdf0e10cSrcweir 	void * pVal1, struct _typelib_TypeDescription * pVal1TypeDescr,
72cdf0e10cSrcweir 	void * pVal2, struct _typelib_TypeDescription * pVal2TypeDescr,
73cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
74cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
75cdf0e10cSrcweir /** Tests if two values are equal. May compare different types (e.g., short to long).
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	@param pVal1			pointer to a value
78cdf0e10cSrcweir 	@param pVal1Type		type of pVal1
79cdf0e10cSrcweir 	@param pVal2			pointer to another value
80cdf0e10cSrcweir 	@param pVal2Type		type of pVal2
81cdf0e10cSrcweir 	@param queryInterface	function called each time two interfaces are tested whether they belong
82cdf0e10cSrcweir 							to the same object; defaults (0) to uno
83cdf0e10cSrcweir 	@param release			function to release queried interfaces; defaults (0) to uno
84cdf0e10cSrcweir 	@return true if values are equal
85cdf0e10cSrcweir */
86cdf0e10cSrcweir sal_Bool SAL_CALL uno_type_equalData(
87cdf0e10cSrcweir 	void * pVal1, struct _typelib_TypeDescriptionReference * pVal1Type,
88cdf0e10cSrcweir 	void * pVal2, struct _typelib_TypeDescriptionReference * pVal2Type,
89cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
90cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
93cdf0e10cSrcweir     or equal to the size of the source value.
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
96cdf0e10cSrcweir 	@param pSource			pointer to source value
97cdf0e10cSrcweir 	@param pTypeDescr		type description of source
98cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
99cdf0e10cSrcweir                             defaults (0) to uno
100cdf0e10cSrcweir */
101cdf0e10cSrcweir void SAL_CALL uno_copyData(
102cdf0e10cSrcweir 	void * pDest, void * pSource,
103cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr, uno_AcquireFunc acquire )
104cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
105cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
106cdf0e10cSrcweir     or equal to the size of the source value.
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
109cdf0e10cSrcweir 	@param pSource			pointer to source value
110cdf0e10cSrcweir 	@param pType			type of source
111cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
112cdf0e10cSrcweir                             defaults (0) to uno
113cdf0e10cSrcweir */
114cdf0e10cSrcweir void SAL_CALL uno_type_copyData(
115cdf0e10cSrcweir 	void * pDest, void * pSource,
116cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType, uno_AcquireFunc acquire )
117cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
120cdf0e10cSrcweir     or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
123cdf0e10cSrcweir 	@param pSource			pointer to source value
124cdf0e10cSrcweir 	@param pTypeDescr		type description of source
125cdf0e10cSrcweir 	@param mapping			mapping to convert/ map interfaces
126cdf0e10cSrcweir */
127cdf0e10cSrcweir void SAL_CALL uno_copyAndConvertData(
128cdf0e10cSrcweir 	void * pDest, void * pSource,
129cdf0e10cSrcweir 	struct _typelib_TypeDescription * pTypeDescr, struct _uno_Mapping * mapping )
130cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
131cdf0e10cSrcweir /** Copy construct memory with given value. The size of the destination value must be larger
132cdf0e10cSrcweir     or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	@param pDest			pointer to destination value memory
135cdf0e10cSrcweir 	@param pSource			pointer to source value
136cdf0e10cSrcweir 	@param pType			type of source
137cdf0e10cSrcweir 	@param mapping			mapping to convert/ map interfaces
138cdf0e10cSrcweir */
139cdf0e10cSrcweir void SAL_CALL uno_type_copyAndConvertData(
140cdf0e10cSrcweir 	void * pDest, void * pSource,
141cdf0e10cSrcweir 	struct _typelib_TypeDescriptionReference * pType, struct _uno_Mapping * mapping )
142cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
143cdf0e10cSrcweir 
144cdf0e10cSrcweir /** Destructs a given value; does NOT free its memory!
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	@param pValue			value to be destructed
147cdf0e10cSrcweir 	@param pTypeDescr		type description of value
148cdf0e10cSrcweir 	@param release			function called each time an interface pointer needs to be released;
149cdf0e10cSrcweir                             defaults (0) to uno
150cdf0e10cSrcweir */
151cdf0e10cSrcweir void SAL_CALL uno_destructData(
152cdf0e10cSrcweir 	void * pValue, struct _typelib_TypeDescription * pTypeDescr, uno_ReleaseFunc release )
153cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
154cdf0e10cSrcweir /** Destructs a given value; does NOT free its memory!
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	@param pValue			value to be destructed
157cdf0e10cSrcweir 	@param pType			type of value
158cdf0e10cSrcweir 	@param release			function called each time an interface pointer needs to be released;
159cdf0e10cSrcweir                             defaults (0) to uno
160cdf0e10cSrcweir */
161cdf0e10cSrcweir void SAL_CALL uno_type_destructData(
162cdf0e10cSrcweir 	void * pValue, struct _typelib_TypeDescriptionReference * pType, uno_ReleaseFunc release )
163cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
164cdf0e10cSrcweir 
165cdf0e10cSrcweir /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	@param pMem				pointer to memory of value to be constructed
168cdf0e10cSrcweir 	@param pTypeDescr		type description of value to be constructed
169cdf0e10cSrcweir */
170cdf0e10cSrcweir void SAL_CALL uno_constructData(
171cdf0e10cSrcweir 	void * pMem, struct _typelib_TypeDescription * pTypeDescr )
172cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
173cdf0e10cSrcweir /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	@param pMem				pointer to memory of value to be constructed
176cdf0e10cSrcweir 	@param pType			type of value to be constructed
177cdf0e10cSrcweir */
178cdf0e10cSrcweir void SAL_CALL uno_type_constructData(
179cdf0e10cSrcweir 	void * pMem, struct _typelib_TypeDescriptionReference * pType )
180cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir /** Assigns a destination value with a source value.
183cdf0e10cSrcweir     Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
184cdf0e10cSrcweir     Querying for demanded interface type is allowed.
185cdf0e10cSrcweir     Assignment from any value to a value of type Any and vice versa is allowed.
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	@param pDest			pointer to destination value
188cdf0e10cSrcweir 	@param pDestTypeDescr	type description of destination value
189cdf0e10cSrcweir 	@param pSource			pointer to source value; if 0, then destination value will be assigned
190cdf0e10cSrcweir                             to default value
191cdf0e10cSrcweir 	@param pSourceTypeDescr	type destination of source value
192cdf0e10cSrcweir 	@param queryInterface	function called each time an interface needs to be queried;
193cdf0e10cSrcweir                             defaults (0) to uno
194cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
195cdf0e10cSrcweir                             defaults (0) to uno
196cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
197cdf0e10cSrcweir                             defaults (0) to uno
198cdf0e10cSrcweir 	@return true if destination has been successfully assigned
199cdf0e10cSrcweir */
200cdf0e10cSrcweir sal_Bool SAL_CALL uno_assignData(
201cdf0e10cSrcweir 	void * pDest, struct _typelib_TypeDescription * pDestTypeDescr,
202cdf0e10cSrcweir 	void * pSource, struct _typelib_TypeDescription * pSourceTypeDescr,
203cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
204cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
205cdf0e10cSrcweir /** Assigns a destination value with a source value.
206cdf0e10cSrcweir     Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
207cdf0e10cSrcweir     Querying for demanded interface type is allowed.
208cdf0e10cSrcweir     Assignment from any value to a value of type Any and vice versa is allowed.
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	@param pDest			pointer to destination value
211cdf0e10cSrcweir 	@param pDestType		type of destination value
212cdf0e10cSrcweir 	@param pSource			pointer to source value; if 0, then destination value will be assigned
213cdf0e10cSrcweir                             to default value
214cdf0e10cSrcweir 	@param pSourceType		type of source value
215cdf0e10cSrcweir 	@param queryInterface	function called each time an interface needs to be queried;
216cdf0e10cSrcweir                             defaults (0) to uno
217cdf0e10cSrcweir 	@param acquire			function called each time an interface needs to be acquired;
218cdf0e10cSrcweir                             defaults (0) to uno
219cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
220cdf0e10cSrcweir                             defaults (0) to uno
221cdf0e10cSrcweir 	@return true if destination has been successfully assigned
222cdf0e10cSrcweir */
223cdf0e10cSrcweir sal_Bool SAL_CALL uno_type_assignData(
224cdf0e10cSrcweir 	void * pDest, struct _typelib_TypeDescriptionReference * pDestType,
225cdf0e10cSrcweir 	void * pSource, struct _typelib_TypeDescriptionReference * pSourceType,
226cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
227cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
228cdf0e10cSrcweir 
229cdf0e10cSrcweir /** Tests whether a value of given type is assignable from given value.
230cdf0e10cSrcweir     Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
231cdf0e10cSrcweir     Querying for demanded interface type is allowed.
232cdf0e10cSrcweir     Assignment from any value to a value of type Any and vice versa is allowed.
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	@param pAssignable      type
235cdf0e10cSrcweir 	@param pFrom			pointer to value
236cdf0e10cSrcweir 	@param pFromType		type of value
237cdf0e10cSrcweir 	@param queryInterface	function called each time an interface needs to be queried;
238cdf0e10cSrcweir                             defaults (0) to uno
239cdf0e10cSrcweir 	@param release			function called each time an interface needs to be released;
240cdf0e10cSrcweir                             defaults (0) to uno
241cdf0e10cSrcweir 	@return true if value is destination has been successfully assigned
242cdf0e10cSrcweir */
243cdf0e10cSrcweir sal_Bool SAL_CALL uno_type_isAssignableFromData(
244cdf0e10cSrcweir     struct _typelib_TypeDescriptionReference * pAssignable,
245cdf0e10cSrcweir 	void * pFrom, struct _typelib_TypeDescriptionReference * pFromType,
246cdf0e10cSrcweir 	uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
247cdf0e10cSrcweir 	SAL_THROW_EXTERN_C();
248cdf0e10cSrcweir 
249cdf0e10cSrcweir #ifdef __cplusplus
250cdf0e10cSrcweir }
251cdf0e10cSrcweir #endif
252cdf0e10cSrcweir 
253cdf0e10cSrcweir #endif
254