LCOV - code coverage report
Current view: top level - xmloff/source/transform - TransformerActions.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 Functions: 0 14 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             : #ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERACTIONS_HXX
      21             : #define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERACTIONS_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <xmloff/nmspmap.hxx>
      25             : 
      26             : #include <boost/unordered_map.hpp>
      27             : #include "TransformerActionInit.hxx"
      28             : #include "TransformerAction.hxx"
      29             : 
      30           0 : struct NameKey_Impl
      31             : {
      32             :     sal_uInt16 m_nPrefix;
      33             :     OUString m_aLocalName;
      34             : 
      35             :     inline NameKey_Impl( sal_uInt16 nPrfx,
      36             :                          ::xmloff::token::XMLTokenEnum eLclNm ) :
      37             :         m_nPrefix( nPrfx ),
      38             :         m_aLocalName( ::xmloff::token::GetXMLToken( eLclNm ) )
      39             :     {
      40             :     }
      41             : 
      42           0 :     inline NameKey_Impl( sal_uInt16 nPrfx, const OUString& rLclNm ) :
      43             :         m_nPrefix( nPrfx ),
      44           0 :         m_aLocalName( rLclNm )
      45             :     {
      46           0 :     }
      47             : 
      48           0 :     inline NameKey_Impl() :
      49           0 :         m_nPrefix( XML_NAMESPACE_UNKNOWN )
      50             :     {
      51           0 :     }
      52             : 
      53           0 :     inline void SetLocalName( ::xmloff::token::XMLTokenEnum eLclNm )
      54             :     {
      55           0 :         m_aLocalName = ::xmloff::token::GetXMLToken( eLclNm );
      56           0 :     }
      57             : };
      58             : 
      59             : struct NameHash_Impl
      60             : {
      61             :     inline size_t operator()( const NameKey_Impl& r ) const;
      62             :     inline bool operator()( const NameKey_Impl& r1,
      63             :                                const NameKey_Impl& r2 ) const;
      64             : };
      65             : 
      66           0 : inline size_t NameHash_Impl::operator()( const NameKey_Impl& r ) const
      67             : {
      68           0 :     return static_cast< size_t >( r.m_nPrefix ) +
      69           0 :            static_cast< size_t >( r.m_aLocalName.hashCode() );
      70             : }
      71             : 
      72           0 : inline bool NameHash_Impl::operator()(
      73             :         const NameKey_Impl& r1,
      74             :         const NameKey_Impl& r2 ) const
      75             : {
      76           0 :     return r1.m_nPrefix == r2.m_nPrefix && r1.m_aLocalName == r2.m_aLocalName;
      77             : }
      78             : 
      79             : struct TransformerAction_Impl
      80             : {
      81             :     sal_uInt32 m_nActionType;
      82             :     sal_uInt32 m_nParam1;
      83             :     sal_uInt32 m_nParam2;
      84             :     sal_uInt32 m_nParam3;
      85             : 
      86             :     inline TransformerAction_Impl( sal_uInt32 nActnTp, sal_uInt32 nPrm1,
      87             :                                    sal_uInt32 nPrm2, sal_uInt32 nPrm3 ) :
      88             :         m_nActionType( nActnTp ),
      89             :         m_nParam1( nPrm1 ),
      90             :         m_nParam2( nPrm2 ),
      91             :         m_nParam3( nPrm3 )
      92             :     {
      93             : 
      94             :     }
      95           0 :     inline TransformerAction_Impl() :
      96             :         m_nActionType( XML_TACTION_EOT ),
      97             :         m_nParam1( 0 ),
      98             :         m_nParam2( 0 ),
      99           0 :         m_nParam3( 0 )
     100             :     {
     101           0 :     }
     102             : 
     103           0 :     sal_uInt16 GetQNamePrefixFromParam1() const
     104             :     {
     105           0 :         return static_cast< sal_uInt16 >( m_nParam1 >> 16 );
     106             :     }
     107             : 
     108           0 :     sal_uInt16 GetQNamePrefixFromParam2() const
     109             :     {
     110           0 :         return static_cast< sal_uInt16 >( m_nParam2 >> 16 );
     111             :     }
     112             : 
     113           0 :     sal_uInt16 GetQNamePrefixFromParam3() const
     114             :     {
     115           0 :         return static_cast< sal_uInt16 >( m_nParam3 >> 16 );
     116             :     }
     117             : 
     118           0 :     ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam1() const
     119             :     {
     120           0 :         return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam1 & 0xffff );
     121             :     }
     122             : 
     123           0 :     ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam2() const
     124             :     {
     125           0 :         return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam2 & 0xffff );
     126             :     }
     127             : 
     128           0 :     ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam3() const
     129             :     {
     130           0 :         return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam3 & 0xffff );
     131             :     }
     132             : 
     133             : };
     134             : 
     135             : class XMLTransformerActions :
     136             :     public ::boost::unordered_map< NameKey_Impl, TransformerAction_Impl,
     137             :                             NameHash_Impl, NameHash_Impl >
     138             : {
     139             : public:
     140             :     XMLTransformerActions( XMLTransformerActionInit *pInit );
     141             :     ~XMLTransformerActions();
     142             : 
     143             :     void Add( XMLTransformerActionInit *pInit );
     144             : };
     145             : 
     146             : #endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERACTIONS_HXX
     147             : 
     148             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10