1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX
20 #define INCLUDED_I18NUTIL_CASEFOLDING_HXX
22 #include <sal/types.h>
23 #include <com/sun/star/lang/Locale.hpp>
24 #include <com/sun/star/uno/RuntimeException.hpp>
25 #include <i18nutil/i18nutildllapi.h>
26 #include <o3tl/typed_flags_set.hxx>
28 enum class TransliterationFlags
;
30 enum class MappingType
{
32 LowerToUpper
= 0x01, // Upper to Lower mapping
33 UpperToLower
= 0x02, // Lower to Upper mapping
34 ToUpper
= 0x04, // to Upper mapping
35 ToLower
= 0x08, // to Lower mapping
36 ToTitle
= 0x10, // to Title mapping
37 SimpleFolding
= 0x20, // Simple Case Folding
38 FullFolding
= 0x40, // Full Case Folding
39 CasedLetterMask
= LowerToUpper
| UpperToLower
| ToUpper
| ToLower
| ToTitle
| SimpleFolding
| FullFolding
, // for final sigmar
40 NotValue
= 0x80, // Value field is an address
43 template<> struct typed_flags
<MappingType
> : is_typed_flags
<MappingType
, 0xff> {};
46 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
51 sal_uInt16 value
; // value or address, depend on the type
59 sal_Unicode map
[NMAPPINGMAX
];
60 }; // for Unconditional mapping
67 element
.type
= element
.nmap
= 0;
73 class I18NUTIL_DLLPUBLIC casefolding
76 /// @throws css::uno::RuntimeException
77 static Mapping
& getValue(const sal_Unicode
* str
, sal_Int32 pos
, sal_Int32 len
, css::lang::Locale
& aLocale
, MappingType nMappingType
);
78 /// @throws css::uno::RuntimeException
79 static Mapping
& getConditionalValue(const sal_Unicode
* str
, sal_Int32 pos
, sal_Int32 len
, css::lang::Locale
& aLocale
, MappingType nMappingType
);
80 /// @throws css::uno::RuntimeException
81 static sal_Unicode
getNextChar(const sal_Unicode
*str
, sal_Int32
& idx
, sal_Int32 len
, MappingElement
& e
, css::lang::Locale
& aLocale
, MappingType nMappingtype
, TransliterationFlags moduleLoaded
);
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */