// PYChar.cpp: implementation of the CPYChar class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PYChar.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CPYChar::CPYChar()
{
m_ArrQWSecond[0]="CJWGNSPGCGNESYPBTYYZDXYKYGTDJNNJQMBSGZSCYJSYYQPGKBZGYCYWJKGKLJSWKPJQHYTWDDZLSGMRYPYWWCCKZNKYDG";
m_ArrQWSecond[1]="TTNGJEYKKZYTCJNMCYLQLYPYQFQRPZSLWBTGKJFYXJWZLTBNCXJJJJZXDTTSQZYCDXXHGCKBPHFFSSWYBGMXLPBYLLLHLX";
m_ArrQWSecond[2]="SPZMYJHSOJNGHDZQYKLGJHSGQZHXQGKEZZWYSCSCJXYEYXADZPMDSSMZJZQJYZCDJZWQJBDZBXGZNZCPWHKXHQKMWFBPBY";
m_ArrQWSecond[3]="DTJZZKQHYLYGXFPTYJYYZPSZLFCHMQSHGMXXSXJJSDCSBBQBEFSJYHWWGZKPYLQBGLDLCCTNMAYDDKSSNGYCSGXLYZAYBN";
m_ArrQWSecond[4]="PTSDKDYLHGYMYLCXPYCJNDQJWXQXFYYFJLEJBZRXCCQWQQSBNKYMGPLBMJRQCFLNYMYQMSQTRBCJTHZTQFRXQHXMJJCJLX";
m_ArrQWSecond[5]="QGJMSHZKBSWYEMYLTXFSYDSGLYCJQXSJNQBSCTYHBFTDCYZDJWYGHQFRXWCKQKXEBPTLPXJZSRMEBWHJLBJSLYYSMDXLCL";
m_ArrQWSecond[6]="QKXLHXJRZJMFQHXHWYWSBHTRXXGLHQHFNMNYKLDYXZPWLGGTMTCFPAJJZYLJTYANJGBJPLQGDZYQYAXBKYSECJSZNSLYZH";
m_ArrQWSecond[7]="ZXLZCGHPXZHZNYTDSBCJKDLZAYFMYDLEBBGQYZKXGLDNDNYSKJSHDLY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GDYCHGHLYRZQLCYQJNZSQTKQJYMSZSWLCFQQQXYFGGYPTQWLMCRNFKKFSYYLQBMQAMM";
m_ArrQWSecond[27]="MYXCTPSHCPTXXZZSMPHPSHMCLMLDQFYQXSZYJDJJZZHQPDSZGLSTJBCKBXYQZJSGPSXQZQZRQTBDKYXZKHHGFLBCSMDLDG";
m_ArrQWSecond[28]="DZDBLZYYCXNNCSYBZBFGLZZXSWMSCCMQNJQSBDQSJTXXMBLTXZCLZSHZCXRQJGJYLXZFJPHYMZQQYDFQJJLZZNZJCDGZYG";
m_ArrQWSecond[29]="CTXMZYSCTLKPHTXHTLBJXJLXSCDQXCBBTJFQZFSLTJBTKQBXXJJLJCHCZDBZJDCZJDCPRNPQCJPFCZLCLZXZDMXMPHJSGZ";
m_ArrQWSecond[30]="GSZZQJYLWTJPFSYASMCJBTZKYCWMYTCSJJLJCQLWZMALBXYFBPNLSFHTGJWEJJXXGLLJSTGSHJQLZFKCGNNDSZFDEQFHBS";
m_ArrQWSecond[31]="AQTGLLBXMMYGSZLDYDQMJJRGBJTKGDHGKBLQKBDMBYLXWCXYTTYBKMRTJZXQJBHLMHMJJZMQASLDCYXYQDLQCAFYWYXQHZ";
}
CPYChar::~CPYChar()
{
}
//功能:检测Value 是否在Lp..Hp之间
BOOL CPYChar::In(int Lp, int Hp,int Value)
{
ASSERT(Lp<=Hp);
return ((Value<=Hp)&&(Value>=Lp));
}
//参数:一个汉字
//返回值:该汉字的拼音
char CPYChar::GetPYChar(CString HZ)
{
ASSERT(HZ.GetLength()==2);
return GetPYChar(HZ.GetAt(0),HZ.GetAt(1));
}
//参数:一个汉字
//返回值:该汉字的拼音
char CPYChar::GetPYChar(TCHAR c1,TCHAR c2)
{
WORD Hi=WORD(c1)<<8;
WORD Lo=BYTE(c2);
int n=Hi+Lo;
if (n<=0xD7F9)
{
if (In(0xB0A1,0xB0C4,n)) return 'A';
if (In(0XB0C5,0XB2C0,n)) return 'B';
if (In(0xB2C1,0xB4ED,n)) return 'C';
if (In(0xB4EE,0xB6E9,n)) return 'D';
if (In(0xB6EA,0xB7A1,n)) return 'E';
if (In(0xB7A2,0xB8C0,n)) return 'F';
if (In(0xB8C1,0xB9FD,n)) return 'G';
if (In(0xB9FE,0xBBF6,n)) return 'H';
if (In(0xBBF7,0xBFA5,n)) return 'J';
if (In(0xBFA6,0xC0AB,n)) return 'K';
if (In(0xC0AC,0xC2E7,n)) return 'L';
if (In(0xC2E8,0xC4C2,n)) return 'M';
if (In(0xC4C3,0xC5B5,n)) return 'N';
if (In(0xC5B6,0xC5BD,n)) return 'O';
if (In(0xC5BE,0xC6D9,n)) return 'P';
if (In(0xC6D1,0xC8BA,n)) return 'Q';
if (In(0xC8BB,0xC8F5,n)) return 'R';
if (In(0xC8F6,0xCBF9,n)) return 'S';
if (In(0xCBFA,0xCDD9,n)) return 'T';
if (In(0xCDDA,0xCEF3,n)) return 'W';
if (In(0xCEF4,0xD1B8,n)) return 'X';
if (In(0xD1B9,0xD4D0,n)) return 'Y';
if (In(0xD4D1,0xD7F9,n)) return 'Z';
return char(0);
}
else
{
char b1 = (c1&0x7F)-0x20 - 56;
char b2 = (c2&0x7F)-0x20 - 1;
if (b1>=0 && b1<=31 && b2>=0 && b2<=93)
{
return m_ArrQWSecond[b1].GetAt(b2);
}
return char(0);
}
}
- 1
- 2
- 3
- 4
前往页