LibreOffice Module i18npool (master)  1
indexentrysupplier_default.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_I18NPOOL_INC_INDEXENTRYSUPPLIER_DEFAULT_HXX
20 #define INCLUDED_I18NPOOL_INC_INDEXENTRYSUPPLIER_DEFAULT_HXX
21 
23 
24 #include <memory>
25 #include <string_view>
26 
27 namespace i18npool {
28 
29 class Index;
30 
31 
32 
34 public:
35  IndexEntrySupplier_Unicode( const css::uno::Reference < css::uno::XComponentContext >& rxContext );
36  virtual ~IndexEntrySupplier_Unicode() override;
37 
38  virtual sal_Bool SAL_CALL loadAlgorithm(
39  const css::lang::Locale& rLocale,
40  const OUString& SortAlgorithm, sal_Int32 collatorOptions ) override;
41 
42  virtual OUString SAL_CALL getIndexKey( const OUString& IndexEntry,
43  const OUString& PhoneticEntry, const css::lang::Locale& rLocale ) override;
44 
45  virtual sal_Int16 SAL_CALL compareIndexEntry( const OUString& IndexEntry1,
46  const OUString& PhoneticEntry1, const css::lang::Locale& rLocale1,
47  const OUString& IndexEntry2, const OUString& PhoneticEntry2,
48  const css::lang::Locale& rLocale2 ) override;
49 
50  virtual OUString SAL_CALL getIndexCharacter( const OUString& rIndexEntry,
51  const css::lang::Locale& rLocale, const OUString& rSortAlgorithm ) override;
52 
53 private:
54  std::unique_ptr<Index> index;
55 };
56 
57 struct IndexKey {
59  OUString mkey;
60  OUString desc;
61 };
62 
64 {
65 public:
66  IndexTable();
67  ~IndexTable();
68 
69  void init(sal_Unicode start_, sal_Unicode end_, IndexKey const * keys, sal_Int16 key_count, Index *index);
70 
74 };
75 
76 #define MAX_KEYS 0xff
77 #define MAX_TABLES 20
78 
79 class Index
80 {
81 public:
82  Index(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
83  ~Index();
84 
86  void init(const css::lang::Locale& rLocale, const OUString& algorithm);
87 
89  void makeIndexKeys(const css::lang::Locale &rLocale, std::u16string_view algorithm);
90  sal_Int16 getIndexWeight(const OUString& rIndexEntry);
91  OUString getIndexDescription(const OUString& rIndexEntry);
92 
94  sal_Int16 table_count;
96  sal_Int16 key_count;
97  sal_Int16 mkeys[MAX_KEYS];
98  sal_Int16 mkey_count;
99  OUString skipping_chars;
101  sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
102 };
103 
104 }
105 
106 #endif
107 
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int16 getIndexWeight(const OUString &rIndexEntry)
Index(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
void makeIndexKeys(const css::lang::Locale &rLocale, std::u16string_view algorithm)
OUString getIndexDescription(const OUString &rIndexEntry)
virtual OUString SAL_CALL getIndexKey(const OUString &IndexEntry, const OUString &PhoneticEntry, const css::lang::Locale &rLocale) override
sal_uInt16 sal_Unicode
rtl::Reference< CollatorImpl > collator
sal_Int16 compare(sal_Unicode c1, sal_Unicode c2)
virtual OUString SAL_CALL getIndexCharacter(const OUString &rIndexEntry, const css::lang::Locale &rLocale, const OUString &rSortAlgorithm) override
virtual sal_Int16 SAL_CALL compareIndexEntry(const OUString &IndexEntry1, const OUString &PhoneticEntry1, const css::lang::Locale &rLocale1, const OUString &IndexEntry2, const OUString &PhoneticEntry2, const css::lang::Locale &rLocale2) override
#define MAX_KEYS
unsigned char sal_Bool
IndexEntrySupplier_Unicode(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
void init(const css::lang::Locale &rLocale, const OUString &algorithm)
Constant values shared between i18npool and, for example, the number formatter.
tuple index
IndexTable tables[MAX_TABLES]
unsigned char sal_uInt8
virtual sal_Bool SAL_CALL loadAlgorithm(const css::lang::Locale &rLocale, const OUString &SortAlgorithm, sal_Int32 collatorOptions) override
sal_Int16 mkeys[MAX_KEYS]
#define MAX_TABLES
struct _ADOIndex Index
void init(sal_Unicode start_, sal_Unicode end_, IndexKey const *keys, sal_Int16 key_count, Index *index)