LCOV - code coverage report
Current view: top level - bridges/source/cpp_uno/shared - types.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 34 36 94.4 %
Date: 2014-04-11 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          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 "bridges/cpp_uno/shared/types.hxx"
      22             : 
      23             : #include "typelib/typeclass.h"
      24             : #include "typelib/typedescription.h"
      25             : 
      26             : namespace bridges { namespace cpp_uno { namespace shared {
      27             : 
      28      423685 : bool isSimpleType(typelib_TypeClass typeClass) {
      29      423685 :     return typeClass <= typelib_TypeClass_DOUBLE
      30      423685 :         || typeClass == typelib_TypeClass_ENUM;
      31             : }
      32             : 
      33           0 : bool isSimpleType(typelib_TypeDescriptionReference const * type) {
      34           0 :     return isSimpleType(type->eTypeClass);
      35             : }
      36             : 
      37      423685 : bool isSimpleType(typelib_TypeDescription const * type) {
      38      423685 :     return isSimpleType(type->eTypeClass);
      39             : }
      40             : 
      41      289373 : bool relatesToInterfaceType(typelib_TypeDescription const * type) {
      42      289373 :     switch (type->eTypeClass) {
      43             :     case typelib_TypeClass_ANY:
      44             :     case typelib_TypeClass_INTERFACE:
      45      148206 :         return true;
      46             : 
      47             :     case typelib_TypeClass_STRUCT:
      48             :     case typelib_TypeClass_EXCEPTION:
      49             :         {
      50             :             typelib_CompoundTypeDescription const * p
      51             :                 = reinterpret_cast< typelib_CompoundTypeDescription const * >(
      52       25770 :                     type);
      53       86833 :             for (sal_Int32 i = 0; i < p->nMembers; ++i) {
      54       66672 :                 switch (p->ppTypeRefs[i]->eTypeClass) {
      55             :                 case typelib_TypeClass_ANY:
      56             :                 case typelib_TypeClass_INTERFACE:
      57        5528 :                     return true;
      58             : 
      59             :                 case typelib_TypeClass_STRUCT:
      60             :                 case typelib_TypeClass_EXCEPTION:
      61             :                 case typelib_TypeClass_SEQUENCE:
      62             :                     {
      63         110 :                         typelib_TypeDescription * t = 0;
      64         110 :                         TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
      65         110 :                         bool b = relatesToInterfaceType(t);
      66         110 :                         TYPELIB_DANGER_RELEASE(t);
      67         110 :                         if (b) {
      68          81 :                             return true;
      69             :                         }
      70             :                     }
      71          29 :                     break;
      72             : 
      73             :                 default:
      74       61034 :                     break;
      75             :                 }
      76             :             }
      77       20161 :             if (p->pBaseTypeDescription != 0) {
      78         912 :                 return relatesToInterfaceType(&p->pBaseTypeDescription->aBase);
      79             :             }
      80             :         }
      81       19249 :         break;
      82             : 
      83             :     case typelib_TypeClass_SEQUENCE:
      84       14938 :         switch (reinterpret_cast< typelib_IndirectTypeDescription const * >(
      85             :                     type)->pType->eTypeClass) {
      86             :         case typelib_TypeClass_ANY:
      87             :         case typelib_TypeClass_INTERFACE:
      88        5436 :             return true;
      89             : 
      90             :         case typelib_TypeClass_STRUCT:
      91             :         case typelib_TypeClass_EXCEPTION:
      92             :         case typelib_TypeClass_SEQUENCE:
      93             :             {
      94        3654 :                 typelib_TypeDescription * t = 0;
      95             :                 TYPELIB_DANGER_GET(
      96             :                     &t,
      97             :                     reinterpret_cast< typelib_IndirectTypeDescription const * >(
      98        3654 :                         type)->pType);
      99        3654 :                 bool b = relatesToInterfaceType(t);
     100        3654 :                 TYPELIB_DANGER_RELEASE(t);
     101        3654 :                 return b;
     102             :             }
     103             : 
     104             :         default:
     105        5848 :             break;
     106             :         }
     107        5848 :         break;
     108             : 
     109             :     default:
     110      100459 :         break;
     111             :     }
     112      125556 :     return false;
     113             : }
     114             : 
     115             : } } }
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10