LibreOffice Module i18nutil (master)  1
casefolding.hxx
Go to the documentation of this file.
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  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX
20 #define INCLUDED_I18NUTIL_CASEFOLDING_HXX
21 
22 #include <sal/types.h>
24 #include <o3tl/typed_flags_set.hxx>
25 #include <config_options.h>
26 
27 namespace com::sun::star::lang { struct Locale; }
28 
29 enum class TransliterationFlags;
30 
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)
42  NotValue = 0x80, // Value field is an address
43 };
44 namespace o3tl {
45  template<> struct typed_flags<MappingType> : is_typed_flags<MappingType, 0xff> {};
46 }
47 
48 namespace i18nutil {
49 
50 struct Value
51 {
53  sal_uInt16 value; // value or address, depend on the type
54 };
55 
56 struct Mapping
57 {
60 #define NMAPPINGMAX 3
62 }; // for Unconditional mapping
63 
65 {
67  : current(0)
68  {
69  element.type = element.nmap = 0;
70  }
73 };
74 
75 class UNLESS_MERGELIBS(I18NUTIL_DLLPUBLIC) casefolding
76 {
77 public:
79  static Mapping getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
81  static const Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType);
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);
84 
85 };
86 
87 }
88 
89 #endif
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
signed char sal_Int8
sal_uInt8 type
Definition: casefolding.hxx:52
MappingType
Definition: casefolding.hxx:31
sal_uInt16 sal_Unicode
#define NMAPPINGMAX
Definition: casefolding.hxx:60
size_t pos
sal_Unicode map[NMAPPINGMAX]
Definition: casefolding.hxx:61
TransliterationFlags
This is a superset type of the com::sun::star::i18n::TransliterationModules and TransliterationModule...
css::beans::Optional< css::uno::Any > getValue(std::u16string_view id)
const sal_uInt16 idx[]
unsigned char sal_uInt8
sal_uInt16 value
Definition: casefolding.hxx:53