LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLFastTokenHandler.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 21 0.0 %
Date: 2014-04-14 Functions: 0 8 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 <iostream>
      21             : #include <string.h>
      22             : #include <ooxml/resourceids.hxx>
      23             : #include "OOXMLFastTokenHandler.hxx"
      24             : 
      25             : #if defined __clang__
      26             : #if __has_warning("-Wdeprecated-register")
      27             : #pragma GCC diagnostic push
      28             : #pragma GCC diagnostic ignored "-Wdeprecated-register"
      29             : #endif
      30             : #endif
      31             : #include "gperffasttoken.hxx"
      32             : #if defined __clang__
      33             : #if __has_warning("-Wdeprecated-register")
      34             : #pragma GCC diagnostic pop
      35             : #endif
      36             : #endif
      37             : 
      38             : namespace writerfilter {
      39             : namespace ooxml
      40             : {
      41             : 
      42             : using namespace ::std;
      43             : 
      44           0 : OOXMLFastTokenHandler::OOXMLFastTokenHandler
      45             : (css::uno::Reference< css::uno::XComponentContext > const & context)
      46           0 : : m_xContext(context)
      47           0 : {}
      48             : 
      49             : // ::com::sun::star::xml::sax::XFastTokenHandler:
      50           0 : ::sal_Int32 SAL_CALL OOXMLFastTokenHandler::getToken(const OUString & Identifier)
      51             :     throw (css::uno::RuntimeException, std::exception)
      52             : {
      53           0 :     ::sal_Int32 nResult = OOXML_FAST_TOKENS_END;
      54             : 
      55             :     struct tokenmap::token * pToken =
      56             :         tokenmap::Perfect_Hash::in_word_set
      57             :         (OUStringToOString(Identifier, RTL_TEXTENCODING_ASCII_US).getStr(),
      58           0 :          Identifier.getLength());
      59             : 
      60           0 :     if (pToken != NULL)
      61           0 :         nResult = pToken->nToken;
      62             : 
      63             : #ifdef DEBUG_TOKEN
      64             :     clog << "getToken: "
      65             :          << OUStringToOString(Identifier, RTL_TEXTENCODING_ASCII_US).getStr()
      66             :          << ", " << nResult
      67             :          << endl;
      68             : #endif
      69             : 
      70           0 :     return nResult;
      71             : }
      72             : 
      73           0 : OUString SAL_CALL OOXMLFastTokenHandler::getIdentifier(::sal_Int32)
      74             :     throw (css::uno::RuntimeException, std::exception)
      75             : {
      76             :     // we use a Boost tokenmap, but tokenmaps cannot be indexed by an integer
      77           0 :     for (;;) { std::abort(); } // avoid "must return a value" warnings
      78             : }
      79             : 
      80           0 : css::uno::Sequence< ::sal_Int8 > SAL_CALL OOXMLFastTokenHandler::getUTF8Identifier(::sal_Int32)
      81             :     throw (css::uno::RuntimeException, std::exception)
      82             : {
      83             :     // we use a Boost tokenmap, but tokenmaps cannot be indexed by an integer
      84           0 :     for (;;) { std::abort(); } // avoid "must return a value" warnings
      85             : }
      86             : 
      87           0 : sal_Int32 OOXMLFastTokenHandler::getTokenDirect( const char *pStr, sal_Int32 nLength ) const
      88             : {
      89             :     struct tokenmap::token * pToken =
      90           0 :         tokenmap::Perfect_Hash::in_word_set( pStr, nLength );
      91             : 
      92           0 :     sal_Int32 nResult = pToken != NULL ? pToken->nToken : OOXML_FAST_TOKENS_END;
      93             : 
      94             : #ifdef DEBUG_TOKEN
      95             :     clog << "getTokenFromUTF8: "
      96             :          << string(pStr, nLength)
      97             :          << ", " << nResult
      98             :          << (pToken == NULL ? ", failed" : "") << endl;
      99             : #endif
     100             : 
     101           0 :     return nResult;
     102             : }
     103             : 
     104           0 : ::sal_Int32 SAL_CALL OOXMLFastTokenHandler::getTokenFromUTF8
     105             : (const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException, std::exception)
     106             : {
     107             :     return getTokenDirect(reinterpret_cast<const char *>
     108           0 :                           (Identifier.getConstArray()),
     109           0 :                           Identifier.getLength());
     110             : }
     111             : 
     112           0 : }}
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10