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