xref: /aoo42x/main/cppuhelper/source/primeweak.cxx (revision 5696ffe9)
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 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 #include "cppuhelper/com/sun/star/lang/XComponent.hpp"
46 #include "cppuhelper/com/sun/star/lang/XInitialization.hpp"
47 #include "cppuhelper/com/sun/star/lang/XSingleServiceFactory.hpp"
48 #include "cppuhelper/com/sun/star/lang/XSingleComponentFactory.hpp"
49 #include "cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp"
50 #include "cppuhelper/com/sun/star/lang/XMultiComponentFactory.hpp"
51 #include "cppuhelper/com/sun/star/lang/XServiceInfo.hpp"
52 #include "cppuhelper/com/sun/star/lang/XEventListener.hpp"
53 #include "cppuhelper/com/sun/star/lang/XTypeProvider.hpp"
54 #include "cppuhelper/com/sun/star/lang/XUnoTunnel.hpp"
55 #include "cppuhelper/com/sun/star/uno/DeploymentException.hpp"
56 #include "cppuhelper/com/sun/star/uno/XWeak.hpp"
57 #include "cppuhelper/com/sun/star/uno/XCurrentContext.hpp"
58 #include "cppuhelper/com/sun/star/uno/XComponentContext.hpp"
59 #include "cppuhelper/com/sun/star/uno/RuntimeException.hpp"
60 #include "cppuhelper/com/sun/star/beans/PropertyValue.hpp"
61 #include "cppuhelper/com/sun/star/beans/XPropertySet.hpp"
62 #include "cppuhelper/com/sun/star/beans/XMultiPropertySet.hpp"
63 #include "cppuhelper/com/sun/star/container/XEnumerationAccess.hpp"
64 #include "cppuhelper/com/sun/star/container/XEnumeration.hpp"
65 #include "cppuhelper/com/sun/star/container/XHierarchicalNameAccess.hpp"
66 #include "cppuhelper/com/sun/star/container/XSet.hpp"
67 #include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
68 #include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
69 #include "cppuhelper/com/sun/star/io/IOException.hpp"
70 #include "cppuhelper/com/sun/star/io/FilePermission.hpp"
71 #include "cppuhelper/com/sun/star/security/RuntimePermission.hpp"
72 #include "cppuhelper/com/sun/star/loader/XImplementationLoader.hpp"
73 #include "cppuhelper/com/sun/star/security/XAccessController.hpp"
74 #include "cppuhelper/com/sun/star/registry/XRegistryKey.hpp"
75 #include "cppuhelper/com/sun/star/registry/XSimpleRegistry.hpp"
76 #include "cppuhelper/com/sun/star/reflection/XTypeDescription.hpp"
77 #include "cppuhelper/com/sun/star/reflection/XEnumTypeDescription.hpp"
78 #include "cppuhelper/com/sun/star/reflection/XArrayTypeDescription.hpp"
79 #include "cppuhelper/com/sun/star/reflection/XStructTypeDescription.hpp"
80 #include "cppuhelper/com/sun/star/reflection/XUnionTypeDescription.hpp"
81 #include "cppuhelper/com/sun/star/reflection/XCompoundTypeDescription.hpp"
82 #include "cppuhelper/com/sun/star/reflection/XIndirectTypeDescription.hpp"
83 #include "cppuhelper/com/sun/star/reflection/XMethodParameter.hpp"
84 
85 void primeWeakMap( void)
86 {
87 	InitTypeDesc( com::sun::star::lang::XComponent );
88 	InitTypeDesc( com::sun::star::lang::XInitialization );
89 	InitTypeDesc( com::sun::star::lang::XSingleServiceFactory );
90 	InitTypeDesc( com::sun::star::lang::XSingleComponentFactory );
91 	InitTypeDesc( com::sun::star::lang::XMultiServiceFactory );
92 	InitTypeDesc( com::sun::star::lang::XMultiComponentFactory );
93 	InitTypeDesc( com::sun::star::lang::XServiceInfo );
94 	InitTypeDesc( com::sun::star::lang::XEventListener );
95 	InitTypeDesc( com::sun::star::lang::XTypeProvider );
96 	InitTypeDesc( com::sun::star::lang::XUnoTunnel );
97 	InitTypeDesc( com::sun::star::uno::XWeak );
98 	InitTypeDesc( com::sun::star::uno::DeploymentException );
99 	InitTypeDesc( com::sun::star::uno::XCurrentContext );
100 	InitTypeDesc( com::sun::star::uno::XComponentContext );
101 	InitTypeDesc( com::sun::star::uno::RuntimeException );
102 	InitTypeDesc( com::sun::star::beans::PropertyState );
103 	InitTypeDesc( com::sun::star::beans::PropertyValue );
104 	InitTypeDesc( com::sun::star::beans::XPropertySet );
105 	InitTypeDesc( com::sun::star::beans::XMultiPropertySet );
106 	InitTypeDesc( com::sun::star::container::XElementAccess );
107 	InitTypeDesc( com::sun::star::container::XEnumeration );
108 	InitTypeDesc( com::sun::star::container::XEnumerationAccess );
109 	InitTypeDesc( com::sun::star::container::XHierarchicalNameAccess );
110 	InitTypeDesc( com::sun::star::container::XSet );
111 	InitTypeDesc( com::sun::star::io::IOException );
112 	InitTypeDesc( com::sun::star::io::FilePermission );
113 	InitTypeDesc( com::sun::star::security::XAccessController );
114 	InitTypeDesc( com::sun::star::security::RuntimePermission);
115 	InitTypeDesc( com::sun::star::loader::XImplementationLoader );
116 	InitTypeDesc( com::sun::star::bridge::XUnoUrlResolver );
117 	InitTypeDesc( com::sun::star::registry::XRegistryKey );
118 	InitTypeDesc( com::sun::star::registry::XSimpleRegistry );
119 	InitTypeDesc( com::sun::star::reflection::XTypeDescription );
120 	InitTypeDesc( com::sun::star::reflection::XEnumTypeDescription );
121 	InitTypeDesc( com::sun::star::reflection::XArrayTypeDescription );
122 	InitTypeDesc( com::sun::star::reflection::XStructTypeDescription );
123 	InitTypeDesc( com::sun::star::reflection::XUnionTypeDescription );
124 	InitTypeDesc( com::sun::star::reflection::XCompoundTypeDescription );
125 	InitTypeDesc( com::sun::star::reflection::XIndirectTypeDescription );
126 	InitTypeDesc( com::sun::star::reflection::XMethodParameter );
127 }
128 
129