Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / uno / data.h
blobea3ab5f3b27729133f9ac86fdcaab39eb4482908
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_UNO_DATA_H
20 #define INCLUDED_UNO_DATA_H
22 #include <cppu/cppudllapi.h>
24 #ifdef __cplusplus
25 extern "C"
27 #endif
29 struct _typelib_TypeDescriptionReference;
30 struct _typelib_TypeDescription;
31 struct _typelib_InterfaceTypeDescription;
32 struct _uno_Mapping;
34 /** Generic function pointer declaration to query for an interface.
36 @param pInterface interface
37 @param pTypedemanded interface type
38 @return interface pointer
40 typedef void * (SAL_CALL * uno_QueryInterfaceFunc)(
41 void * pInterface, struct _typelib_TypeDescriptionReference * pType );
42 /** Generic function pointer declaration to acquire an interface.
44 @param pInterface interface to be acquired
46 typedef void (SAL_CALL * uno_AcquireFunc)(
47 void * pInterface );
48 /** Generic function pointer declaration to release an interface.
50 @param pInterface interface to be release
52 typedef void (SAL_CALL * uno_ReleaseFunc)(
53 void * pInterface );
55 /** Tests if two values are equal. May compare different types (e.g., short to long).
57 @param pVal1 pointer to a value
58 @param pVal1TypeDescr type description of pVal1
59 @param pVal2 pointer to another value
60 @param pVal2TypeDescr type description of pVal2
61 @param queryInterface function called each time two interfaces are tested whether they belong
62 to the same object; defaults (0) to uno
63 @param release function to release queried interfaces; defaults (0) to uno
64 @return true if values are equal
66 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_equalData(
67 void * pVal1, struct _typelib_TypeDescription * pVal1TypeDescr,
68 void * pVal2, struct _typelib_TypeDescription * pVal2TypeDescr,
69 uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
70 SAL_THROW_EXTERN_C();
71 /** Tests if two values are equal. May compare different types (e.g., short to long).
73 @param pVal1 pointer to a value
74 @param pVal1Type type of pVal1
75 @param pVal2 pointer to another value
76 @param pVal2Type type of pVal2
77 @param queryInterface function called each time two interfaces are tested whether they belong
78 to the same object; defaults (0) to uno
79 @param release function to release queried interfaces; defaults (0) to uno
80 @return true if values are equal
82 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_equalData(
83 void * pVal1, struct _typelib_TypeDescriptionReference * pVal1Type,
84 void * pVal2, struct _typelib_TypeDescriptionReference * pVal2Type,
85 uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
86 SAL_THROW_EXTERN_C();
88 /** Copy construct memory with given value. The size of the destination value must be larger
89 or equal to the size of the source value.
91 @param pDest pointer to destination value memory
92 @param pSource pointer to source value
93 @param pTypeDescr type description of source
94 @param acquire function called each time an interface needs to be acquired;
95 defaults (0) to uno
97 CPPU_DLLPUBLIC void SAL_CALL uno_copyData(
98 void * pDest, void * pSource,
99 struct _typelib_TypeDescription * pTypeDescr, uno_AcquireFunc acquire )
100 SAL_THROW_EXTERN_C();
101 /** Copy construct memory with given value. The size of the destination value must be larger
102 or equal to the size of the source value.
104 @param pDest pointer to destination value memory
105 @param pSource pointer to source value
106 @param pType type of source
107 @param acquire function called each time an interface needs to be acquired;
108 defaults (0) to uno
110 CPPU_DLLPUBLIC void SAL_CALL uno_type_copyData(
111 void * pDest, void * pSource,
112 struct _typelib_TypeDescriptionReference * pType, uno_AcquireFunc acquire )
113 SAL_THROW_EXTERN_C();
115 /** Copy construct memory with given value. The size of the destination value must be larger
116 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
118 @param pDest pointer to destination value memory
119 @param pSource pointer to source value
120 @param pTypeDescr type description of source
121 @param mapping mapping to convert/ map interfaces
123 CPPU_DLLPUBLIC void SAL_CALL uno_copyAndConvertData(
124 void * pDest, void * pSource,
125 struct _typelib_TypeDescription * pTypeDescr, struct _uno_Mapping * mapping )
126 SAL_THROW_EXTERN_C();
127 /** Copy construct memory with given value. The size of the destination value must be larger
128 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
130 @param pDest pointer to destination value memory
131 @param pSource pointer to source value
132 @param pType type of source
133 @param mapping mapping to convert/ map interfaces
135 CPPU_DLLPUBLIC void SAL_CALL uno_type_copyAndConvertData(
136 void * pDest, void * pSource,
137 struct _typelib_TypeDescriptionReference * pType, struct _uno_Mapping * mapping )
138 SAL_THROW_EXTERN_C();
140 /** Destructs a given value; does NOT free its memory!
142 @param pValue value to be destructed
143 @param pTypeDescr type description of value
144 @param release function called each time an interface pointer needs to be released;
145 defaults (0) to uno
147 CPPU_DLLPUBLIC void SAL_CALL uno_destructData(
148 void * pValue, struct _typelib_TypeDescription * pTypeDescr, uno_ReleaseFunc release )
149 SAL_THROW_EXTERN_C();
150 /** Destructs a given value; does NOT free its memory!
152 @param pValue value to be destructed
153 @param pType type of value
154 @param release function called each time an interface pointer needs to be released;
155 defaults (0) to uno
157 CPPU_DLLPUBLIC void SAL_CALL uno_type_destructData(
158 void * pValue, struct _typelib_TypeDescriptionReference * pType, uno_ReleaseFunc release )
159 SAL_THROW_EXTERN_C();
161 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
163 @param pMem pointer to memory of value to be constructed
164 @param pTypeDescr type description of value to be constructed
166 CPPU_DLLPUBLIC void SAL_CALL uno_constructData(
167 void * pMem, struct _typelib_TypeDescription * pTypeDescr )
168 SAL_THROW_EXTERN_C();
169 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
171 @param pMem pointer to memory of value to be constructed
172 @param pType type of value to be constructed
174 CPPU_DLLPUBLIC void SAL_CALL uno_type_constructData(
175 void * pMem, struct _typelib_TypeDescriptionReference * pType )
176 SAL_THROW_EXTERN_C();
178 /** Assigns a destination value with a source value.
179 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
180 Querying for demanded interface type is allowed.
181 Assignment from any value to a value of type Any and vice versa is allowed.
183 @param pDest pointer to destination value
184 @param pDestTypeDescr type description of destination value
185 @param pSource pointer to source value; if 0, then destination value will be assigned
186 to default value
187 @param pSourceTypeDescr type destination of source value
188 @param queryInterface function called each time an interface needs to be queried;
189 defaults (0) to uno
190 @param acquire function called each time an interface needs to be acquired;
191 defaults (0) to uno
192 @param release function called each time an interface needs to be released;
193 defaults (0) to uno
194 @return true if destination has been successfully assigned
196 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_assignData(
197 void * pDest, struct _typelib_TypeDescription * pDestTypeDescr,
198 void * pSource, struct _typelib_TypeDescription * pSourceTypeDescr,
199 uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
200 SAL_THROW_EXTERN_C();
201 /** Assigns a destination value with a source value.
202 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
203 Querying for demanded interface type is allowed.
204 Assignment from any value to a value of type Any and vice versa is allowed.
206 @param pDest pointer to destination value
207 @param pDestType type of destination value
208 @param pSource pointer to source value; if 0, then destination value will be assigned
209 to default value
210 @param pSourceType type of source value
211 @param queryInterface function called each time an interface needs to be queried;
212 defaults (0) to uno
213 @param acquire function called each time an interface needs to be acquired;
214 defaults (0) to uno
215 @param release function called each time an interface needs to be released;
216 defaults (0) to uno
217 @return true if destination has been successfully assigned
219 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_assignData(
220 void * pDest, struct _typelib_TypeDescriptionReference * pDestType,
221 void * pSource, struct _typelib_TypeDescriptionReference * pSourceType,
222 uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release )
223 SAL_THROW_EXTERN_C();
225 /** Tests whether a value of given type is assignable from given value.
226 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
227 Querying for demanded interface type is allowed.
228 Assignment from any value to a value of type Any and vice versa is allowed.
230 @param pAssignable type
231 @param pFrom pointer to value
232 @param pFromType type of value
233 @param queryInterface function called each time an interface needs to be queried;
234 defaults (0) to uno
235 @param release function called each time an interface needs to be released;
236 defaults (0) to uno
237 @return true if value is destination has been successfully assigned
239 CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_type_isAssignableFromData(
240 struct _typelib_TypeDescriptionReference * pAssignable,
241 void * pFrom, struct _typelib_TypeDescriptionReference * pFromType,
242 uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release )
243 SAL_THROW_EXTERN_C();
245 #ifdef __cplusplus
247 #endif
249 #endif
251 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */