LCOV - code coverage report
Current view: top level - libreoffice/bridges/source/cpp_uno/shared - types.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 32 35 91.4 %
Date: 2012-12-27 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             : #define INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX
      23             : 
      24             : #include "typelib/typeclass.h"
      25             : #include "typelib/typedescription.h"
      26             : 
      27             : namespace bridges { namespace cpp_uno { namespace shared {
      28             : 
      29        4927 : bool isSimpleType(typelib_TypeClass typeClass) {
      30             :     return typeClass <= typelib_TypeClass_DOUBLE
      31        4927 :         || typeClass == typelib_TypeClass_ENUM;
      32             : }
      33             : 
      34           0 : bool isSimpleType(typelib_TypeDescriptionReference const * type) {
      35           0 :     return isSimpleType(type->eTypeClass);
      36             : }
      37             : 
      38        4927 : bool isSimpleType(typelib_TypeDescription const * type) {
      39        4927 :     return isSimpleType(type->eTypeClass);
      40             : }
      41             : 
      42        2408 : bool relatesToInterfaceType(typelib_TypeDescription const * type) {
      43        2408 :     switch (type->eTypeClass) {
      44             :     case typelib_TypeClass_ANY:
      45             :     case typelib_TypeClass_INTERFACE:
      46        1916 :         return true;
      47             : 
      48             :     case typelib_TypeClass_STRUCT:
      49             :     case typelib_TypeClass_EXCEPTION:
      50             :         {
      51             :             typelib_CompoundTypeDescription const * p
      52             :                 = reinterpret_cast< typelib_CompoundTypeDescription const * >(
      53         104 :                     type);
      54         258 :             for (sal_Int32 i = 0; i < p->nMembers; ++i) {
      55         208 :                 switch (p->ppTypeRefs[i]->eTypeClass) {
      56             :                 case typelib_TypeClass_ANY:
      57             :                 case typelib_TypeClass_INTERFACE:
      58          36 :                     return true;
      59             : 
      60             :                 case typelib_TypeClass_STRUCT:
      61             :                 case typelib_TypeClass_EXCEPTION:
      62             :                 case typelib_TypeClass_SEQUENCE:
      63             :                     {
      64          22 :                         typelib_TypeDescription * t = 0;
      65          22 :                         TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
      66          22 :                         bool b = relatesToInterfaceType(t);
      67          22 :                         TYPELIB_DANGER_RELEASE(t);
      68          22 :                         if (b) {
      69          18 :                             return true;
      70             :                         }
      71             :                     }
      72           4 :                     break;
      73             : 
      74             :                 default:
      75         150 :                     break;
      76             :                 }
      77             :             }
      78          50 :             if (p->pBaseTypeDescription != 0) {
      79           0 :                 return relatesToInterfaceType(&p->pBaseTypeDescription->aBase);
      80             :             }
      81             :         }
      82          50 :         break;
      83             : 
      84             :     case typelib_TypeClass_SEQUENCE:
      85         242 :         switch (reinterpret_cast< typelib_IndirectTypeDescription const * >(
      86             :                     type)->pType->eTypeClass) {
      87             :         case typelib_TypeClass_ANY:
      88             :         case typelib_TypeClass_INTERFACE:
      89          28 :             return true;
      90             : 
      91             :         case typelib_TypeClass_STRUCT:
      92             :         case typelib_TypeClass_EXCEPTION:
      93             :         case typelib_TypeClass_SEQUENCE:
      94             :             {
      95          62 :                 typelib_TypeDescription * t = 0;
      96          62 :                 TYPELIB_DANGER_GET(
      97             :                     &t,
      98             :                     reinterpret_cast< typelib_IndirectTypeDescription const * >(
      99             :                         type)->pType);
     100          62 :                 bool b = relatesToInterfaceType(t);
     101          62 :                 TYPELIB_DANGER_RELEASE(t);
     102          62 :                 return b;
     103             :             }
     104             : 
     105             :         default:
     106         152 :             break;
     107             :         }
     108         152 :         break;
     109             : 
     110             :     default:
     111         146 :         break;
     112             :     }
     113         348 :     return false;
     114             : }
     115             : 
     116             : } } }
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10