1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <sal/types.h>
40 struct _typelib_TypeDescriptionReference
;
41 struct _typelib_TypeDescription
;
42 struct _typelib_InterfaceTypeDescription
;
45 /** Generic function pointer declaration to query for an interface.
47 @param pInterface interface
48 @param pTypedemanded interface type
49 @return interface pointer
51 typedef void * (SAL_CALL
* uno_QueryInterfaceFunc
)(
52 void * pInterface
, struct _typelib_TypeDescriptionReference
* pType
);
53 /** Generic function pointer declaration to acquire an interface.
55 @param pInterface interface to be acquired
57 typedef void (SAL_CALL
* uno_AcquireFunc
)(
59 /** Generic function pointer declaration to release an interface.
61 @param pInterface interface to be release
63 typedef void (SAL_CALL
* uno_ReleaseFunc
)(
66 /** Tests if two values are equal. May compare different types (e.g., short to long).
68 @param pVal1 pointer to a value
69 @param pVal1TypeDescr type description of pVal1
70 @param pVal2 pointer to another value
71 @param pVal2TypeDescr type description of pVal2
72 @param queryInterface function called each time two interfaces are tested whether they belong
73 to the same object; defaults (0) to uno
74 @param release function to release queried interfaces; defaults (0) to uno
75 @return true if values are equal
77 sal_Bool SAL_CALL
uno_equalData(
78 void * pVal1
, struct _typelib_TypeDescription
* pVal1TypeDescr
,
79 void * pVal2
, struct _typelib_TypeDescription
* pVal2TypeDescr
,
80 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
82 /** Tests if two values are equal. May compare different types (e.g., short to long).
84 @param pVal1 pointer to a value
85 @param pVal1Type type of pVal1
86 @param pVal2 pointer to another value
87 @param pVal2Type type of pVal2
88 @param queryInterface function called each time two interfaces are tested whether they belong
89 to the same object; defaults (0) to uno
90 @param release function to release queried interfaces; defaults (0) to uno
91 @return true if values are equal
93 sal_Bool SAL_CALL
uno_type_equalData(
94 void * pVal1
, struct _typelib_TypeDescriptionReference
* pVal1Type
,
95 void * pVal2
, struct _typelib_TypeDescriptionReference
* pVal2Type
,
96 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
99 /** Copy construct memory with given value. The size of the destination value must be larger
100 or equal to the size of the source value.
102 @param pDest pointer to destination value memory
103 @param pSource pointer to source value
104 @param pTypeDescr type description of source
105 @param acquire function called each time an interface needs to be acquired;
108 void SAL_CALL
uno_copyData(
109 void * pDest
, void * pSource
,
110 struct _typelib_TypeDescription
* pTypeDescr
, uno_AcquireFunc acquire
)
111 SAL_THROW_EXTERN_C();
112 /** Copy construct memory with given value. The size of the destination value must be larger
113 or equal to the size of the source value.
115 @param pDest pointer to destination value memory
116 @param pSource pointer to source value
117 @param pType type of source
118 @param acquire function called each time an interface needs to be acquired;
121 void SAL_CALL
uno_type_copyData(
122 void * pDest
, void * pSource
,
123 struct _typelib_TypeDescriptionReference
* pType
, uno_AcquireFunc acquire
)
124 SAL_THROW_EXTERN_C();
126 /** Copy construct memory with given value. The size of the destination value must be larger
127 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
129 @param pDest pointer to destination value memory
130 @param pSource pointer to source value
131 @param pTypeDescr type description of source
132 @param mapping mapping to convert/ map interfaces
134 void SAL_CALL
uno_copyAndConvertData(
135 void * pDest
, void * pSource
,
136 struct _typelib_TypeDescription
* pTypeDescr
, struct _uno_Mapping
* mapping
)
137 SAL_THROW_EXTERN_C();
138 /** Copy construct memory with given value. The size of the destination value must be larger
139 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
141 @param pDest pointer to destination value memory
142 @param pSource pointer to source value
143 @param pType type of source
144 @param mapping mapping to convert/ map interfaces
146 void SAL_CALL
uno_type_copyAndConvertData(
147 void * pDest
, void * pSource
,
148 struct _typelib_TypeDescriptionReference
* pType
, struct _uno_Mapping
* mapping
)
149 SAL_THROW_EXTERN_C();
151 /** Destructs a given value; does NOT free its memory!
153 @param pValue value to be destructed
154 @param pTypeDescr type description of value
155 @param release function called each time an interface pointer needs to be released;
158 void SAL_CALL
uno_destructData(
159 void * pValue
, struct _typelib_TypeDescription
* pTypeDescr
, uno_ReleaseFunc release
)
160 SAL_THROW_EXTERN_C();
161 /** Destructs a given value; does NOT free its memory!
163 @param pValue value to be destructed
164 @param pType type of value
165 @param release function called each time an interface pointer needs to be released;
168 void SAL_CALL
uno_type_destructData(
169 void * pValue
, struct _typelib_TypeDescriptionReference
* pType
, uno_ReleaseFunc release
)
170 SAL_THROW_EXTERN_C();
172 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
174 @param pMem pointer to memory of value to be constructed
175 @param pTypeDescr type description of value to be constructed
177 void SAL_CALL
uno_constructData(
178 void * pMem
, struct _typelib_TypeDescription
* pTypeDescr
)
179 SAL_THROW_EXTERN_C();
180 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
182 @param pMem pointer to memory of value to be constructed
183 @param pType type of value to be constructed
185 void SAL_CALL
uno_type_constructData(
186 void * pMem
, struct _typelib_TypeDescriptionReference
* pType
)
187 SAL_THROW_EXTERN_C();
189 /** Assigns a destination value with a source value.
190 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
191 Querying for demanded interface type is allowed.
192 Assignment from any value to a value of type Any and vice versa is allowed.
194 @param pDest pointer to destination value
195 @param pDestTypeDescr type description of destination value
196 @param pSource pointer to source value; if 0, then destination value will be assigned
198 @param pSourceTypeDescr type destination of source value
199 @param queryInterface function called each time an interface needs to be queried;
201 @param acquire function called each time an interface needs to be acquired;
203 @param release function called each time an interface needs to be released;
205 @return true if destination has been successfully assigned
207 sal_Bool SAL_CALL
uno_assignData(
208 void * pDest
, struct _typelib_TypeDescription
* pDestTypeDescr
,
209 void * pSource
, struct _typelib_TypeDescription
* pSourceTypeDescr
,
210 uno_QueryInterfaceFunc queryInterface
, uno_AcquireFunc acquire
, uno_ReleaseFunc release
)
211 SAL_THROW_EXTERN_C();
212 /** Assigns a destination value with a source value.
213 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
214 Querying for demanded interface type is allowed.
215 Assignment from any value to a value of type Any and vice versa is allowed.
217 @param pDest pointer to destination value
218 @param pDestType type of destination value
219 @param pSource pointer to source value; if 0, then destination value will be assigned
221 @param pSourceType type of source value
222 @param queryInterface function called each time an interface needs to be queried;
224 @param acquire function called each time an interface needs to be acquired;
226 @param release function called each time an interface needs to be released;
228 @return true if destination has been successfully assigned
230 sal_Bool SAL_CALL
uno_type_assignData(
231 void * pDest
, struct _typelib_TypeDescriptionReference
* pDestType
,
232 void * pSource
, struct _typelib_TypeDescriptionReference
* pSourceType
,
233 uno_QueryInterfaceFunc queryInterface
, uno_AcquireFunc acquire
, uno_ReleaseFunc release
)
234 SAL_THROW_EXTERN_C();
236 /** Tests whether a value of given type is assignable from given value.
237 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
238 Querying for demanded interface type is allowed.
239 Assignment from any value to a value of type Any and vice versa is allowed.
241 @param pAssignable type
242 @param pFrom pointer to value
243 @param pFromType type of value
244 @param queryInterface function called each time an interface needs to be queried;
246 @param release function called each time an interface needs to be released;
248 @return true if value is destination has been successfully assigned
250 sal_Bool SAL_CALL
uno_type_isAssignableFromData(
251 struct _typelib_TypeDescriptionReference
* pAssignable
,
252 void * pFrom
, struct _typelib_TypeDescriptionReference
* pFromType
,
253 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
254 SAL_THROW_EXTERN_C();