xref: /aoo41x/main/cppuhelper/source/primeweak.cxx (revision c52956d9)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_cppuhelper.hxx"
24 
25 // The only purpose of this file is to workaround a problem in UNO:
26 // Cppumaker and its brethren emit different implementations for
27 // the same symbol by design (!) which is quite... unfortunate
28 // and can confuse the heck out of dynamic linkers, debuggers, etc.
29 //
30 // For bootstrapping the comprehensive descriptions of some UNO types are needed.
31 // The mechanism in this file makes sure that these comprehensive type
32 // descriptions are used to prime the so-called "WeakMap".
33 //
34 // TODO: change cppumaker and its brethren to use different symbol names
35 //       for different implementations. In particular "cppu_detail_getUnoType"
36 //       should be divided into full, weak and mini implementations.
37 
38 // Types that are candidates for this special workaround are the ones mentioned
39 // by the exceptions thrown from implbase_ex.cxx's __queryDeepNoXInterface()
40 // that also need to added to the makefile's UNOTYPES define
41 
42 #define cppu_detail_getUnoType cppu_full_getUnoType
43 #define InitTypeDesc(T) {(void)cppu_full_getUnoType(static_cast< T * >(NULL));}
44 
45 // NOTE: the cppuhelper part in the include paths below ensures that the type descriptions
46 // are comprehensive descriptions and not some weak descriptions e.g. from solver
47 #include "cppuhelper/com/sun/star/lang/XComponent.hpp"
48 #include "cppuhelper/com/sun/star/lang/XInitialization.hpp"
49 #include "cppuhelper/com/sun/star/lang/XSingleServiceFactory.hpp"
50 #include "cppuhelper/com/sun/star/lang/XSingleComponentFactory.hpp"
51 #include "cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp"
52 #include "cppuhelper/com/sun/star/lang/XMultiComponentFactory.hpp"
53 #include "cppuhelper/com/sun/star/lang/XServiceInfo.hpp"
54 #include "cppuhelper/com/sun/star/lang/XEventListener.hpp"
55 #include "cppuhelper/com/sun/star/lang/XTypeProvider.hpp"
56 #include "cppuhelper/com/sun/star/lang/XUnoTunnel.hpp"
57 #include "cppuhelper/com/sun/star/lang/DisposedException.hpp"
58 #include "cppuhelper/com/sun/star/uno/DeploymentException.hpp"
59 #include "cppuhelper/com/sun/star/uno/XWeak.hpp"
60 #include "cppuhelper/com/sun/star/uno/XCurrentContext.hpp"
61 #include "cppuhelper/com/sun/star/uno/XComponentContext.hpp"
62 #include "cppuhelper/com/sun/star/uno/RuntimeException.hpp"
63 #include "cppuhelper/com/sun/star/util/XMacroExpander.hpp"
64 #include "cppuhelper/com/sun/star/beans/PropertyValue.hpp"
65 #include "cppuhelper/com/sun/star/beans/XPropertySet.hpp"
66 #include "cppuhelper/com/sun/star/beans/XMultiPropertySet.hpp"
67 #include "cppuhelper/com/sun/star/container/XEnumerationAccess.hpp"
68 #include "cppuhelper/com/sun/star/container/XEnumeration.hpp"
69 #include "cppuhelper/com/sun/star/container/XNameAccess.hpp"
70 #include "cppuhelper/com/sun/star/container/XNameReplace.hpp"
71 #include "cppuhelper/com/sun/star/container/XNameContainer.hpp"
72 #include "cppuhelper/com/sun/star/container/XHierarchicalNameAccess.hpp"
73 #include "cppuhelper/com/sun/star/container/XSet.hpp"
74 #include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
75 #include "cppuhelper/com/sun/star/io/IOException.hpp"
76 #include "cppuhelper/com/sun/star/io/FilePermission.hpp"
77 #include "cppuhelper/com/sun/star/security/RuntimePermission.hpp"
78 #include "cppuhelper/com/sun/star/loader/XImplementationLoader.hpp"
79 #include "cppuhelper/com/sun/star/security/XAccessController.hpp"
80 #include "cppuhelper/com/sun/star/registry/XRegistryKey.hpp"
81 #include "cppuhelper/com/sun/star/registry/XSimpleRegistry.hpp"
82 #include "cppuhelper/com/sun/star/reflection/XTypeDescription.hpp"
83 #include "cppuhelper/com/sun/star/reflection/XEnumTypeDescription.hpp"
84 #include "cppuhelper/com/sun/star/reflection/XArrayTypeDescription.hpp"
85 #include "cppuhelper/com/sun/star/reflection/XStructTypeDescription.hpp"
86 #include "cppuhelper/com/sun/star/reflection/XUnionTypeDescription.hpp"
87 #include "cppuhelper/com/sun/star/reflection/XCompoundTypeDescription.hpp"
88 #include "cppuhelper/com/sun/star/reflection/XIndirectTypeDescription.hpp"
89 #include "cppuhelper/com/sun/star/reflection/XInterfaceTypeDescription.hpp"
90 #include "cppuhelper/com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp"
91 #include "cppuhelper/com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp"
92 #include "cppuhelper/com/sun/star/reflection/XMethodParameter.hpp"
93 
94 void primeWeakMap( void)
95 {
96 	InitTypeDesc( com::sun::star::lang::XComponent );
97 	InitTypeDesc( com::sun::star::lang::XInitialization );
98 	InitTypeDesc( com::sun::star::lang::XSingleServiceFactory );
99 	InitTypeDesc( com::sun::star::lang::XSingleComponentFactory );
100 	InitTypeDesc( com::sun::star::lang::XMultiServiceFactory );
101 	InitTypeDesc( com::sun::star::lang::XMultiComponentFactory );
102 	InitTypeDesc( com::sun::star::lang::XServiceInfo );
103 	InitTypeDesc( com::sun::star::lang::XEventListener );
104 	InitTypeDesc( com::sun::star::lang::XTypeProvider );
105 	InitTypeDesc( com::sun::star::lang::XUnoTunnel );
106 	InitTypeDesc( com::sun::star::lang::DisposedException );
107 	InitTypeDesc( com::sun::star::uno::XWeak );
108 	InitTypeDesc( com::sun::star::uno::DeploymentException );
109 	InitTypeDesc( com::sun::star::uno::XCurrentContext );
110 	InitTypeDesc( com::sun::star::uno::XComponentContext );
111 	InitTypeDesc( com::sun::star::uno::RuntimeException );
112 	InitTypeDesc( com::sun::star::util::XMacroExpander );
113 	InitTypeDesc( com::sun::star::beans::PropertyState );
114 	InitTypeDesc( com::sun::star::beans::PropertyValue );
115 	InitTypeDesc( com::sun::star::beans::XPropertySet );
116 	InitTypeDesc( com::sun::star::beans::XMultiPropertySet );
117 	InitTypeDesc( com::sun::star::container::XElementAccess );
118 	InitTypeDesc( com::sun::star::container::XEnumeration );
119 	InitTypeDesc( com::sun::star::container::XEnumerationAccess );
120 	InitTypeDesc( com::sun::star::container::XHierarchicalNameAccess );
121 	InitTypeDesc( com::sun::star::container::XNameAccess );
122 	InitTypeDesc( com::sun::star::container::XNameReplace );
123 	InitTypeDesc( com::sun::star::container::XNameContainer );
124 	InitTypeDesc( com::sun::star::container::XSet );
125 	InitTypeDesc( com::sun::star::io::IOException );
126 	InitTypeDesc( com::sun::star::io::FilePermission );
127 	InitTypeDesc( com::sun::star::security::XAccessController );
128 	InitTypeDesc( com::sun::star::security::RuntimePermission);
129 	InitTypeDesc( com::sun::star::loader::XImplementationLoader );
130 	InitTypeDesc( com::sun::star::bridge::XUnoUrlResolver );
131 	InitTypeDesc( com::sun::star::registry::XRegistryKey );
132 	InitTypeDesc( com::sun::star::registry::XSimpleRegistry );
133 	InitTypeDesc( com::sun::star::reflection::XTypeDescription );
134 	InitTypeDesc( com::sun::star::reflection::XEnumTypeDescription );
135 	InitTypeDesc( com::sun::star::reflection::XArrayTypeDescription );
136 	InitTypeDesc( com::sun::star::reflection::XStructTypeDescription );
137 	InitTypeDesc( com::sun::star::reflection::XUnionTypeDescription );
138 	InitTypeDesc( com::sun::star::reflection::XCompoundTypeDescription );
139 	InitTypeDesc( com::sun::star::reflection::XIndirectTypeDescription );
140 	InitTypeDesc( com::sun::star::reflection::XInterfaceTypeDescription );
141 	InitTypeDesc( com::sun::star::reflection::XInterfaceMemberTypeDescription );
142 	InitTypeDesc( com::sun::star::reflection::XInterfaceMethodTypeDescription );
143 	InitTypeDesc( com::sun::star::reflection::XMethodParameter );
144 }
145 
146