LCOV - code coverage report
Current view: top level - sdext/source/pdfimport/sax - saxattrlist.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 Functions: 0 12 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             : 
      21             : #include "saxattrlist.hxx"
      22             : 
      23             : namespace pdfi
      24             : {
      25             : 
      26           0 : SaxAttrList::SaxAttrList( const boost::unordered_map< OUString, OUString, OUStringHash >& rMap )
      27             : {
      28           0 :     m_aAttributes.reserve(rMap.size());
      29           0 :     for( boost::unordered_map< OUString,
      30             :                         OUString,
      31           0 :                         OUStringHash >::const_iterator it = rMap.begin();
      32           0 :          it != rMap.end(); ++it )
      33             :     {
      34           0 :         m_aIndexMap[ it->first ] = m_aAttributes.size();
      35           0 :         m_aAttributes.push_back( AttrEntry( it->first, it->second ) );
      36             :     }
      37           0 : }
      38             : 
      39           0 : SaxAttrList::SaxAttrList( const SaxAttrList& rClone ) :
      40             :     cppu::WeakImplHelper2<com::sun::star::xml::sax::XAttributeList, com::sun::star::util::XCloneable>(rClone),
      41             :     m_aAttributes( rClone.m_aAttributes ),
      42           0 :     m_aIndexMap( rClone.m_aIndexMap )
      43             : {
      44           0 : }
      45             : 
      46           0 : SaxAttrList::~SaxAttrList()
      47             : {
      48           0 : }
      49             : 
      50             : namespace {
      51           0 :     static const OUString& getCDATAString()
      52             :     {
      53           0 :         static OUString aStr( "CDATA" );
      54           0 :         return aStr;
      55             :     }
      56             : }
      57             : 
      58           0 : sal_Int16 SAL_CALL SaxAttrList::getLength() throw(std::exception)
      59             : {
      60           0 :     return sal_Int16(m_aAttributes.size());
      61             : }
      62           0 : OUString SAL_CALL SaxAttrList::getNameByIndex( sal_Int16 i_nIndex ) throw(std::exception)
      63             : {
      64           0 :     return (i_nIndex < sal_Int16(m_aAttributes.size())) ? m_aAttributes[i_nIndex].m_aName : OUString();
      65             : }
      66             : 
      67           0 : OUString SAL_CALL SaxAttrList::getTypeByIndex( sal_Int16 i_nIndex) throw(std::exception)
      68             : {
      69           0 :     return (i_nIndex < sal_Int16(m_aAttributes.size())) ? getCDATAString() : OUString();
      70             : }
      71             : 
      72           0 : OUString SAL_CALL SaxAttrList::getTypeByName( const OUString& i_rName ) throw(std::exception)
      73             : {
      74           0 :     return (m_aIndexMap.find( i_rName ) != m_aIndexMap.end()) ? getCDATAString() : OUString();
      75             : }
      76             : 
      77           0 : OUString SAL_CALL SaxAttrList::getValueByIndex( sal_Int16 i_nIndex ) throw(std::exception)
      78             : {
      79           0 :     return (i_nIndex < sal_Int16(m_aAttributes.size())) ? m_aAttributes[i_nIndex].m_aValue : OUString();
      80             : }
      81             : 
      82           0 : OUString SAL_CALL SaxAttrList::getValueByName(const OUString& i_rName) throw(std::exception)
      83             : {
      84           0 :     boost::unordered_map< OUString, size_t, OUStringHash >::const_iterator it = m_aIndexMap.find( i_rName );
      85           0 :     return (it != m_aIndexMap.end()) ? m_aAttributes[it->second].m_aValue : OUString();
      86             : }
      87             : 
      88           0 : com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL SaxAttrList::createClone() throw(std::exception)
      89             : {
      90           0 :     return new SaxAttrList( *this );
      91             : }
      92             : 
      93             : }
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10