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