Branch data 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 : 10 : template< typename typeparam_T > inline Poly< typeparam_T >::Poly() SAL_THROW(())
22 : 10 : : member(0)
23 : : {
24 : 10 : }
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 : 5 : ::com::sun::star::uno::Type * operator()() const
44 : : {
45 : 5 : ::rtl::OUStringBuffer the_buffer;
46 [ + - ]: 5 : the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("Poly<"));
47 [ + - ][ + - ]: 5 : the_buffer.append(::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0)).getTypeName());
48 [ + - ]: 5 : the_buffer.append(static_cast< ::sal_Unicode >('>'));
49 [ + - ]: 5 : ::rtl::OUString the_name(the_buffer.makeStringAndClear());
50 [ + - ]: 5 : ::rtl::OUString the_tname0(RTL_CONSTASCII_USTRINGPARAM("long"));
51 [ + - ]: 5 : ::rtl::OUString the_name0(RTL_CONSTASCII_USTRINGPARAM("member"));
52 : : ::typelib_StructMember_Init the_members[] = {
53 : 5 : { { typelib_TypeClass_LONG, the_tname0.pData, the_name0.pData }, false } };
54 : 5 : ::typelib_TypeDescription * the_newType = 0;
55 : 5 : ::typelib_typedescription_newStruct(&the_newType, the_name.pData, 0, 1, the_members);
56 : 5 : ::typelib_typedescription_register(&the_newType);
57 : 5 : ::typelib_typedescription_release(the_newType);
58 : 5 : 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 : 10 : static inline ::com::sun::star::uno::Type const & get() {
68 : 10 : 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
|