LCOV - code coverage report
Current view: top level - workdir/unxlngi6.pro/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/beans - Optional.hpp (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 22 100.0 %
Date: 2012-08-25 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 14 50.0 %

           Branch data     Line data    Source code
       1                 :            : #ifndef INCLUDED_COM_SUN_STAR_BEANS_OPTIONAL_HPP
       2                 :            : #define INCLUDED_COM_SUN_STAR_BEANS_OPTIONAL_HPP
       3                 :            : 
       4                 :            : #include "sal/config.h"
       5                 :            : 
       6                 :            : #include "com/sun/star/beans/Optional.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                 :            : namespace com { namespace sun { namespace star { namespace beans {
      21                 :            : 
      22                 :            : template< typename typeparam_T > inline Optional< typeparam_T >::Optional() SAL_THROW(())
      23                 :            :     : IsPresent(false)
      24                 :            :     , Value()
      25                 :            : {
      26                 :            : }
      27                 :            : 
      28                 :            : template< typename typeparam_T > inline Optional< typeparam_T >::Optional(const ::sal_Bool& IsPresent_, typeparam_T const & Value_) SAL_THROW(())
      29                 :            :     : IsPresent(IsPresent_)
      30                 :            :     , Value(Value_)
      31                 :            : {
      32                 :            : }
      33                 :            : 
      34                 :            : template< typename typeparam_T > 
      35                 :            : inline Optional< typeparam_T >
      36                 :            : make_Optional(const ::sal_Bool& IsPresent_, typeparam_T const & Value_) SAL_THROW(())
      37                 :            : {
      38                 :            :     return Optional< typeparam_T >(IsPresent_, Value_);
      39                 :            : }
      40                 :            : 
      41                 :            : } } } }
      42                 :            : 
      43                 :            : namespace cppu {  namespace detail {
      44                 :            : 
      45                 :            : template< typename typeparam_T > struct theOptionalType : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, theOptionalType< typeparam_T > >
      46                 :            : {
      47                 :          5 :     ::com::sun::star::uno::Type * operator()() const
      48                 :            :     {
      49                 :          5 :         ::rtl::OUStringBuffer the_buffer;
      50         [ +  - ]:          5 :         the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("com.sun.star.beans.Optional<"));
      51         [ +  - ]:          5 :         the_buffer.append(::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0)).getTypeName());
      52         [ +  - ]:          5 :         the_buffer.append(static_cast< ::sal_Unicode >('>'));
      53         [ +  - ]:          5 :         ::rtl::OUString the_name(the_buffer.makeStringAndClear());
      54         [ +  - ]:          5 :         ::rtl::OUString the_tname0(RTL_CONSTASCII_USTRINGPARAM("boolean"));
      55         [ +  - ]:          5 :         ::rtl::OUString the_name0(RTL_CONSTASCII_USTRINGPARAM("IsPresent"));
      56                 :          5 :         ::com::sun::star::uno::Type const & the_ptype0 = ::cppu::getTypeFavourChar(static_cast< typeparam_T * >(0));
      57                 :          5 :         ::typelib_TypeClass the_pclass0 = (::typelib_TypeClass) the_ptype0.getTypeClass();
      58                 :          5 :         ::rtl::OUString the_pname0(the_ptype0.getTypeName());
      59         [ +  - ]:          5 :         ::rtl::OUString the_name1(RTL_CONSTASCII_USTRINGPARAM("Value"));
      60                 :            :         ::typelib_StructMember_Init the_members[] = {
      61                 :            :             { { typelib_TypeClass_BOOLEAN, the_tname0.pData, the_name0.pData }, false },
      62                 :          5 :             { { the_pclass0, the_pname0.pData, the_name1.pData }, true } };
      63                 :          5 :         ::typelib_TypeDescription * the_newType = 0;
      64                 :          5 :         ::typelib_typedescription_newStruct(&the_newType, the_name.pData, 0, 2, the_members);
      65                 :          5 :         ::typelib_typedescription_register(&the_newType);
      66                 :          5 :         ::typelib_typedescription_release(the_newType);
      67                 :          5 :         return new ::com::sun::star::uno::Type(::com::sun::star::uno::TypeClass_STRUCT, the_name); // leaked
      68                 :            :     }
      69                 :            : };
      70                 :            :  } }
      71                 :            : 
      72                 :            : namespace cppu {
      73                 :            : 
      74                 :            : template< typename typeparam_T > class UnoType< ::com::sun::star::beans::Optional< typeparam_T > > {
      75                 :            : public:
      76                 :         45 :     static inline ::com::sun::star::uno::Type const & get() {
      77                 :         45 :         return *detail::theOptionalType< typeparam_T >::get();
      78                 :            :     }
      79                 :            : 
      80                 :            : private:
      81                 :            :     UnoType(UnoType &); // not defined
      82                 :            :     ~UnoType(); // not defined
      83                 :            :     void operator =(UnoType); // not defined
      84                 :            : };
      85                 :            : 
      86                 :            : }
      87                 :            : 
      88                 :          5 : template< typename typeparam_T > inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::com::sun::star::beans::Optional< typeparam_T > const *) SAL_THROW(()) {
      89                 :          5 :         return ::cppu::UnoType< ::com::sun::star::beans::Optional< typeparam_T > >::get();
      90                 :            :     }
      91                 :            : 
      92                 :            : #endif // INCLUDED_COM_SUN_STAR_BEANS_OPTIONAL_HPP

Generated by: LCOV version 1.10