Branch data Line data Source code
1 : : #ifndef INCLUDED_COM_SUN_STAR_BEANS_PAIR_HPP
2 : : #define INCLUDED_COM_SUN_STAR_BEANS_PAIR_HPP
3 : :
4 : : #include "sal/config.h"
5 : :
6 : : #include "com/sun/star/beans/Pair.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 com { namespace sun { namespace star { namespace beans {
18 : :
19 : 30 : template< typename typeparam_T, typename typeparam_U > inline Pair< typeparam_T, typeparam_U >::Pair() SAL_THROW(())
20 : : : First()
21 : 30 : , Second()
22 : : {
23 : 30 : }
24 : :
25 : 730 : template< typename typeparam_T, typename typeparam_U > inline Pair< typeparam_T, typeparam_U >::Pair(typeparam_T const & First_, typeparam_U const & Second_) SAL_THROW(())
26 : : : First(First_)
27 : 730 : , Second(Second_)
28 : : {
29 : 730 : }
30 : :
31 : : template< typename typeparam_T, typename typeparam_U >
32 : : inline Pair< typeparam_T, typeparam_U >
33 : 378 : make_Pair(typeparam_T const & First_, typeparam_U const & Second_) SAL_THROW(())
34 : : {
35 : 378 : return Pair< typeparam_T, typeparam_U >(First_, Second_);
36 : : }
37 : :
38 : : } } } }
39 : :
40 : : namespace cppu {
41 : :
42 : : template< typename typeparam_T, typename typeparam_U > class UnoType< ::com::sun::star::beans::Pair< typeparam_T, typeparam_U > > {
43 : : public:
44 : 44 : static inline ::com::sun::star::uno::Type const & get() {
45 : : //TODO: On certain platforms with weak memory models, the following code can result in some threads observing that the_type points to garbage
46 : : static ::typelib_TypeDescriptionReference * the_type = 0;
47 [ + + ]: 44 : if (the_type == 0) {
48 : 24 : ::rtl::OStringBuffer the_buffer("com.sun.star.beans.Pair<");
49 [ + - ][ + - ]: 24 : the_buffer.append(::rtl::OUStringToOString(::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8));
50 [ + - ]: 24 : the_buffer.append(',');
51 [ # # + - ]: 24 : the_buffer.append(::rtl::OUStringToOString(::cppu::getTypeFavourChar(static_cast< typeparam_U * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8));
[ # + - ]
[ # # ]
52 [ + - ]: 24 : the_buffer.append('>');
53 : 24 : ::typelib_static_type_init(&the_type, typelib_TypeClass_STRUCT, the_buffer.getStr());
54 : : }
55 : 44 : return *reinterpret_cast< ::com::sun::star::uno::Type * >(&the_type);
56 : : }
57 : :
58 : : private:
59 : : UnoType(UnoType &); // not defined
60 : : ~UnoType(); // not defined
61 : : void operator =(UnoType); // not defined
62 : : };
63 : :
64 : : }
65 : :
66 : : template< typename typeparam_T, typename typeparam_U > inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::com::sun::star::beans::Pair< typeparam_T, typeparam_U > const *) SAL_THROW(()) {
67 : : return ::cppu::UnoType< ::com::sun::star::beans::Pair< typeparam_T, typeparam_U > >::get();
68 : : }
69 : :
70 : : #endif // INCLUDED_COM_SUN_STAR_BEANS_PAIR_HPP
|