Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_REFLECTION_XENUMTYPEDESCRIPTION_HPP
2 : #define INCLUDED_COM_SUN_STAR_REFLECTION_XENUMTYPEDESCRIPTION_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include "com/sun/star/reflection/XEnumTypeDescription.hdl"
7 :
8 : #include "com/sun/star/uno/RuntimeException.hpp"
9 : #include "com/sun/star/reflection/XTypeDescription.hpp"
10 : #include "com/sun/star/uno/Reference.hxx"
11 : #include "com/sun/star/uno/Sequence.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 : #include "sal/types.h"
18 :
19 : namespace com { namespace sun { namespace star { namespace reflection { namespace detail {
20 :
21 : struct theXEnumTypeDescriptionType : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, theXEnumTypeDescriptionType >
22 : {
23 30 : ::com::sun::star::uno::Type * operator()() const
24 : {
25 30 : ::rtl::OUString sTypeName( "com.sun.star.reflection.XEnumTypeDescription" );
26 :
27 : // Start inline typedescription generation
28 30 : typelib_InterfaceTypeDescription * pTD = 0;
29 :
30 : typelib_TypeDescriptionReference * aSuperTypes[1];
31 30 : aSuperTypes[0] = ::cppu::UnoType< ::com::sun::star::uno::Reference< css::reflection::XTypeDescription > >::get().getTypeLibType();
32 30 : typelib_TypeDescriptionReference * pMembers[3] = { 0,0,0 };
33 30 : ::rtl::OUString sMethodName0( "com.sun.star.reflection.XEnumTypeDescription::getDefaultEnumValue" );
34 : typelib_typedescriptionreference_new( &pMembers[0],
35 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,
36 30 : sMethodName0.pData );
37 30 : ::rtl::OUString sMethodName1( "com.sun.star.reflection.XEnumTypeDescription::getEnumNames" );
38 : typelib_typedescriptionreference_new( &pMembers[1],
39 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,
40 30 : sMethodName1.pData );
41 30 : ::rtl::OUString sMethodName2( "com.sun.star.reflection.XEnumTypeDescription::getEnumValues" );
42 : typelib_typedescriptionreference_new( &pMembers[2],
43 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,
44 30 : sMethodName2.pData );
45 :
46 : typelib_typedescription_newMIInterface(
47 : &pTD,
48 : sTypeName.pData, 0x00000000, 0x0000, 0x0000, 0x00000000, 0x00000000,
49 : 1, aSuperTypes,
50 : 3,
51 30 : pMembers );
52 :
53 30 : typelib_typedescription_register( (typelib_TypeDescription**)&pTD );
54 30 : typelib_typedescriptionreference_release( pMembers[0] );
55 30 : typelib_typedescriptionreference_release( pMembers[1] );
56 30 : typelib_typedescriptionreference_release( pMembers[2] );
57 30 : typelib_typedescription_release( (typelib_TypeDescription*)pTD );
58 :
59 30 : return new ::com::sun::star::uno::Type( ::com::sun::star::uno::TypeClass_INTERFACE, sTypeName ); // leaked
60 : }
61 : };
62 :
63 : } } } } }
64 :
65 : namespace com { namespace sun { namespace star { namespace reflection {
66 :
67 30 : inline ::com::sun::star::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER css::reflection::XEnumTypeDescription const *) {
68 30 : const ::com::sun::star::uno::Type &rRet = *detail::theXEnumTypeDescriptionType::get();
69 : // End inline typedescription generation
70 : static bool bInitStarted = false;
71 30 : if (!bInitStarted)
72 : {
73 30 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
74 30 : if (!bInitStarted)
75 : {
76 : OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
77 30 : bInitStarted = true;
78 30 : ::cppu::UnoType< css::uno::RuntimeException >::get();
79 30 : ::cppu::UnoType< ::cppu::UnoSequenceType< ::rtl::OUString > >::get();
80 30 : ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Int32 > >::get();
81 :
82 30 : typelib_InterfaceMethodTypeDescription * pMethod = 0;
83 : {
84 30 : ::rtl::OUString the_ExceptionName0( "com.sun.star.uno.RuntimeException" );
85 30 : rtl_uString * the_Exceptions[] = { the_ExceptionName0.pData };
86 30 : ::rtl::OUString sReturnType0( "long" );
87 30 : ::rtl::OUString sMethodName0( "com.sun.star.reflection.XEnumTypeDescription::getDefaultEnumValue" );
88 : typelib_typedescription_newInterfaceMethod( &pMethod,
89 : 5, sal_False,
90 : sMethodName0.pData,
91 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_LONG, sReturnType0.pData,
92 : 0, 0,
93 30 : 1, the_Exceptions );
94 30 : typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
95 : }
96 : {
97 30 : ::rtl::OUString the_ExceptionName0( "com.sun.star.uno.RuntimeException" );
98 30 : rtl_uString * the_Exceptions[] = { the_ExceptionName0.pData };
99 30 : ::rtl::OUString sReturnType1( "[]string" );
100 30 : ::rtl::OUString sMethodName1( "com.sun.star.reflection.XEnumTypeDescription::getEnumNames" );
101 : typelib_typedescription_newInterfaceMethod( &pMethod,
102 : 6, sal_False,
103 : sMethodName1.pData,
104 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_SEQUENCE, sReturnType1.pData,
105 : 0, 0,
106 30 : 1, the_Exceptions );
107 30 : typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
108 : }
109 : {
110 30 : ::rtl::OUString the_ExceptionName0( "com.sun.star.uno.RuntimeException" );
111 30 : rtl_uString * the_Exceptions[] = { the_ExceptionName0.pData };
112 30 : ::rtl::OUString sReturnType2( "[]long" );
113 30 : ::rtl::OUString sMethodName2( "com.sun.star.reflection.XEnumTypeDescription::getEnumValues" );
114 : typelib_typedescription_newInterfaceMethod( &pMethod,
115 : 7, sal_False,
116 : sMethodName2.pData,
117 : (typelib_TypeClass)::com::sun::star::uno::TypeClass_SEQUENCE, sReturnType2.pData,
118 : 0, 0,
119 30 : 1, the_Exceptions );
120 30 : typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
121 : }
122 30 : typelib_typedescription_release( (typelib_TypeDescription*)pMethod );
123 30 : }
124 : }
125 : else
126 : {
127 : OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
128 : }
129 30 : return rRet;
130 : }
131 :
132 : } } } }
133 :
134 30 : inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::com::sun::star::uno::Reference< css::reflection::XEnumTypeDescription > const *) SAL_THROW(()) {
135 30 : return ::cppu::UnoType< ::com::sun::star::uno::Reference< css::reflection::XEnumTypeDescription > >::get();
136 : }
137 :
138 30 : ::com::sun::star::uno::Type const & css::reflection::XEnumTypeDescription::static_type(SAL_UNUSED_PARAMETER void *) {
139 30 : return ::getCppuType(static_cast< ::com::sun::star::uno::Reference< css::reflection::XEnumTypeDescription > * >(0));
140 : }
141 :
142 : #endif // INCLUDED_COM_SUN_STAR_REFLECTION_XENUMTYPEDESCRIPTION_HPP
|