2019-11-06 07:40:28 +00:00
|
|
|
|
#ifndef ZHTOPY_H
|
|
|
|
|
#define ZHTOPY_H
|
|
|
|
|
|
|
|
|
|
/**
|
2021-09-26 01:50:09 +00:00
|
|
|
|
* 汉字转拼音类 作者:feiyangqingyun(QQ:517216493) 2019-02-16
|
2021-09-13 08:12:35 +00:00
|
|
|
|
* 1. 汉字转拼音。
|
|
|
|
|
* 2. 汉字转拼音简拼。
|
|
|
|
|
* 3. 汉字转拼音首字母。
|
2019-11-06 07:40:28 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
|
|
#ifdef quc
|
2020-12-24 10:00:09 +00:00
|
|
|
|
class Q_DECL_EXPORT ZhToPY : public QObject
|
2019-11-06 07:40:28 +00:00
|
|
|
|
#else
|
|
|
|
|
class ZhToPY : public QObject
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
static ZhToPY *Instance();
|
|
|
|
|
explicit ZhToPY(QObject *parent = 0);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
static QScopedPointer<ZhToPY> self;
|
|
|
|
|
QStringList listPY;
|
|
|
|
|
QStringList listJP;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
//载入拼音文件
|
|
|
|
|
void loadPY(const QString &fileName = "zhtopy.txt");
|
|
|
|
|
//汉字转拼音
|
|
|
|
|
QString zhToPY(const QString &chinese);
|
|
|
|
|
//汉字转字母简拼
|
|
|
|
|
QString zhToJP(const QString &chinese);
|
|
|
|
|
//汉字转首字母
|
|
|
|
|
QString zhToZM(const QString &chinese);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // ZHTOPY_H
|