| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#ifndef _PINYIN_SYMBOLDICTIONARY_H_ |
| 9 |
#define _PINYIN_SYMBOLDICTIONARY_H_ |
| 10 |
|
| 11 |
#include <fcitx-utils/macros.h> |
| 12 |
#include <istream> |
| 13 |
#include <libime/core/datrie.h> |
| 14 |
#include <string> |
| 15 |
#include <string_view> |
| 16 |
#include <vector> |
| 17 |
|
| 18 |
namespace fcitx { |
| 19 |
|
| 20 |
class SymbolDict { |
| 21 |
public: |
| 22 |
using TrieType = libime::DATrie<uint32_t>; |
| 23 |
SymbolDict(); |
| 24 |
|
| 25 |
void load(std::istream &in); |
| 26 |
void clear(); |
| 27 |
|
| 28 |
const std::vector<std::string> *lookup(std::string_view key) const; |
| 29 |
|
| 30 |
private: |
| 31 |
TrieType index_; |
| 32 |
std::vector<std::vector<std::string>> data_; |
| 33 |
}; |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
#endif |