xref: /trunk/main/cppu/source/uno/any.cxx (revision 129fa3d1)
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 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cppu.hxx"
26 
27 #include "copy.hxx"
28 #include "destr.hxx"
29 
30 using namespace cppu;
31 
32 
33 extern "C"
34 {
35 //##################################################################################################
uno_type_any_assign(uno_Any * pDest,void * pSource,typelib_TypeDescriptionReference * pType,uno_AcquireFunc acquire,uno_ReleaseFunc release)36 void SAL_CALL uno_type_any_assign(
37 	uno_Any * pDest, void * pSource,
38 	typelib_TypeDescriptionReference * pType,
39 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
40 	SAL_THROW_EXTERN_C()
41 {
42 	_destructAny( pDest, release );
43 	if (pType)
44 	{
45 		_copyConstructAny( pDest, pSource, pType, 0, acquire, 0 );
46 	}
47 	else
48 	{
49 		CONSTRUCT_EMPTY_ANY( pDest );
50 	}
51 }
52 //##################################################################################################
uno_any_assign(uno_Any * pDest,void * pSource,typelib_TypeDescription * pTypeDescr,uno_AcquireFunc acquire,uno_ReleaseFunc release)53 void SAL_CALL uno_any_assign(
54 	uno_Any * pDest, void * pSource,
55 	typelib_TypeDescription * pTypeDescr,
56 	uno_AcquireFunc acquire, uno_ReleaseFunc release )
57 	SAL_THROW_EXTERN_C()
58 {
59 	_destructAny( pDest, release );
60 	if (pTypeDescr)
61 	{
62 		_copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 );
63 	}
64 	else
65 	{
66 		CONSTRUCT_EMPTY_ANY( pDest );
67 	}
68 }
69 //##################################################################################################
uno_type_any_construct(uno_Any * pDest,void * pSource,typelib_TypeDescriptionReference * pType,uno_AcquireFunc acquire)70 void SAL_CALL uno_type_any_construct(
71 	uno_Any * pDest, void * pSource,
72 	typelib_TypeDescriptionReference * pType,
73 	uno_AcquireFunc acquire )
74 	SAL_THROW_EXTERN_C()
75 {
76 	if (pType)
77 	{
78 		_copyConstructAny( pDest, pSource, pType, 0, acquire, 0 );
79 	}
80 	else
81 	{
82 		CONSTRUCT_EMPTY_ANY( pDest );
83 	}
84 }
85 //##################################################################################################
uno_any_construct(uno_Any * pDest,void * pSource,typelib_TypeDescription * pTypeDescr,uno_AcquireFunc acquire)86 void SAL_CALL uno_any_construct(
87 	uno_Any * pDest, void * pSource,
88 	typelib_TypeDescription * pTypeDescr,
89 	uno_AcquireFunc acquire )
90 	SAL_THROW_EXTERN_C()
91 {
92 	if (pTypeDescr)
93 	{
94 		_copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 );
95 	}
96 	else
97 	{
98 		CONSTRUCT_EMPTY_ANY( pDest );
99 	}
100 }
101 //##################################################################################################
uno_type_any_constructAndConvert(uno_Any * pDest,void * pSource,typelib_TypeDescriptionReference * pType,uno_Mapping * mapping)102 void SAL_CALL uno_type_any_constructAndConvert(
103 	uno_Any * pDest, void * pSource,
104 	typelib_TypeDescriptionReference * pType,
105 	uno_Mapping * mapping )
106 	SAL_THROW_EXTERN_C()
107 {
108 	if (pType)
109 	{
110 		_copyConstructAny( pDest, pSource, pType, 0, 0, mapping );
111 	}
112 	else
113 	{
114 		CONSTRUCT_EMPTY_ANY( pDest );
115 	}
116 }
117 //##################################################################################################
uno_any_constructAndConvert(uno_Any * pDest,void * pSource,typelib_TypeDescription * pTypeDescr,uno_Mapping * mapping)118 void SAL_CALL uno_any_constructAndConvert(
119 	uno_Any * pDest, void * pSource,
120 	typelib_TypeDescription * pTypeDescr,
121 	uno_Mapping * mapping )
122 	SAL_THROW_EXTERN_C()
123 {
124 	if (pTypeDescr)
125 	{
126 		_copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, 0, mapping );
127 	}
128 	else
129 	{
130 		CONSTRUCT_EMPTY_ANY( pDest );
131 	}
132 }
133 //##################################################################################################
uno_any_destruct(uno_Any * pValue,uno_ReleaseFunc release)134 void SAL_CALL uno_any_destruct( uno_Any * pValue, uno_ReleaseFunc release )
135 	SAL_THROW_EXTERN_C()
136 {
137 	_destructAny( pValue, release );
138 }
139 //##################################################################################################
uno_any_clear(uno_Any * pValue,uno_ReleaseFunc release)140 void SAL_CALL uno_any_clear( uno_Any * pValue, uno_ReleaseFunc release )
141 	SAL_THROW_EXTERN_C()
142 {
143 	_destructAny( pValue, release );
144     CONSTRUCT_EMPTY_ANY( pValue );
145 }
146 }
147