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 :
10 : #include <SvXMLAutoCorrectTokenHandler.hxx>
11 : #include <xmloff/xmltoken.hxx>
12 : #include <com/sun/star/xml/sax/FastToken.hpp>
13 : #if defined __clang__
14 : #if __has_warning("-Wdeprecated-register")
15 : #pragma GCC diagnostic push
16 : #pragma GCC diagnostic ignored "-Wdeprecated-register"
17 : #endif
18 : #endif
19 : #include <tokens.cxx>
20 : #if defined __clang__
21 : #if __has_warning("-Wdeprecated-register")
22 : #pragma GCC diagnostic pop
23 : #endif
24 : #endif
25 :
26 : using namespace ::css::uno;
27 : using namespace ::xmloff::token;
28 :
29 2 : SvXMLAutoCorrectTokenHandler::SvXMLAutoCorrectTokenHandler()
30 : {
31 2 : }
32 :
33 4 : SvXMLAutoCorrectTokenHandler::~SvXMLAutoCorrectTokenHandler()
34 : {
35 4 : }
36 :
37 0 : sal_Int32 SAL_CALL SvXMLAutoCorrectTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& Identifier )
38 : throw (::css::uno::RuntimeException, std::exception)
39 : {
40 0 : return getTokenDirect( reinterpret_cast< const char* >( Identifier.getConstArray() ), Identifier.getLength() );
41 : }
42 :
43 0 : Sequence< sal_Int8 > SAL_CALL SvXMLAutoCorrectTokenHandler::getUTF8Identifier( sal_Int32 )
44 : throw (::css::uno::RuntimeException, std::exception)
45 : {
46 0 : return Sequence< sal_Int8 >();
47 : }
48 :
49 1373 : sal_Int32 SvXMLAutoCorrectTokenHandler::getTokenDirect( const char *pTag, sal_Int32 nLength ) const
50 : {
51 1373 : if( !nLength )
52 0 : nLength = strlen( pTag );
53 1373 : const struct xmltoken* pToken = Perfect_Hash::in_word_set( pTag, nLength );
54 1373 : return pToken ? pToken->nToken : XML_TOKEN_INVALID;
55 : }
56 :
57 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|