LCOV - code coverage report
Current view: top level - stoc/source/registry_tdprovider - structtypedescription.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 25 32 78.1 %
Date: 2012-08-25 Functions: 9 11 81.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 15 42 35.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include "structtypedescription.hxx"
      22                 :            : 
      23                 :            : #include "base.hxx"
      24                 :            : 
      25                 :            : #include "com/sun/star/reflection/XTypeDescription.hpp"
      26                 :            : #include "com/sun/star/uno/Reference.hxx"
      27                 :            : #include "com/sun/star/uno/RuntimeException.hpp"
      28                 :            : #include "com/sun/star/uno/Sequence.hxx"
      29                 :            : #include "com/sun/star/uno/TypeClass.hpp"
      30                 :            : #include "cppuhelper/weak.hxx"
      31                 :            : #include "osl/diagnose.h"
      32                 :            : #include "registry/reader.hxx"
      33                 :            : #include "registry/types.h"
      34                 :            : #include "registry/version.h"
      35                 :            : #include "rtl/ustring.h"
      36                 :            : #include "rtl/ustring.hxx"
      37                 :            : 
      38                 :            : #include <new>
      39                 :            : 
      40                 :            : namespace css = com::sun::star;
      41                 :            : using stoc::registry_tdprovider::StructTypeDescription;
      42                 :            : 
      43                 :       7741 : StructTypeDescription::StructTypeDescription(
      44                 :            :     css::uno::Reference< css::container::XHierarchicalNameAccess > const &
      45                 :            :         manager,
      46                 :            :     rtl::OUString const & name, rtl::OUString const & baseTypeName,
      47                 :            :     css::uno::Sequence< sal_Int8 > const & data, bool published):
      48                 :            :     m_data(data),
      49                 :            :     m_base(
      50                 :            :         new stoc_rdbtdp::CompoundTypeDescriptionImpl(
      51                 :            :             manager, css::uno::TypeClass_STRUCT, name, baseTypeName, data,
      52 [ +  - ][ +  - ]:       7741 :             published))
      53                 :       7741 : {}
      54                 :            : 
      55         [ +  - ]:       7465 : StructTypeDescription::~StructTypeDescription()
      56         [ -  + ]:      14930 : {}
      57                 :            : 
      58                 :      10916 : css::uno::TypeClass StructTypeDescription::getTypeClass()
      59                 :            :     throw (css::uno::RuntimeException)
      60                 :            : {
      61                 :      10916 :     return m_base->getTypeClass();
      62                 :            : }
      63                 :            : 
      64                 :      17147 : rtl::OUString StructTypeDescription::getName()
      65                 :            :     throw (css::uno::RuntimeException)
      66                 :            : {
      67                 :      17147 :     return m_base->getName();
      68                 :            : }
      69                 :            : 
      70                 :            : css::uno::Reference< css::reflection::XTypeDescription >
      71                 :       7184 : StructTypeDescription::getBaseType() throw (css::uno::RuntimeException)
      72                 :            : {
      73                 :       7184 :     return m_base->getBaseType();
      74                 :            : }
      75                 :            : 
      76                 :            : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
      77                 :       7605 : StructTypeDescription::getMemberTypes() throw (css::uno::RuntimeException)
      78                 :            : {
      79                 :       7605 :     return m_base->getMemberTypes();
      80                 :            : }
      81                 :            : 
      82                 :       7184 : css::uno::Sequence< rtl::OUString > StructTypeDescription::getMemberNames()
      83                 :            :     throw (css::uno::RuntimeException)
      84                 :            : {
      85                 :       7184 :     return m_base->getMemberNames();
      86                 :            : }
      87                 :            : 
      88                 :       7686 : css::uno::Sequence< rtl::OUString > StructTypeDescription::getTypeParameters()
      89                 :            :     throw (css::uno::RuntimeException)
      90                 :            : {
      91                 :            :     try {
      92                 :            :         typereg::Reader reader(
      93                 :       7686 :             m_data.getConstArray(), m_data.getLength(), false,
      94         [ +  - ]:       7686 :             TYPEREG_VERSION_1);
      95                 :            :         OSL_ASSERT(reader.isValid());
      96                 :       7686 :         sal_uInt16 n = reader.getReferenceCount();
      97         [ +  - ]:       7686 :         css::uno::Sequence< rtl::OUString > parameters(n);
      98         [ +  + ]:       8844 :         for (sal_uInt16 i = 0; i < n; ++i) {
      99   [ +  -  -  + ]:       2316 :             if (reader.getReferenceFlags(i) != RT_ACCESS_INVALID
                 [ -  + ]
     100                 :       1158 :                 || reader.getReferenceSort(i) != RT_REF_TYPE_PARAMETER)
     101                 :            :             {
     102                 :            :                 throw css::uno::RuntimeException(
     103                 :            :                     rtl::OUString(
     104                 :            :                         RTL_CONSTASCII_USTRINGPARAM(
     105                 :            :                             "type parameter of polymorphic struct type template"
     106                 :            :                             " not RT_ACCESS_INVALID/RT_REF_TYPE_PARAMETER")),
     107 [ #  # ][ #  # ]:          0 :                     static_cast< cppu::OWeakObject * >(this));
                 [ #  # ]
     108                 :            :             }
     109 [ +  - ][ +  - ]:       1158 :             parameters[i] = reader.getReferenceTypeName(i);
     110                 :            :         }
     111 [ +  - ][ +  - ]:       7686 :         return parameters;
     112         [ #  # ]:          0 :     } catch (std::bad_alloc &) {
     113                 :            :         throw css::uno::RuntimeException(
     114                 :            :             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("std::bad_alloc")),
     115   [ #  #  #  #  :          0 :             static_cast< cppu::OWeakObject * >(this));
                   #  # ]
     116                 :            :     }
     117                 :            : }
     118                 :            : 
     119                 :            : css::uno::Sequence< css::uno::Reference< css::reflection::XTypeDescription > >
     120                 :          0 : StructTypeDescription::getTypeArguments() throw (css::uno::RuntimeException)
     121                 :            : {
     122                 :            :     return css::uno::Sequence<
     123                 :          0 :         css::uno::Reference< css::reflection::XTypeDescription > >();
     124                 :            : }
     125                 :            : 
     126                 :          0 : sal_Bool StructTypeDescription::isPublished() throw (css::uno::RuntimeException)
     127                 :            : {
     128                 :          0 :     return m_base->isPublished();
     129                 :            : }
     130                 :            : 
     131                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10