xref: /trunk/main/cppu/inc/uno/any2.h (revision 24f6443d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UNO_ANY2_H_
24 #define _UNO_ANY2_H_
25 
26 #include <sal/types.h>
27 #include <uno/data.h>
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34 #if defined( SAL_W32)
35 #pragma pack(push, 8)
36 #elif defined(SAL_OS2)
37 #pragma pack(push, 8)
38 #endif
39 
40 struct _typelib_TypeDescriptionReference;
41 struct _typelib_TypeDescription;
42 struct _uno_Mapping;
43 
44 /** This is the binary specification of an UNO any.
45 */
46 typedef struct _uno_Any
47 {
48 	/** type of value
49 	*/
50 	struct _typelib_TypeDescriptionReference * pType;
51 	/** pointer to value; this may point to pReserved and thus the uno_Any is not anytime
52         mem-copyable! You may have to correct the pData pointer to pReserved. Otherwise you need
53         not, because the data is stored in heap space.
54 	*/
55 	void * pData;
56     /** reserved space for storing value
57     */
58     void * pReserved;
59 } uno_Any;
60 
61 #if defined( SAL_W32) ||  defined(SAL_OS2)
62 #pragma pack(pop)
63 #endif
64 
65 /** Assign an any with a given value. Interfaces are acquired or released by the given callback
66     functions.
67 
68 	@param pDest			pointer memory of destination any
69 	@param pSource			pointer to source value; defaults (0) to default constructed value
70 	@param pTypeDescr		type description of value; defaults (0) to void
71 	@param acquire			function called each time an interface needs to be acquired;
72                             defaults (0) to uno
73 	@param release			function called each time an interface needs to be released;
74                             defaults (0) to uno
75 */
76 void SAL_CALL uno_any_assign(
77 	uno_Any * pDest, void * pSource,
78 	struct _typelib_TypeDescription * pTypeDescr,
79 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
80 	SAL_THROW_EXTERN_C();
81 /** Assign an any with a given value. Interfaces are acquired or released by the given callback
82     functions.
83 
84 	@param pDest			pointer memory of destination any
85 	@param pSource			pointer to source value; defaults (0) to default constructed value
86 	@param pTypeDescr		type description of value; defaults (0) to void
87 	@param acquire			function called each time an interface needs to be acquired;
88                             defaults (0) to uno
89 	@param release			function called each time an interface needs to be released;
90                             defaults (0) to uno
91 */
92 void SAL_CALL uno_type_any_assign(
93 	uno_Any * pDest, void * pSource,
94 	struct _typelib_TypeDescriptionReference * pType,
95 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
96 	SAL_THROW_EXTERN_C();
97 
98 /** Constructs an any with a given value. Interfaces are acquired by the given callback function.
99 
100 	@param pDest			pointer memory of destination any
101 	@param pSource			pointer to source value; defaults (0) to default constructed value
102 	@param pTypeDescr		type description of value; defaults (0) to void
103 	@param acquire			function called each time an interface needs to be acquired;
104                             defaults (0) to uno
105 */
106 void SAL_CALL uno_any_construct(
107 	uno_Any * pDest, void * pSource,
108 	struct _typelib_TypeDescription * pTypeDescr,
109 	uno_AcquireFunc acquire )
110 	SAL_THROW_EXTERN_C();
111 /** Constructs an any with a given value. Interfaces are acquired by the given callback function.
112 
113 	@param pDest			pointer memory of destination any
114 	@param pSource			pointer to source value; defaults (0) to default constructed value
115 	@param pType			type of value; defaults (0) to void
116 	@param acquire			function called each time an interface needs to be acquired;
117                             defaults (0) to uno
118 */
119 void SAL_CALL uno_type_any_construct(
120 	uno_Any * pDest, void * pSource,
121 	struct _typelib_TypeDescriptionReference * pType,
122 	uno_AcquireFunc acquire )
123 	SAL_THROW_EXTERN_C();
124 
125 /** Constructs an any with a given value and converts/ maps interfaces.
126 
127 	@param pDest			pointer memory of destination any
128 	@param pSource			pointer to source value; defaults (0) to default constructed value
129 	@param pTypeDescr		type description of value; defaults (0) to void
130 	@param mapping			mapping to convert/ map interfaces
131 */
132 void SAL_CALL uno_any_constructAndConvert(
133 	uno_Any * pDest, void * pSource,
134 	struct _typelib_TypeDescription * pTypeDescr,
135 	struct _uno_Mapping * mapping )
136 	SAL_THROW_EXTERN_C();
137 /** Constructs an any with a given value and converts/ maps interfaces.
138 
139 	@param pDest			pointer memory of destination any
140 	@param pSource			pointer to source value; defaults (0) to default constructed value
141 	@param pType			type of value; defaults (0) to void
142 	@param mapping			mapping to convert/ map interfaces
143 */
144 void SAL_CALL uno_type_any_constructAndConvert(
145 	uno_Any * pDest, void * pSource,
146 	struct _typelib_TypeDescriptionReference * pType,
147 	struct _uno_Mapping * mapping )
148 	SAL_THROW_EXTERN_C();
149 
150 /** Destructs an any.
151 
152 	@param pValue			pointer to any
153 	@param release			function called each time an interface needs to be released;
154                             defaults (0) to uno
155 */
156 void SAL_CALL uno_any_destruct(
157 	uno_Any * pValue, uno_ReleaseFunc release )
158 	SAL_THROW_EXTERN_C();
159 
160 /** Sets value to void.
161 
162 	@param pValue			pointer to any
163 	@param release			function called each time an interface needs to be released;
164                             defaults (0) to uno
165 */
166 void SAL_CALL uno_any_clear(
167 	uno_Any * pValue, uno_ReleaseFunc release )
168 	SAL_THROW_EXTERN_C();
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif
175