xref: /MusicPlayer2/MusicPlayer2/ChinesePingyinRes.h (revision f3728c8579270583f00105e28c21564840605bd9)
1 #pragma once
2 #include <unordered_map>
3 #include <vector>
4 #include <string>
5 
6 class CChinesePingyinRes
7 {
8 public:
9     CChinesePingyinRes();
10     ~CChinesePingyinRes();
11 
12     void Init();
13     static bool IsChineseCharactor(wchar_t ch);
14     //判断一个字符串是否匹配关键字,关键字支持直接匹配、拼音首字母和全拼匹配,但是只支持一种方式匹配,不支持混合匹配
15     bool IsStringMatchWithPingyin(const std::wstring& key_words, const std::wstring& compared_str);
16 
17 private:
18     //保存每个汉字的拼音
19     std::unordered_map<wchar_t, std::wstring> m_pingyin_map;
20 };
21 
22