LCOV - code coverage report
Current view: top level - comphelper/source/property - ChainablePropertySetInfo.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 37 0.0 %
Date: 2014-04-14 Functions: 0 7 0.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             : #include <comphelper/ChainablePropertySetInfo.hxx>
      21             : 
      22             : using ::comphelper::PropertyInfo;
      23             : using ::comphelper::ChainablePropertySetInfo;
      24             : using ::com::sun::star::uno::Any;
      25             : using ::com::sun::star::uno::Type;
      26             : using ::com::sun::star::uno::Sequence;
      27             : using ::com::sun::star::uno::Reference;
      28             : using ::com::sun::star::uno::XInterface;
      29             : using ::com::sun::star::uno::RuntimeException;
      30             : using ::com::sun::star::beans::Property;
      31             : using ::com::sun::star::beans::XPropertySetInfo;
      32             : using ::com::sun::star::beans::UnknownPropertyException;
      33             : 
      34           0 : ChainablePropertySetInfo::ChainablePropertySetInfo( PropertyInfo const * pMap )
      35             : {
      36           0 :     for( ; !pMap->maName.isEmpty(); ++pMap )
      37             :     {
      38             :         SAL_WARN_IF(
      39             :             maMap.find(pMap->maName) != maMap.end(),
      40             :             "comphelper", "Duplicate property name \"" << pMap->maName << "\"");
      41           0 :         maMap[pMap->maName] = pMap;
      42             :     }
      43           0 : }
      44             : 
      45           0 : ChainablePropertySetInfo::~ChainablePropertySetInfo()
      46           0 :     throw()
      47             : {
      48           0 : }
      49             : 
      50           0 : void ChainablePropertySetInfo::remove( const OUString& aName )
      51             : {
      52           0 :     maMap.erase ( aName );
      53           0 :     if ( maProperties.getLength() )
      54           0 :          maProperties.realloc( 0 );
      55           0 : }
      56             : 
      57           0 : Sequence< ::Property > SAL_CALL ChainablePropertySetInfo::getProperties()
      58             :     throw(::com::sun::star::uno::RuntimeException, std::exception)
      59             : {
      60           0 :     sal_Int32 nSize = maMap.size();
      61           0 :     if( maProperties.getLength() != nSize )
      62             :     {
      63           0 :         maProperties.realloc ( nSize );
      64           0 :         Property* pProperties = maProperties.getArray();
      65             : 
      66           0 :         for (PropertyInfoHash::const_iterator aIter(maMap.begin()), aEnd(maMap.end()); aIter != aEnd; ++aIter, ++pProperties)
      67             :         {
      68           0 :             PropertyInfo const * pInfo = (*aIter).second;
      69             : 
      70           0 :             pProperties->Name = pInfo->maName;
      71           0 :             pProperties->Handle = pInfo->mnHandle;
      72           0 :             pProperties->Type = pInfo->maType;
      73           0 :             pProperties->Attributes = pInfo->mnAttributes;
      74             :         }
      75             :     }
      76           0 :     return maProperties;
      77             : }
      78             : 
      79           0 : Property SAL_CALL ChainablePropertySetInfo::getPropertyByName( const OUString& rName )
      80             :     throw(::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception)
      81             : {
      82           0 :     PropertyInfoHash::iterator aIter = maMap.find( rName );
      83             : 
      84           0 :     if ( maMap.end() == aIter )
      85           0 :         throw UnknownPropertyException( rName, *this );
      86             : 
      87           0 :     PropertyInfo const *pInfo = (*aIter).second;
      88           0 :     Property aProperty;
      89           0 :     aProperty.Name   = pInfo->maName;
      90           0 :     aProperty.Handle = pInfo->mnHandle;
      91           0 :     aProperty.Type = pInfo->maType;
      92           0 :     aProperty.Attributes = pInfo->mnAttributes;
      93           0 :     return aProperty;
      94             : }
      95             : 
      96           0 : sal_Bool SAL_CALL ChainablePropertySetInfo::hasPropertyByName( const OUString& rName )
      97             :     throw(::com::sun::star::uno::RuntimeException, std::exception)
      98             : {
      99           0 :     return maMap.find ( rName ) != maMap.end();
     100             : }
     101             : 
     102             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10