LCOV - code coverage report
Current view: top level - stoc/source/registry_tdprovider - tdenum.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 40 44 90.9 %
Date: 2012-08-25 Functions: 7 7 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 33 66 50.0 %

           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                 :            : #include "base.hxx"
      21                 :            : 
      22                 :            : #include "registry/reader.hxx"
      23                 :            : #include "registry/version.h"
      24                 :            : 
      25                 :            : namespace stoc_rdbtdp
      26                 :            : {
      27                 :            : 
      28                 :            : //__________________________________________________________________________________________________
      29         [ +  - ]:       1585 : EnumTypeDescriptionImpl::~EnumTypeDescriptionImpl()
      30                 :            : {
      31 [ +  + ][ +  - ]:       1585 :     delete _pEnumNames;
      32 [ +  + ][ +  - ]:       1585 :     delete _pEnumValues;
      33         [ +  - ]:       1585 :     g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
      34         [ -  + ]:       3170 : }
      35                 :            : 
      36                 :            : // XTypeDescription
      37                 :            : //__________________________________________________________________________________________________
      38                 :       3232 : TypeClass EnumTypeDescriptionImpl::getTypeClass()
      39                 :            :     throw(::com::sun::star::uno::RuntimeException)
      40                 :            : {
      41                 :       3232 :     return TypeClass_ENUM;
      42                 :            : }
      43                 :            : //__________________________________________________________________________________________________
      44                 :       3431 : OUString EnumTypeDescriptionImpl::getName()
      45                 :            :     throw(::com::sun::star::uno::RuntimeException)
      46                 :            : {
      47                 :       3431 :     return _aName;
      48                 :            : }
      49                 :            : 
      50                 :            : // XEnumTypeDescription
      51                 :            : //__________________________________________________________________________________________________
      52                 :       1616 : sal_Int32 EnumTypeDescriptionImpl::getDefaultEnumValue()
      53                 :            :     throw(::com::sun::star::uno::RuntimeException)
      54                 :            : {
      55                 :       1616 :     return _nDefaultValue;
      56                 :            : }
      57                 :            : //__________________________________________________________________________________________________
      58                 :       1616 : Sequence< OUString > EnumTypeDescriptionImpl::getEnumNames()
      59                 :            :     throw(::com::sun::star::uno::RuntimeException)
      60                 :            : {
      61         [ +  + ]:       1616 :     if (! _pEnumNames)
      62                 :            :     {
      63                 :            :         typereg::Reader aReader(
      64                 :       1603 :             _aBytes.getConstArray(), _aBytes.getLength(), false,
      65         [ +  - ]:       1603 :             TYPEREG_VERSION_1);
      66                 :            : 
      67                 :       1603 :         sal_uInt16 nFields = aReader.getFieldCount();
      68         [ +  - ]:       1603 :         Sequence< OUString > * pTempEnumNames = new Sequence< OUString >( nFields );
      69         [ +  - ]:       1603 :         OUString * pEnumNames = pTempEnumNames->getArray();
      70                 :            : 
      71         [ +  + ]:      16666 :         while (nFields--)
      72                 :            :         {
      73         [ +  - ]:      15063 :             pEnumNames[nFields] = aReader.getFieldName( nFields );
      74                 :            :         }
      75                 :            : 
      76 [ +  - ][ +  - ]:       1603 :         ClearableMutexGuard aGuard( getMutex() );
      77         [ -  + ]:       1603 :         if (_pEnumNames)
      78                 :            :         {
      79         [ #  # ]:          0 :             aGuard.clear();
      80 [ #  # ][ #  # ]:          0 :             delete pTempEnumNames;
      81                 :            :         }
      82                 :            :         else
      83                 :            :         {
      84                 :       1603 :             _pEnumNames = pTempEnumNames;
      85         [ +  - ]:       1603 :         }
      86                 :            :     }
      87                 :       1616 :     return *_pEnumNames;
      88                 :            : }
      89                 :            : //__________________________________________________________________________________________________
      90                 :       1616 : Sequence< sal_Int32 > EnumTypeDescriptionImpl::getEnumValues()
      91                 :            :     throw(::com::sun::star::uno::RuntimeException)
      92                 :            : {
      93         [ +  + ]:       1616 :     if (! _pEnumValues)
      94                 :            :     {
      95                 :            :         typereg::Reader aReader(
      96                 :       1603 :             _aBytes.getConstArray(), _aBytes.getLength(), false,
      97         [ +  - ]:       1603 :             TYPEREG_VERSION_1);
      98                 :            : 
      99                 :       1603 :         sal_uInt16 nFields = aReader.getFieldCount();
     100         [ +  - ]:       1603 :         Sequence< sal_Int32 > * pTempEnumValues = new Sequence< sal_Int32 >( nFields );
     101         [ +  - ]:       1603 :         sal_Int32 * pEnumValues = pTempEnumValues->getArray();
     102                 :            : 
     103         [ +  + ]:      16666 :         while (nFields--)
     104                 :            :         {
     105                 :      15063 :             pEnumValues[nFields] = getRTValueAsInt32(
     106         [ +  - ]:      15063 :                 aReader.getFieldValue( nFields ) );
     107                 :            :         }
     108                 :            : 
     109 [ +  - ][ +  - ]:       1603 :         ClearableMutexGuard aGuard( getMutex() );
     110         [ -  + ]:       1603 :         if (_pEnumValues)
     111                 :            :         {
     112         [ #  # ]:          0 :             aGuard.clear();
     113 [ #  # ][ #  # ]:          0 :             delete pTempEnumValues;
     114                 :            :         }
     115                 :            :         else
     116                 :            :         {
     117                 :       1603 :             _pEnumValues = pTempEnumValues;
     118         [ +  - ]:       1603 :         }
     119                 :            :     }
     120                 :       1616 :     return *_pEnumValues;
     121                 :            : }
     122                 :            : 
     123                 :            : }
     124                 :            : 
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10