1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
31 #include <cppu/cppudllapi.h>
38 struct _typelib_TypeDescriptionReference
;
39 struct _typelib_TypeDescription
;
40 struct _typelib_InterfaceTypeDescription
;
43 /** Generic function pointer declaration to query for an interface.
45 @param pInterface interface
46 @param pTypedemanded interface type
47 @return interface pointer
49 typedef void * (SAL_CALL
* uno_QueryInterfaceFunc
)(
50 void * pInterface
, struct _typelib_TypeDescriptionReference
* pType
);
51 /** Generic function pointer declaration to acquire an interface.
53 @param pInterface interface to be acquired
55 typedef void (SAL_CALL
* uno_AcquireFunc
)(
57 /** Generic function pointer declaration to release an interface.
59 @param pInterface interface to be release
61 typedef void (SAL_CALL
* uno_ReleaseFunc
)(
64 /** Tests if two values are equal. May compare different types (e.g., short to long).
66 @param pVal1 pointer to a value
67 @param pVal1TypeDescr type description of pVal1
68 @param pVal2 pointer to another value
69 @param pVal2TypeDescr type description of pVal2
70 @param queryInterface function called each time two interfaces are tested whether they belong
71 to the same object; defaults (0) to uno
72 @param release function to release queried interfaces; defaults (0) to uno
73 @return true if values are equal
75 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_equalData(
76 void * pVal1
, struct _typelib_TypeDescription
* pVal1TypeDescr
,
77 void * pVal2
, struct _typelib_TypeDescription
* pVal2TypeDescr
,
78 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
80 /** Tests if two values are equal. May compare different types (e.g., short to long).
82 @param pVal1 pointer to a value
83 @param pVal1Type type of pVal1
84 @param pVal2 pointer to another value
85 @param pVal2Type type of pVal2
86 @param queryInterface function called each time two interfaces are tested whether they belong
87 to the same object; defaults (0) to uno
88 @param release function to release queried interfaces; defaults (0) to uno
89 @return true if values are equal
91 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_type_equalData(
92 void * pVal1
, struct _typelib_TypeDescriptionReference
* pVal1Type
,
93 void * pVal2
, struct _typelib_TypeDescriptionReference
* pVal2Type
,
94 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
97 /** Copy construct memory with given value. The size of the destination value must be larger
98 or equal to the size of the source value.
100 @param pDest pointer to destination value memory
101 @param pSource pointer to source value
102 @param pTypeDescr type description of source
103 @param acquire function called each time an interface needs to be acquired;
106 CPPU_DLLPUBLIC
void SAL_CALL
uno_copyData(
107 void * pDest
, void * pSource
,
108 struct _typelib_TypeDescription
* pTypeDescr
, uno_AcquireFunc acquire
)
109 SAL_THROW_EXTERN_C();
110 /** Copy construct memory with given value. The size of the destination value must be larger
111 or equal to the size of the source value.
113 @param pDest pointer to destination value memory
114 @param pSource pointer to source value
115 @param pType type of source
116 @param acquire function called each time an interface needs to be acquired;
119 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_copyData(
120 void * pDest
, void * pSource
,
121 struct _typelib_TypeDescriptionReference
* pType
, uno_AcquireFunc acquire
)
122 SAL_THROW_EXTERN_C();
124 /** Copy construct memory with given value. The size of the destination value must be larger
125 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
127 @param pDest pointer to destination value memory
128 @param pSource pointer to source value
129 @param pTypeDescr type description of source
130 @param mapping mapping to convert/ map interfaces
132 CPPU_DLLPUBLIC
void SAL_CALL
uno_copyAndConvertData(
133 void * pDest
, void * pSource
,
134 struct _typelib_TypeDescription
* pTypeDescr
, struct _uno_Mapping
* mapping
)
135 SAL_THROW_EXTERN_C();
136 /** Copy construct memory with given value. The size of the destination value must be larger
137 or equal to the size of the source value. Interfaces are converted/ mapped by mapping parameter.
139 @param pDest pointer to destination value memory
140 @param pSource pointer to source value
141 @param pType type of source
142 @param mapping mapping to convert/ map interfaces
144 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_copyAndConvertData(
145 void * pDest
, void * pSource
,
146 struct _typelib_TypeDescriptionReference
* pType
, struct _uno_Mapping
* mapping
)
147 SAL_THROW_EXTERN_C();
149 /** Destructs a given value; does NOT free its memory!
151 @param pValue value to be destructed
152 @param pTypeDescr type description of value
153 @param release function called each time an interface pointer needs to be released;
156 CPPU_DLLPUBLIC
void SAL_CALL
uno_destructData(
157 void * pValue
, struct _typelib_TypeDescription
* pTypeDescr
, uno_ReleaseFunc release
)
158 SAL_THROW_EXTERN_C();
159 /** Destructs a given value; does NOT free its memory!
161 @param pValue value to be destructed
162 @param pType type of value
163 @param release function called each time an interface pointer needs to be released;
166 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_destructData(
167 void * pValue
, struct _typelib_TypeDescriptionReference
* pType
, uno_ReleaseFunc release
)
168 SAL_THROW_EXTERN_C();
170 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
172 @param pMem pointer to memory of value to be constructed
173 @param pTypeDescr type description of value to be constructed
175 CPPU_DLLPUBLIC
void SAL_CALL
uno_constructData(
176 void * pMem
, struct _typelib_TypeDescription
* pTypeDescr
)
177 SAL_THROW_EXTERN_C();
178 /** Default constructs a value. All simple types are set to 0, enums are set to their default value.
180 @param pMem pointer to memory of value to be constructed
181 @param pType type of value to be constructed
183 CPPU_DLLPUBLIC
void SAL_CALL
uno_type_constructData(
184 void * pMem
, struct _typelib_TypeDescriptionReference
* pType
)
185 SAL_THROW_EXTERN_C();
187 /** Assigns a destination value with a source value.
188 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
189 Querying for demanded interface type is allowed.
190 Assignment from any value to a value of type Any and vice versa is allowed.
192 @param pDest pointer to destination value
193 @param pDestTypeDescr type description of destination value
194 @param pSource pointer to source value; if 0, then destination value will be assigned
196 @param pSourceTypeDescr type destination of source value
197 @param queryInterface function called each time an interface needs to be queried;
199 @param acquire function called each time an interface needs to be acquired;
201 @param release function called each time an interface needs to be released;
203 @return true if destination has been successfully assigned
205 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_assignData(
206 void * pDest
, struct _typelib_TypeDescription
* pDestTypeDescr
,
207 void * pSource
, struct _typelib_TypeDescription
* pSourceTypeDescr
,
208 uno_QueryInterfaceFunc queryInterface
, uno_AcquireFunc acquire
, uno_ReleaseFunc release
)
209 SAL_THROW_EXTERN_C();
210 /** Assigns a destination value with a source value.
211 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
212 Querying for demanded interface type is allowed.
213 Assignment from any value to a value of type Any and vice versa is allowed.
215 @param pDest pointer to destination value
216 @param pDestType type of destination value
217 @param pSource pointer to source value; if 0, then destination value will be assigned
219 @param pSourceType type of source value
220 @param queryInterface function called each time an interface needs to be queried;
222 @param acquire function called each time an interface needs to be acquired;
224 @param release function called each time an interface needs to be released;
226 @return true if destination has been successfully assigned
228 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_type_assignData(
229 void * pDest
, struct _typelib_TypeDescriptionReference
* pDestType
,
230 void * pSource
, struct _typelib_TypeDescriptionReference
* pSourceType
,
231 uno_QueryInterfaceFunc queryInterface
, uno_AcquireFunc acquire
, uno_ReleaseFunc release
)
232 SAL_THROW_EXTERN_C();
234 /** Tests whether a value of given type is assignable from given value.
235 Widening conversion WITHOUT data loss is allowed (e.g., assigning a long with a short).
236 Querying for demanded interface type is allowed.
237 Assignment from any value to a value of type Any and vice versa is allowed.
239 @param pAssignable type
240 @param pFrom pointer to value
241 @param pFromType type of value
242 @param queryInterface function called each time an interface needs to be queried;
244 @param release function called each time an interface needs to be released;
246 @return true if value is destination has been successfully assigned
248 CPPU_DLLPUBLIC sal_Bool SAL_CALL
uno_type_isAssignableFromData(
249 struct _typelib_TypeDescriptionReference
* pAssignable
,
250 void * pFrom
, struct _typelib_TypeDescriptionReference
* pFromType
,
251 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
252 SAL_THROW_EXTERN_C();
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */