Line data Source code
1 : #ifndef INCLUDED_TEST_TESTTOOLS_BRIDGETEST_TESTPOLYSTRUCT_HPP
2 : #define INCLUDED_TEST_TESTTOOLS_BRIDGETEST_TESTPOLYSTRUCT_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include "test/testtools/bridgetest/TestPolyStruct.hdl"
7 :
8 : #include "com/sun/star/uno/Type.hxx"
9 : #include "cppu/unotype.hxx"
10 : #include "rtl/strbuf.hxx"
11 : #include "rtl/textenc.h"
12 : #include "rtl/ustring.hxx"
13 : #include "sal/types.h"
14 : #include "typelib/typeclass.h"
15 : #include "typelib/typedescription.h"
16 :
17 : namespace test { namespace testtools { namespace bridgetest {
18 :
19 45 : template< typename typeparam_T > inline TestPolyStruct< typeparam_T >::TestPolyStruct() SAL_THROW(())
20 45 : : member()
21 : {
22 45 : }
23 :
24 57 : template< typename typeparam_T > inline TestPolyStruct< typeparam_T >::TestPolyStruct(typeparam_T const & member_) SAL_THROW(())
25 57 : : member(member_)
26 : {
27 57 : }
28 :
29 : template< typename typeparam_T >
30 : inline TestPolyStruct< typeparam_T >
31 : make_TestPolyStruct(typeparam_T const & member_) SAL_THROW(())
32 : {
33 : return TestPolyStruct< typeparam_T >(member_);
34 : }
35 :
36 : } } }
37 :
38 : namespace cppu {
39 :
40 : template< typename typeparam_T > class UnoType< ::test::testtools::bridgetest::TestPolyStruct< typeparam_T > > {
41 : public:
42 93 : static inline ::com::sun::star::uno::Type const & get() {
43 : //TODO: On certain platforms with weak memory models, the following code can result in some threads observing that the_type points to garbage
44 : static ::typelib_TypeDescriptionReference * the_type = 0;
45 93 : if (the_type == 0) {
46 67 : ::rtl::OStringBuffer the_buffer("test.testtools.bridgetest.TestPolyStruct<");
47 67 : the_buffer.append(::rtl::OUStringToOString(::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8));
48 67 : the_buffer.append('>');
49 67 : ::typelib_static_type_init(&the_type, typelib_TypeClass_STRUCT, the_buffer.getStr());
50 : }
51 93 : return *reinterpret_cast< ::com::sun::star::uno::Type * >(&the_type);
52 : }
53 :
54 : private:
55 : UnoType(UnoType &); // not defined
56 : ~UnoType(); // not defined
57 : void operator =(UnoType); // not defined
58 : };
59 :
60 : }
61 :
62 : template< typename typeparam_T > inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::testtools::bridgetest::TestPolyStruct< typeparam_T > const *) SAL_THROW(()) {
63 : return ::cppu::UnoType< ::test::testtools::bridgetest::TestPolyStruct< typeparam_T > >::get();
64 : }
65 :
66 : #endif // INCLUDED_TEST_TESTTOOLS_BRIDGETEST_TESTPOLYSTRUCT_HPP
|