1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_UNO_DATA_H
24 #define INCLUDED_UNO_DATA_H
26 #include "cppu/cppudllapi.h"
33 struct _typelib_TypeDescriptionReference
;
34 struct _typelib_TypeDescription
;
35 struct _typelib_InterfaceTypeDescription
;
38 /** Generic function pointer declaration to query for an interface.
40 @param pInterface interface
41 @param pType demanded interface type
42 @return interface pointer
44 typedef void * (SAL_CALL
* uno_QueryInterfaceFunc
)(
45 void * pInterface
, struct _typelib_TypeDescriptionReference
* pType
);
46 /** Generic function pointer declaration to acquire an interface.
48 @param pInterface interface to be acquired
50 typedef void (SAL_CALL
* uno_AcquireFunc
)(
52 /** Generic function pointer declaration to release an interface.
54 @param pInterface interface to be release
56 typedef void (SAL_CALL
* uno_ReleaseFunc
)(
59 /** Tests if two values are equal. May compare different types (e.g., short to long).
61 @param pVal1 pointer to a value
62 @param pVal1TypeDescr type description of pVal1
63 @param pVal2 pointer to another value
64 @param pVal2TypeDescr type description of pVal2
65 @param queryInterface function called each time two interfaces are tested whether they belong
66 to the same object; defaults (0) to uno
67 @param release function to release queried interfaces; defaults (0) to uno
68 @return true if values are equal
70 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_equalData(
71 void * pVal1
, struct _typelib_TypeDescription
* pVal1TypeDescr
,
72 void * pVal2
, struct _typelib_TypeDescription
* pVal2TypeDescr
,
73 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
75 /** Tests if two values are equal. May compare different types (e.g., short to long).
77 @param pVal1 pointer to a value
78 @param pVal1Type type of pVal1
79 @param pVal2 pointer to another value
80 @param pVal2Type type of pVal2
81 @param queryInterface function called each time two interfaces are tested whether they belong
82 to the same object; defaults (0) to uno
83 @param release function to release queried interfaces; defaults (0) to uno
84 @return true if values are equal
86 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_type_equalData(
87 void * pVal1
, struct _typelib_TypeDescriptionReference
* pVal1Type
,
88 void * pVal2
, struct _typelib_TypeDescriptionReference
* pVal2Type
,
89 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
92 /** Copy construct memory with given value. The size of the destination value must be larger
93 or equal to the size of the source value.
95 @param pDest pointer to destination value memory
96 @param pSource pointer to source value
97 @param pTypeDescr type description of source
98 @param acquire function called each time an interface needs to be acquired;
101 CPPU_DLLPUBLIC
void SAL_CALL
uno_copyData(
102 void * pDest
, void * pSource
,
103 struct _typelib_TypeDescription
* pTypeDescr
, uno_AcquireFunc acquire
)
104 SAL_THROW_EXTERN_C();
105 /** Copy construct memory with given value. The size of the destination value must be larger
106 or equal to the size of the source value.
108 @param pDest pointer to destination value memory
109 @param pSource pointer to source value
110 @param pType type of source
111 @param acquire function called each time an interface needs to be acquired;
114 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_copyData(
115 void * pDest
, void * pSource
,
116 struct _typelib_TypeDescriptionReference
* pType
, uno_AcquireFunc acquire
)
117 SAL_THROW_EXTERN_C();
119 /** Copy construct memory with given value. The size of the destination value must be larger
120 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
122 @param pDest pointer to destination value memory
123 @param pSource pointer to source value
124 @param pTypeDescr type description of source
125 @param mapping mapping to convert/ map interfaces
127 CPPU_DLLPUBLIC
void SAL_CALL
uno_copyAndConvertData(
128 void * pDest
, void * pSource
,
129 struct _typelib_TypeDescription
* pTypeDescr
, struct _uno_Mapping
* mapping
)
130 SAL_THROW_EXTERN_C();
131 /** Copy construct memory with given value. The size of the destination value must be larger
132 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
134 @param pDest pointer to destination value memory
135 @param pSource pointer to source value
136 @param pType type of source
137 @param mapping mapping to convert/ map interfaces
139 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_copyAndConvertData(
140 void * pDest
, void * pSource
,
141 struct _typelib_TypeDescriptionReference
* pType
, struct _uno_Mapping
* mapping
)
142 SAL_THROW_EXTERN_C();
144 /** Destructs a given value; does NOT free its memory!
146 @param pValue value to be destructed
147 @param pTypeDescr type description of value
148 @param release function called each time an interface pointer needs to be released;
151 CPPU_DLLPUBLIC
void SAL_CALL
uno_destructData(
152 void * pValue
, struct _typelib_TypeDescription
* pTypeDescr
, uno_ReleaseFunc release
)
153 SAL_THROW_EXTERN_C();
154 /** Destructs a given value; does NOT free its memory!
156 @param pValue value to be destructed
157 @param pType type of value
158 @param release function called each time an interface pointer needs to be released;
161 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_destructData(
162 void * pValue
, struct _typelib_TypeDescriptionReference
* pType
, uno_ReleaseFunc release
)
163 SAL_THROW_EXTERN_C();
165 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
167 @param pMem pointer to memory of value to be constructed
168 @param pTypeDescr type description of value to be constructed
170 CPPU_DLLPUBLIC
void SAL_CALL
uno_constructData(
171 void * pMem
, struct _typelib_TypeDescription
* pTypeDescr
)
172 SAL_THROW_EXTERN_C();
173 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
175 @param pMem pointer to memory of value to be constructed
176 @param pType type of value to be constructed
178 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_constructData(
179 void * pMem
, struct _typelib_TypeDescriptionReference
* pType
)
180 SAL_THROW_EXTERN_C();
182 /** Assigns a destination value with a source value.
183 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
184 Querying for demanded interface type is allowed.
185 Assignment from any value to a value of type Any and vice versa is allowed.
187 @param pDest pointer to destination value
188 @param pDestTypeDescr type description of destination value
189 @param pSource pointer to source value; if 0, then destination value will be assigned
191 @param pSourceTypeDescr type destination of source value
192 @param queryInterface function called each time an interface needs to be queried;
194 @param acquire function called each time an interface needs to be acquired;
196 @param release function called each time an interface needs to be released;
198 @return true if destination has been successfully assigned
200 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_assignData(
201 void * pDest
, struct _typelib_TypeDescription
* pDestTypeDescr
,
202 void * pSource
, struct _typelib_TypeDescription
* pSourceTypeDescr
,
203 uno_QueryInterfaceFunc queryInterface
, uno_AcquireFunc acquire
, uno_ReleaseFunc release
)
204 SAL_THROW_EXTERN_C();
205 /** Assigns a destination value with a source value.
206 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
207 Querying for demanded interface type is allowed.
208 Assignment from any value to a value of type Any and vice versa is allowed.
210 @param pDest pointer to destination value
211 @param pDestType type of destination value
212 @param pSource pointer to source value; if 0, then destination value will be assigned
214 @param pSourceType type of source value
215 @param queryInterface function called each time an interface needs to be queried;
217 @param acquire function called each time an interface needs to be acquired;
219 @param release function called each time an interface needs to be released;
221 @return true if destination has been successfully assigned
223 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_type_assignData(
224 void * pDest
, struct _typelib_TypeDescriptionReference
* pDestType
,
225 void * pSource
, struct _typelib_TypeDescriptionReference
* pSourceType
,
226 uno_QueryInterfaceFunc queryInterface
, uno_AcquireFunc acquire
, uno_ReleaseFunc release
)
227 SAL_THROW_EXTERN_C();
229 /** Tests whether a value of given type is assignable from given value.
230 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
231 Querying for demanded interface type is allowed.
232 Assignment from any value to a value of type Any and vice versa is allowed.
234 @param pAssignable type
235 @param pFrom pointer to value
236 @param pFromType type of value
237 @param queryInterface function called each time an interface needs to be queried;
239 @param release function called each time an interface needs to be released;
241 @return true if value is destination has been successfully assigned
243 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_type_isAssignableFromData(
244 struct _typelib_TypeDescriptionReference
* pAssignable
,
245 void * pFrom
, struct _typelib_TypeDescriptionReference
* pFromType
,
246 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
247 SAL_THROW_EXTERN_C();
255 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */