tdf#151073 - enable firebird for appstore build w/o experimental mode
[LibreOffice.git] / include / i18nutil / casefolding.hxx
blobb15a51ae8d04abc2d62ac9a2241117a5dec505b6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <i18nutil/i18nutildllapi.h>
24 #include <o3tl/typed_flags_set.hxx>
25 #include <config_options.h>
27 namespace com::sun::star::lang { struct Locale; }
29 enum class TransliterationFlags;
31 enum class MappingType {
32 NONE = 0x00,
33 LowerToUpper = 0x01, // Upper to Lower mapping
34 UpperToLower = 0x02, // Lower to Upper mapping
35 ToUpper = 0x04, // to Upper mapping
36 ToLower = 0x08, // to Lower mapping
37 ToTitle = 0x10, // to Title mapping
38 SimpleFolding = 0x20, // Simple Case Folding
39 FullFolding = 0x40, // Full Case Folding
40 // for final sigma (where the case-mapping is different for the last letter of a word)
41 CasedLetterMask = LowerToUpper | UpperToLower | ToUpper | ToLower | ToTitle | SimpleFolding | FullFolding,
42 NotValue = 0x80, // Value field is an address
44 namespace o3tl {
45 template<> struct typed_flags<MappingType> : is_typed_flags<MappingType, 0xff> {};
48 namespace i18nutil {
50 struct Value
52 sal_uInt8 type;
53 sal_uInt16 value; // value or address, depend on the type
56 struct Mapping
58 sal_uInt8 type;
59 sal_Int8 nmap;
60 #define NMAPPINGMAX 3
61 sal_Unicode map[NMAPPINGMAX];
62 }; // for Unconditional mapping
64 struct MappingElement
66 MappingElement()
67 : current(0)
69 element.type = element.nmap = 0;
71 Mapping element;
72 sal_Int8 current;
75 class UNLESS_MERGELIBS(I18NUTIL_DLLPUBLIC) casefolding
77 public:
78 /// @throws css::uno::RuntimeException
79 static Mapping getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
80 /// @throws css::uno::RuntimeException
81 static const Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
82 /// @throws css::uno::RuntimeException
83 static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale const & aLocale, MappingType nMappingtype, TransliterationFlags moduleLoaded);
89 #endif
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */