Resolves tdf#133662 - Copy version info reworked
[LibreOffice.git] / include / i18nutil / casefolding.hxx
blob65dfc2d515d2a83286cf4fc2a41dab889ece51b7
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 CasedLetterMask = LowerToUpper | UpperToLower | ToUpper | ToLower | ToTitle | SimpleFolding | FullFolding, // for final sigmar
41 NotValue = 0x80, // Value field is an address
43 namespace o3tl {
44 template<> struct typed_flags<MappingType> : is_typed_flags<MappingType, 0xff> {};
47 namespace i18nutil {
49 struct Value
51 sal_uInt8 type;
52 sal_uInt16 value; // value or address, depend on the type
55 struct Mapping
57 sal_uInt8 type;
58 sal_Int8 nmap;
59 #define NMAPPINGMAX 3
60 sal_Unicode map[NMAPPINGMAX];
61 }; // for Unconditional mapping
63 struct MappingElement
65 MappingElement()
66 : current(0)
68 element.type = element.nmap = 0;
70 Mapping element;
71 sal_Int8 current;
74 class UNLESS_MERGELIBS(I18NUTIL_DLLPUBLIC) casefolding
76 public:
77 /// @throws css::uno::RuntimeException
78 static Mapping getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
79 /// @throws css::uno::RuntimeException
80 static const Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
81 /// @throws css::uno::RuntimeException
82 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);
88 #endif
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */