2016-08-12 10:26:28 +00:00
|
|
|
/* -*- 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/.
|
|
|
|
*/
|
|
|
|
|
2022-07-11 12:34:58 +04:30
|
|
|
#pragma once
|
2016-08-12 10:26:28 +00:00
|
|
|
|
|
|
|
#include <sax/fastattribs.hxx>
|
|
|
|
#include <xmloff/token/tokens.hxx>
|
2018-07-27 17:57:59 +02:00
|
|
|
#include <sal/log.hxx>
|
2016-08-12 10:26:28 +00:00
|
|
|
|
2020-07-10 15:19:30 +02:00
|
|
|
namespace xmloff::token {
|
2016-08-12 10:26:28 +00:00
|
|
|
|
2024-09-12 14:34:26 +05:00
|
|
|
namespace TokenMap
|
2016-08-12 10:26:28 +00:00
|
|
|
{
|
2024-09-12 14:34:26 +05:00
|
|
|
/** Returns the UTF-8 name of the passed token identifier as byte sequence. */
|
|
|
|
css::uno::Sequence<sal_Int8> const& getUtf8TokenName(sal_Int32 nToken);
|
2016-08-12 10:26:28 +00:00
|
|
|
|
2024-09-12 14:34:26 +05:00
|
|
|
/** Returns the token identifier for a UTF-8 string */
|
|
|
|
sal_Int32 getTokenFromUtf8(std::string_view token);
|
2016-08-12 10:26:28 +00:00
|
|
|
};
|
|
|
|
|
2020-03-11 14:19:34 +02:00
|
|
|
class FastTokenHandler final :
|
2016-08-12 10:26:28 +00:00
|
|
|
public sax_fastparser::FastTokenHandlerBase
|
|
|
|
{
|
|
|
|
public:
|
2024-09-12 14:34:26 +05:00
|
|
|
explicit FastTokenHandler() = default;
|
2016-08-12 10:26:28 +00:00
|
|
|
|
|
|
|
// XFastTokenHandler
|
2018-09-20 07:27:20 +02:00
|
|
|
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) override;
|
|
|
|
virtual sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
|
2016-08-12 10:26:28 +00:00
|
|
|
|
2024-09-12 14:34:26 +05:00
|
|
|
static const OUString& getIdentifier(sal_Int32 nToken);
|
2019-10-31 14:06:21 +02:00
|
|
|
|
2016-08-12 10:26:28 +00:00
|
|
|
// Much faster direct C++ shortcut to the method that matters
|
2024-09-12 14:34:26 +05:00
|
|
|
virtual sal_Int32 getTokenDirect(std::string_view token) const override;
|
2016-08-12 10:26:28 +00:00
|
|
|
};
|
|
|
|
|
2020-07-10 15:19:30 +02:00
|
|
|
} // namespace xmloff::token
|
2016-08-12 10:26:28 +00:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|