diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-06 17:45:55 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-06 18:53:38 +0200 |
commit | 2046fcd907fe8c0217c5cd43be8420859a0ad435 (patch) | |
tree | 2a8f509656219b8741a370cd1bee0a47e9c7066b /writerfilter/source/ooxml | |
parent | 63cb2c865371cafaab763be656695e9cc75b8a15 (diff) |
unused writerfilter::ooxml::OOXMLFastTokenHandler
This makes libwriterfilterlo.so smaller by 500KB in a stripped dbgutil
build.
Change-Id: I0046251a0fe83ceee6f585f17707e4ecf53996b6
Diffstat (limited to 'writerfilter/source/ooxml')
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx | 113 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx | 60 | ||||
-rw-r--r-- | writerfilter/source/ooxml/gperffasttokenhandler.py | 54 |
3 files changed, 0 insertions, 227 deletions
diff --git a/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx b/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx deleted file mode 100644 index 12957165a85f..000000000000 --- a/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <iostream> -#include <string.h> -#include <ooxml/resourceids.hxx> -#include "OOXMLFastTokenHandler.hxx" - -#if defined __clang__ -#if __has_warning("-Wdeprecated-register") -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-register" -#endif -#endif -#include "ooxml/gperffasttoken.hxx" -#if defined __clang__ -#if __has_warning("-Wdeprecated-register") -#pragma GCC diagnostic pop -#endif -#endif - -namespace writerfilter { -namespace ooxml -{ - -using namespace ::std; - -OOXMLFastTokenHandler::OOXMLFastTokenHandler() -{ -} - -// ::com::sun::star::xml::sax::XFastTokenHandler: -::sal_Int32 SAL_CALL OOXMLFastTokenHandler::getToken(const OUString & Identifier) - throw (css::uno::RuntimeException, std::exception) -{ - ::sal_Int32 nResult = oox::XML_TOKEN_COUNT; - - struct tokenmap::token * pToken = - tokenmap::Perfect_Hash::in_word_set - (OUStringToOString(Identifier, RTL_TEXTENCODING_ASCII_US).getStr(), - Identifier.getLength()); - - if (pToken != NULL) - nResult = pToken->nToken; - -#ifdef DEBUG_TOKEN - clog << "getToken: " - << OUStringToOString(Identifier, RTL_TEXTENCODING_ASCII_US).getStr() - << ", " << nResult - << endl; -#endif - - return nResult; -} - -OUString SAL_CALL OOXMLFastTokenHandler::getIdentifier(::sal_Int32) - throw (css::uno::RuntimeException, std::exception) -{ - // we use a Boost tokenmap, but tokenmaps cannot be indexed by an integer - for (;;) { std::abort(); } // avoid "must return a value" warnings -} - -css::uno::Sequence< ::sal_Int8 > SAL_CALL OOXMLFastTokenHandler::getUTF8Identifier(::sal_Int32) - throw (css::uno::RuntimeException, std::exception) -{ - // we use a Boost tokenmap, but tokenmaps cannot be indexed by an integer - for (;;) { std::abort(); } // avoid "must return a value" warnings -} - -sal_Int32 OOXMLFastTokenHandler::getTokenDirect( const char *pStr, sal_Int32 nLength ) const -{ - struct tokenmap::token * pToken = - tokenmap::Perfect_Hash::in_word_set( pStr, nLength ); - - sal_Int32 nResult = pToken != NULL ? pToken->nToken : oox::XML_TOKEN_COUNT; - -#ifdef DEBUG_TOKEN - clog << "getTokenFromUTF8: " - << string(pStr, nLength) - << ", " << nResult - << (pToken == NULL ? ", failed" : "") << endl; -#endif - - return nResult; -} - -::sal_Int32 SAL_CALL OOXMLFastTokenHandler::getTokenFromUTF8 -(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException, std::exception) -{ - return getTokenDirect(reinterpret_cast<const char *> - (Identifier.getConstArray()), - Identifier.getLength()); -} - -}} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx b/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx deleted file mode 100644 index 9a79749b80cb..000000000000 --- a/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFASTTOKENHANDLER_HXX -#define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFASTTOKENHANDLER_HXX - -#include "sal/config.h" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "cppuhelper/implbase1.hxx" -#include "com/sun/star/xml/sax/XFastTokenHandler.hpp" -#include "sax/fastattribs.hxx" - -namespace writerfilter { -namespace ooxml -{ - -class OOXMLFastTokenHandler: - public ::cppu::WeakImplHelper1< - css::xml::sax::XFastTokenHandler>, - public sax_fastparser::FastTokenHandlerBase -{ -public: - explicit OOXMLFastTokenHandler(); - - // ::com::sun::star::xml::sax::XFastTokenHandler: - virtual ::sal_Int32 SAL_CALL getToken(const OUString & Identifier) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual OUString SAL_CALL getIdentifier(::sal_Int32 Token) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier(::sal_Int32 Token) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual ::sal_Int32 SAL_CALL getTokenFromUTF8(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - // Much faster direct C++ shortcut to the method that matters - virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const SAL_OVERRIDE; - -private: - OOXMLFastTokenHandler(OOXMLFastTokenHandler &); // not defined - void operator =(OOXMLFastTokenHandler &); // not defined - - virtual ~OOXMLFastTokenHandler() {} -}; - -}} -#endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFASTTOKENHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/ooxml/gperffasttokenhandler.py b/writerfilter/source/ooxml/gperffasttokenhandler.py deleted file mode 100644 index 4da3418f701e..000000000000 --- a/writerfilter/source/ooxml/gperffasttokenhandler.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -from __future__ import print_function -import xml.sax -import sys - - -class ContentHandler(xml.sax.handler.ContentHandler): - def __init__(self): - self.inFasttoken = False - self.chars = [] - - def startElement(self, name, attrs): - if name == "fasttoken": - self.inFasttoken = True - - def endElement(self, name): - if name == "fasttoken": - chars = "".join(self.chars) - token = chars.replace('-', '_') - print("%s, oox::XML_%s" % (token, token)) - self.chars = [] - self.inFasttoken = False - - def characters(self, characters): - if self.inFasttoken: - self.chars.append(characters) - -print(""" -%{ -#include "oox/token/tokens.hxx" - -namespace writerfilter { namespace ooxml { namespace tokenmap { -%} -struct token { const char * name; Token_t nToken; }; -%%""") - -parser = xml.sax.make_parser() -parser.setContentHandler(ContentHandler()) -parser.parse(sys.argv[1]) - -print("""FAST_TOKENS_END, oox::XML_TOKEN_COUNT -%% - -}}}""") - -# vim:set shiftwidth=4 softtabstop=4 expandtab: |