Line data Source code
1 : #ifndef INCLUDED_POLY_HPP
2 : #define INCLUDED_POLY_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include "Poly.hdl"
7 :
8 : #include "com/sun/star/uno/Type.hxx"
9 : #include "cppu/unotype.hxx"
10 : #include "osl/mutex.hxx"
11 : #include "rtl/string.h"
12 : #include "rtl/ustrbuf.hxx"
13 : #include "rtl/ustring.h"
14 : #include "rtl/ustring.hxx"
15 : #include "rtl/instance.hxx"
16 : #include "sal/types.h"
17 : #include "typelib/typeclass.h"
18 : #include "typelib/typedescription.h"
19 :
20 :
21 2 : template< typename typeparam_T > inline Poly< typeparam_T >::Poly() SAL_THROW(())
22 2 : : member(0)
23 : {
24 2 : }
25 :
26 : template< typename typeparam_T > inline Poly< typeparam_T >::Poly(const ::sal_Int32& member_) SAL_THROW(())
27 : : member(member_)
28 : {
29 : }
30 :
31 : template< typename typeparam_T >
32 : inline Poly< typeparam_T >
33 : make_Poly(const ::sal_Int32& member_) SAL_THROW(())
34 : {
35 : return Poly< typeparam_T >(member_);
36 : }
37 :
38 :
39 : namespace cppu { namespace detail {
40 :
41 : template< typename typeparam_T > struct thePolyType : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, thePolyType< typeparam_T > >
42 : {
43 1 : ::com::sun::star::uno::Type * operator()() const
44 : {
45 1 : ::rtl::OUStringBuffer the_buffer;
46 1 : the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("Poly<"));
47 1 : the_buffer.append(::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0)).getTypeName());
48 1 : the_buffer.append(static_cast< ::sal_Unicode >('>'));
49 1 : ::rtl::OUString the_name(the_buffer.makeStringAndClear());
50 1 : ::rtl::OUString the_tname0( "long" );
51 1 : ::rtl::OUString the_name0( "member" );
52 : ::typelib_StructMember_Init the_members[] = {
53 1 : { { typelib_TypeClass_LONG, the_tname0.pData, the_name0.pData }, false } };
54 1 : ::typelib_TypeDescription * the_newType = 0;
55 1 : ::typelib_typedescription_newStruct(&the_newType, the_name.pData, 0, 1, the_members);
56 1 : ::typelib_typedescription_register(&the_newType);
57 1 : ::typelib_typedescription_release(the_newType);
58 1 : return new ::com::sun::star::uno::Type(::com::sun::star::uno::TypeClass_STRUCT, the_name); // leaked
59 : }
60 : };
61 : } }
62 :
63 : namespace cppu {
64 :
65 : template< typename typeparam_T > class UnoType< Poly< typeparam_T > > {
66 : public:
67 2 : static inline ::com::sun::star::uno::Type const & get() {
68 2 : return *detail::thePolyType< typeparam_T >::get();
69 : }
70 :
71 : private:
72 : UnoType(UnoType &); // not defined
73 : ~UnoType(); // not defined
74 : void operator =(UnoType); // not defined
75 : };
76 :
77 : }
78 :
79 : template< typename typeparam_T > inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER Poly< typeparam_T > const *) SAL_THROW(()) {
80 : return ::cppu::UnoType< Poly< typeparam_T > >::get();
81 : }
82 :
83 : #endif // INCLUDED_POLY_HPP
|