Debian Codegraph @

modules/pinyinhelper/pinyinlookup.h

raw
1 /*
2 * SPDX-FileCopyrightText: 2017-2017 CSSlayer <[email protected]>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 */
7 #ifndef _PINYINHELPER_PINYINLOOKUP_H_
8 #define _PINYINHELPER_PINYINLOOKUP_H_
9
10 #include <cstdint>
11 #include <string>
12 #include <tuple>
13 #include <unordered_map>
14 #include <vector>
15
16 namespace fcitx {
17
18 struct PinyinLookupData {
19 uint8_t consonant;
20 uint8_t vocal;
21 uint8_t tone;
22 };
23
24 class PinyinLookup {
25 public:
26 bool load();
27 std::vector<std::string> lookup(uint32_t hz);
28 std::vector<std::tuple<std::string, std::string, int>>
29 fullLookup(uint32_t hz);
30
31 private:
32 std::unordered_map<uint32_t, std::vector<PinyinLookupData>> data_;
33 bool loaded_ = false;
34 bool loadResult_ = false;
35 };
36 } // namespace fcitx
37
38 #endif // _PINYINHELPER_PINYINLOOKUP_H_