xref: /aoo41x/main/cppu/inc/uno/any2.h (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _UNO_ANY2_H_
28 #define _UNO_ANY2_H_
29 
30 #include <sal/types.h>
31 #include <uno/data.h>
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 #if defined( SAL_W32)
39 #pragma pack(push, 8)
40 #elif defined(SAL_OS2)
41 #pragma pack(push, 8)
42 #endif
43 
44 struct _typelib_TypeDescriptionReference;
45 struct _typelib_TypeDescription;
46 struct _uno_Mapping;
47 
48 /** This is the binary specification of an UNO any.
49 */
50 typedef struct _uno_Any
51 {
52 	/** type of value
53 	*/
54 	struct _typelib_TypeDescriptionReference * pType;
55 	/** pointer to value; this may point to pReserved and thus the uno_Any is not anytime
56         mem-copyable! You may have to correct the pData pointer to pReserved. Otherwise you need
57         not, because the data is stored in heap space.
58 	*/
59 	void * pData;
60     /** reserved space for storing value
61     */
62     void * pReserved;
63 } uno_Any;
64 
65 #if defined( SAL_W32) ||  defined(SAL_OS2)
66 #pragma pack(pop)
67 #endif
68 
69 /** Assign an any with a given value. Interfaces are acquired or released by the given callback
70     functions.
71 
72 	@param pDest			pointer memory of destination any
73 	@param pSource			pointer to source value; defaults (0) to default constructed value
74 	@param pTypeDescr		type description of value; defaults (0) to void
75 	@param acquire			function called each time an interface needs to be acquired;
76                             defaults (0) to uno
77 	@param release			function called each time an interface needs to be released;
78                             defaults (0) to uno
79 */
80 void SAL_CALL uno_any_assign(
81 	uno_Any * pDest, void * pSource,
82 	struct _typelib_TypeDescription * pTypeDescr,
83 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
84 	SAL_THROW_EXTERN_C();
85 /** Assign an any with a given value. Interfaces are acquired or released by the given callback
86     functions.
87 
88 	@param pDest			pointer memory of destination any
89 	@param pSource			pointer to source value; defaults (0) to default constructed value
90 	@param pTypeDescr		type description of value; defaults (0) to void
91 	@param acquire			function called each time an interface needs to be acquired;
92                             defaults (0) to uno
93 	@param release			function called each time an interface needs to be released;
94                             defaults (0) to uno
95 */
96 void SAL_CALL uno_type_any_assign(
97 	uno_Any * pDest, void * pSource,
98 	struct _typelib_TypeDescriptionReference * pType,
99 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
100 	SAL_THROW_EXTERN_C();
101 
102 /** Constructs an any with a given value. Interfaces are acquired by the given callback function.
103 
104 	@param pDest			pointer memory of destination any
105 	@param pSource			pointer to source value; defaults (0) to default constructed value
106 	@param pTypeDescr		type description of value; defaults (0) to void
107 	@param acquire			function called each time an interface needs to be acquired;
108                             defaults (0) to uno
109 */
110 void SAL_CALL uno_any_construct(
111 	uno_Any * pDest, void * pSource,
112 	struct _typelib_TypeDescription * pTypeDescr,
113 	uno_AcquireFunc acquire )
114 	SAL_THROW_EXTERN_C();
115 /** Constructs an any with a given value. Interfaces are acquired by the given callback function.
116 
117 	@param pDest			pointer memory of destination any
118 	@param pSource			pointer to source value; defaults (0) to default constructed value
119 	@param pType			type of value; defaults (0) to void
120 	@param acquire			function called each time an interface needs to be acquired;
121                             defaults (0) to uno
122 */
123 void SAL_CALL uno_type_any_construct(
124 	uno_Any * pDest, void * pSource,
125 	struct _typelib_TypeDescriptionReference * pType,
126 	uno_AcquireFunc acquire )
127 	SAL_THROW_EXTERN_C();
128 
129 /** Constructs an any with a given value and converts/ maps interfaces.
130 
131 	@param pDest			pointer memory of destination any
132 	@param pSource			pointer to source value; defaults (0) to default constructed value
133 	@param pTypeDescr		type description of value; defaults (0) to void
134 	@param mapping			mapping to convert/ map interfaces
135 */
136 void SAL_CALL uno_any_constructAndConvert(
137 	uno_Any * pDest, void * pSource,
138 	struct _typelib_TypeDescription * pTypeDescr,
139 	struct _uno_Mapping * mapping )
140 	SAL_THROW_EXTERN_C();
141 /** Constructs an any with a given value and converts/ maps interfaces.
142 
143 	@param pDest			pointer memory of destination any
144 	@param pSource			pointer to source value; defaults (0) to default constructed value
145 	@param pType			type of value; defaults (0) to void
146 	@param mapping			mapping to convert/ map interfaces
147 */
148 void SAL_CALL uno_type_any_constructAndConvert(
149 	uno_Any * pDest, void * pSource,
150 	struct _typelib_TypeDescriptionReference * pType,
151 	struct _uno_Mapping * mapping )
152 	SAL_THROW_EXTERN_C();
153 
154 /** Destructs an any.
155 
156 	@param pValue			pointer to any
157 	@param release			function called each time an interface needs to be released;
158                             defaults (0) to uno
159 */
160 void SAL_CALL uno_any_destruct(
161 	uno_Any * pValue, uno_ReleaseFunc release )
162 	SAL_THROW_EXTERN_C();
163 
164 /** Sets value to void.
165 
166 	@param pValue			pointer to any
167 	@param release			function called each time an interface needs to be released;
168                             defaults (0) to uno
169 */
170 void SAL_CALL uno_any_clear(
171 	uno_Any * pValue, uno_ReleaseFunc release )
172 	SAL_THROW_EXTERN_C();
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif
179