Branch data Line data Source code
1 : : #ifndef INCLUDED_TEST_CODEMAKER_CPPUMAKER_STRUCT_HPP
2 : : #define INCLUDED_TEST_CODEMAKER_CPPUMAKER_STRUCT_HPP
3 : :
4 : : #include "sal/config.h"
5 : :
6 : : #include "test/codemaker/cppumaker/Struct.hdl"
7 : :
8 : : #include "com/sun/star/uno/Any.hxx"
9 : : #include "com/sun/star/uno/Sequence.hxx"
10 : : #include "com/sun/star/uno/Type.hxx"
11 : : #include "cppu/unotype.hxx"
12 : : #include "osl/mutex.hxx"
13 : : #include "rtl/string.h"
14 : : #include "rtl/ustrbuf.hxx"
15 : : #include "rtl/ustring.h"
16 : : #include "rtl/ustring.hxx"
17 : : #include "rtl/instance.hxx"
18 : : #include "sal/types.h"
19 : : #include "typelib/typeclass.h"
20 : : #include "typelib/typedescription.h"
21 : :
22 : : namespace test { namespace codemaker { namespace cppumaker {
23 : :
24 : 15 : template< typename typeparam_T, typename typeparam_U > inline Struct< typeparam_T, typeparam_U >::Struct() SAL_THROW(())
25 : : : member1()
26 : 15 : , member2()
27 : : {
28 : 15 : }
29 : :
30 : 15 : template< typename typeparam_T, typename typeparam_U > inline Struct< typeparam_T, typeparam_U >::Struct(typeparam_T const & member1_, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& member2_) SAL_THROW(())
31 : : : member1(member1_)
32 : 15 : , member2(member2_)
33 : : {
34 : 15 : }
35 : :
36 : : template< typename typeparam_T, typename typeparam_U >
37 : : inline Struct< typeparam_T, typeparam_U >
38 : 5 : make_Struct(typeparam_T const & member1_, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& member2_) SAL_THROW(())
39 : : {
40 : 5 : return Struct< typeparam_T, typeparam_U >(member1_, member2_);
41 : : }
42 : :
43 : : } } }
44 : :
45 : : namespace cppu { namespace detail {
46 : :
47 : : template< typename typeparam_T, typename typeparam_U > struct theStructType : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, theStructType< typeparam_T, typeparam_U > >
48 : : {
49 : 10 : ::com::sun::star::uno::Type * operator()() const
50 : : {
51 : 10 : ::rtl::OUStringBuffer the_buffer;
52 [ + - + - ]: 10 : the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("test.codemaker.cppumaker.Struct<"));
53 [ + - ][ + - ]: 10 : the_buffer.append(::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0)).getTypeName());
[ + - ]
54 [ + - + - ]: 10 : the_buffer.append(static_cast< ::sal_Unicode >(','));
55 [ + - ][ + - ]: 10 : the_buffer.append(::cppu::getTypeFavourChar(static_cast< typeparam_U * >(0)).getTypeName());
56 [ + - + - ]: 10 : the_buffer.append(static_cast< ::sal_Unicode >('>'));
57 [ + - ][ + - ]: 10 : ::rtl::OUString the_name(the_buffer.makeStringAndClear());
58 [ + - ]: 10 : ::com::sun::star::uno::Type const & the_ptype0 = ::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0));
59 : 10 : ::typelib_TypeClass the_pclass0 = (::typelib_TypeClass) the_ptype0.getTypeClass();
60 : 10 : ::rtl::OUString the_pname0(the_ptype0.getTypeName());
61 [ + - + - ]: 10 : ::rtl::OUString the_name0(RTL_CONSTASCII_USTRINGPARAM("member1"));
62 [ + - ][ + - ]: 10 : ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::com::sun::star::uno::Any > > >::get();
63 [ + - ][ + - ]: 10 : ::rtl::OUString the_tname0(RTL_CONSTASCII_USTRINGPARAM("[][]any"));
64 [ + - ][ + - ]: 10 : ::rtl::OUString the_name1(RTL_CONSTASCII_USTRINGPARAM("member2"));
65 : : ::typelib_StructMember_Init the_members[] = {
66 : : { { the_pclass0, the_pname0.pData, the_name0.pData }, true },
67 : 10 : { { typelib_TypeClass_SEQUENCE, the_tname0.pData, the_name1.pData }, false } };
68 : 10 : ::typelib_TypeDescription * the_newType = 0;
69 : 10 : ::typelib_typedescription_newStruct(&the_newType, the_name.pData, 0, 2, the_members);
70 : 10 : ::typelib_typedescription_register(&the_newType);
71 : 10 : ::typelib_typedescription_release(the_newType);
72 : 10 : return new ::com::sun::star::uno::Type(::com::sun::star::uno::TypeClass_STRUCT, the_name); // leaked
73 : : }
74 : : };
75 : : } }
76 : :
77 : : namespace cppu {
78 : :
79 : : template< typename typeparam_T, typename typeparam_U > class UnoType< ::test::codemaker::cppumaker::Struct< typeparam_T, typeparam_U > > {
80 : : public:
81 : 10 : static inline ::com::sun::star::uno::Type const & get() {
82 : 10 : return *detail::theStructType< typeparam_T, typeparam_U >::get();
83 : : }
84 : :
85 : : private:
86 : : UnoType(UnoType &); // not defined
87 : : ~UnoType(); // not defined
88 : : void operator =(UnoType); // not defined
89 : : };
90 : :
91 : : }
92 : :
93 : : template< typename typeparam_T, typename typeparam_U > inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::cppumaker::Struct< typeparam_T, typeparam_U > const *) SAL_THROW(()) {
94 : : return ::cppu::UnoType< ::test::codemaker::cppumaker::Struct< typeparam_T, typeparam_U > >::get();
95 : : }
96 : :
97 : : #endif // INCLUDED_TEST_CODEMAKER_CPPUMAKER_STRUCT_HPP
|