Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_REFLECTION_XTYPEDESCRIPTION_HPP
2 : #define INCLUDED_COM_SUN_STAR_REFLECTION_XTYPEDESCRIPTION_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include "com/sun/star/reflection/XTypeDescription.hdl"
7 :
8 : #include "com/sun/star/uno/XInterface.hpp"
9 : #include "com/sun/star/uno/TypeClass.hpp"
10 : #include "com/sun/star/uno/RuntimeException.hpp"
11 : #include "com/sun/star/uno/Reference.hxx"
12 : #include "com/sun/star/uno/Type.hxx"
13 : #include "cppu/unotype.hxx"
14 : #include "osl/mutex.hxx"
15 : #include "rtl/ustring.hxx"
16 : #include "rtl/instance.hxx"
17 :
18 : namespace com { namespace sun { namespace star { namespace reflection { namespace detail {
19 :
20 : struct theXTypeDescriptionType : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, theXTypeDescriptionType >
21 : {
22 33 : ::com::sun::star::uno::Type * operator()() const
23 : {
24 33 : ::rtl::OUString sTypeName( "com.sun.star.reflection.XTypeDescription" );
25 :
26 : // Start inline typedescription generation
27 33 : typelib_InterfaceTypeDescription * pTD = 0;
28 :
29 : typelib_TypeDescriptionReference * aSuperTypes[1];
30 33 : aSuperTypes[0] = ::cppu::UnoType< ::com::sun::star::uno::Reference< css::uno::XInterface > >::get().getTypeLibType();
31 33 : typelib_TypeDescriptionReference * pMembers[2] = { 0,0 };
32 33 : ::rtl::OUString sMethodName0( "com.sun.star.reflection.XTypeDescription::getTypeClass" );
33 : typelib_typedescriptionreference_new( &pMembers[0],
34 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,
35 33 : sMethodName0.pData );
36 33 : ::rtl::OUString sMethodName1( "com.sun.star.reflection.XTypeDescription::getName" );
37 : typelib_typedescriptionreference_new( &pMembers[1],
38 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,
39 33 : sMethodName1.pData );
40 :
41 : typelib_typedescription_newMIInterface(
42 : &pTD,
43 : sTypeName.pData, 0x00000000, 0x0000, 0x0000, 0x00000000, 0x00000000,
44 : 1, aSuperTypes,
45 : 2,
46 33 : pMembers );
47 :
48 33 : typelib_typedescription_register( (typelib_TypeDescription**)&pTD );
49 33 : typelib_typedescriptionreference_release( pMembers[0] );
50 33 : typelib_typedescriptionreference_release( pMembers[1] );
51 33 : typelib_typedescription_release( (typelib_TypeDescription*)pTD );
52 :
53 33 : return new ::com::sun::star::uno::Type( ::com::sun::star::uno::TypeClass_INTERFACE, sTypeName ); // leaked
54 : }
55 : };
56 :
57 : } } } } }
58 :
59 : namespace com { namespace sun { namespace star { namespace reflection {
60 :
61 17623 : inline ::com::sun::star::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER css::reflection::XTypeDescription const *) {
62 17623 : const ::com::sun::star::uno::Type &rRet = *detail::theXTypeDescriptionType::get();
63 : // End inline typedescription generation
64 : static bool bInitStarted = false;
65 17623 : if (!bInitStarted)
66 : {
67 33 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
68 33 : if (!bInitStarted)
69 : {
70 : OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
71 33 : bInitStarted = true;
72 33 : ::cppu::UnoType< css::uno::RuntimeException >::get();
73 33 : ::cppu::UnoType< css::uno::TypeClass >::get();
74 :
75 33 : typelib_InterfaceMethodTypeDescription * pMethod = 0;
76 : {
77 33 : ::rtl::OUString the_ExceptionName0( "com.sun.star.uno.RuntimeException" );
78 33 : rtl_uString * the_Exceptions[] = { the_ExceptionName0.pData };
79 33 : ::rtl::OUString sReturnType0( "com.sun.star.uno.TypeClass" );
80 33 : ::rtl::OUString sMethodName0( "com.sun.star.reflection.XTypeDescription::getTypeClass" );
81 : typelib_typedescription_newInterfaceMethod( &pMethod,
82 : 3, sal_False,
83 : sMethodName0.pData,
84 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_ENUM, sReturnType0.pData,
85 : 0, 0,
86 33 : 1, the_Exceptions );
87 33 : typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
88 : }
89 : {
90 33 : ::rtl::OUString the_ExceptionName0( "com.sun.star.uno.RuntimeException" );
91 33 : rtl_uString * the_Exceptions[] = { the_ExceptionName0.pData };
92 33 : ::rtl::OUString sReturnType1( "string" );
93 33 : ::rtl::OUString sMethodName1( "com.sun.star.reflection.XTypeDescription::getName" );
94 : typelib_typedescription_newInterfaceMethod( &pMethod,
95 : 4, sal_False,
96 : sMethodName1.pData,
97 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_STRING, sReturnType1.pData,
98 : 0, 0,
99 33 : 1, the_Exceptions );
100 33 : typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
101 : }
102 33 : typelib_typedescription_release( (typelib_TypeDescription*)pMethod );
103 33 : }
104 : }
105 : else
106 : {
107 : OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
108 : }
109 17623 : return rRet;
110 : }
111 :
112 : } } } }
113 :
114 3406 : inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::com::sun::star::uno::Reference< css::reflection::XTypeDescription > const *) SAL_THROW(()) {
115 3406 : return ::cppu::UnoType< ::com::sun::star::uno::Reference< css::reflection::XTypeDescription > >::get();
116 : }
117 :
118 3406 : ::com::sun::star::uno::Type const & css::reflection::XTypeDescription::static_type(SAL_UNUSED_PARAMETER void *) {
119 3406 : return ::getCppuType(static_cast< ::com::sun::star::uno::Reference< css::reflection::XTypeDescription > * >(0));
120 : }
121 :
122 : #endif // INCLUDED_COM_SUN_STAR_REFLECTION_XTYPEDESCRIPTION_HPP
|