www.pudn.com > T9InPut.rar > HZK.h, change:2011-06-10,size:33051b


#pragma once 
 
 
 
class CZK   
{ 
public: 
	 inline bool py_check(const CString input); 
	 inline CString  GetInputString(const CString input); 
 
	 inline bool CompareZD(const CString input,CString str); 
 
	 inline CZK(); 
	inline  virtual ~CZK(); 
}; 
 
                    
 const CString PY[408]= 
{ 
						   _T("a ߹H"), 
                           _T("ai "), 
                           _T("an "), 
                           _T("ang nnZla"), 
                           _T("ao °ð"), 
                           _T("ba Ѱ˰ɰְΰհϰͰŰǰӰ԰Ȱаʰ̰Ұ"), 
                           _T("bai ٰװڰܰذݰ۲"), 
                           _T("ban ߰"), 
                           _T("bang "), 
                           _T("bao ٱ"), 
                           _T("bei "), 
                           _T("ben "), 
                           _T("beng ı±Ű"), 
                           _T("bi ȱʱձDẔرܱƱϱ۱˱ɱڱͱұױٱαбӱֱݱѱ޵ݩذ"), 
                           _T("bian ߱ޱ"), 
                           _T("biao "), 
                           _T("bie "), 
                           _T("bin "), 
                           _T("bing "), 
                           _T("bo زDzެ"), 
                           _T("bu ߲уW"), 
                           _T("ca "), 
                           _T("cai Գ߳ٳسճݳֳܳ޳ڳ۳ܯ߳"), 
                           _T("can ϲвβҲѲͲ"), 
                           _T("cang زֲײղ"), 
                           _T("cao ݲٲܲ۲"), 
                           _T("ce ߲"), 
						   _T("cen "), 
                           _T("ceng "), 
                           _T("cha ɲ"), 
                           _T("chai ٭"), 
                           _T("chan "), 
                           _T("chang "), 
                           _T("chao ˴³"), 
                           _T("che ߳"), 
                           _T("chen óƳ³ijȳ"), 
                           _T("cheng ɳʢųƳdz̳ʳϳͳѳҳγȳة"), 
                           _T("chi Գ߳ٳسճݳֳܳ޳ڳ۳ܯ߳"), 
                           _T("chong سӿ"), 
                           _T("chou ٱ"), 
                           _T("chu ۻء"), 
                           _T("chuai "), 
                           _T("chuan "), 
                           _T("chuang "), 
                           _T("chui ׵"), 
                           _T("chun ݻ"), 
                           _T("chuo "), 
                           _T("ci δ˴ʴɴȴƴŴǴ̴ŴôͲ"), 
                           _T("cong ӴԴдҴϴ"), 
                           _T("cou "), 
                           _T("cu ִ״ش"), 
                           _T("cuan ܴڴߥ"), 
                           _T("cui ߴݴ޴˥"), 
                           _T("cun "), 
                           _T("cuo "), 
                           _T("da "), 
                           _T("dai ߾߰ܤ"), 
                           _T("dan ʯ"), 
                           _T("dang "), 
                           _T("dao ߶"), 
                           _T("de ĵصõµ"), 
						   _T("dei ÆO"), 
						   _T("den OY"), 
                           _T("deng ȵƵ˵dzεɵʵ"), 
                           _T("di صڵ׵͵еֵε۵ݵյܵ޵̵ĵѵϵҵԵۡڮصݶ"), 
						   _T("dia "), 
                           _T("dian ߵ"), 
                           _T("diao "), 
                           _T("die ܦ"), 
                           _T("ding "), 
                           _T("diu "), 
                           _T("dong "), 
                           _T("dou "), 
                           _T("du ȶɶ¶ǶƶĶöŶʶܶ"), 
                           _T("duan ζ̶϶˶Ͷ"), 
                           _T("dui ԶӶѶҶ"), 
                           _T("dun ֶٶ׶նض۶ܶڶݲ"), 
                           _T("duo ޶Զȶ"), 
                           _T("e Ŷﰢݭج"), 
						   _T("ei G"), 
                           _T("en "), 
						   _T("eng E"), 
                           _T("er ٦"), 
                           _T("fa "), 
                           _T("fan ެ"), 
                           _T("fang ŷķ÷·"), 
                           _T("fei ǷɷʷѷηϷ˷ͷзƷ̷"), 
                           _T("fen ַݷҷ۷طܷ߷׷޷ӷٷԷշ"), 
                           _T("feng ٺۺ"), 
                           _T("fo u"), 
                           _T("fou "), 
                           _T("fu 򸸷󸳸иݳ߻ۮܽ"), 
                           _T("ga и¿٤"), 
                           _T("gai øĸǸŸƽؤ"), 
                           _T("gan ϸɸиҸ͸ʸθ̸˸Ӹߦ"), 
                           _T("gang ոָٸ۸׸ڸܸԸؿ"), 
                           _T("gao ߸ݸ۬ھغ޻"), 
                           _T("ge ←ٺϸܪت"), 
                           _T("gei "), 
                           _T("gen ݢب"), 
                           _T("geng "), 
                           _T("gong "), 
                           _T("gou ڸ"), 
                           _T("gu ŹɹĹȹʹ¹ù˹̹͹ǹƼֹڬ"), 
                           _T("gua ҹιϹѹйڴ"), 
                           _T("guai ֹչ"), 
                           _T("guan عܹٹ۹ݹ߹޹ڹݸ"), 
                           _T("guang "), 
                           _T("gui Ȳ"), 
                           _T("gun "), 
                           _T("guo "), 
                           _T("ha Ϻ"), 
                           _T("hai Ⱥ܁"), 
                           _T("han "), 
                           _T("hang ﺽ"), 
                           _T("hao úźƺºĺѸ޶"), 
                           _T("he ͺȺϺӺ̺˺κǺɺغպֺк׺ʺѺҺڭ"), 
                           _T("hei ں"), 
                           _T("hen ܺݺ޺"), 
                           _T("heng ߺ޿"), 
                           _T("hong ڧޮްݦ"), 
                           _T("hou ܩ"), 
                           _T("hu Ϸ˺ͺ"), 
                           _T("hua "), 
                           _T("huai "), 
                           _T("huan û»ߧۨۼ"), 
                           _T("huang ƻŻλĻɻ˻ʻѻ̻Ȼǻлͻ"), 
                           _T("hui ػһӻԻٻڻݻ޻ջֻۻ߻׻仲ܻޥڶ"), 
                           _T("hun ڻ"), 
                           _T("huo ͻ޽߫"), 
						   _T("ji ȼǼƼļϵʻ¼ü˼̸ڵߴآܸ٥ު"), 
                           _T("jia ҼӼټۼܼ׼Ѽмμݼ޼ϼԼռؼѼ٤ۣ"), 
                           _T("jian 潨߼齡dz𽢼뽤"), 
                           _T("jiang ǿ"), 
                           _T("jiao нŽǽ̽ϽɾУƽýνѽȽ½ͽĽܴٮ"), 
                           _T("jie ӽڽֽԽؽҽ׽ٽ߽ۿս۽ܽݽ޼ڦڵ"), 
                           _T("jin ᄀݣ"), 
                           _T("jing ݼ"), 
                           _T("jiong "), 
                           _T("jiu ;žƾɾþȾ˾¾Ǿʾľ̾"), 
                           _T("ju پ޾־߾Ӿ۾оվؾھܾϾѾҾݹ۾㳵׾Ҿڪ"), 
                           _T("juan Ȧ۲"), 
                           _T("jue Ǿާ"), 
                           _T("jun 꿢"), 
                           _T("ka "), 
                           _T("kai "), 
                           _T("kan Ƕ٩ݨ"), 
                           _T("kang "), 
                           _T("kao "), 
                           _T("ke ȿɿ˿ÿƿſ̿οͿǿʿ¿ĿwĄˌ"), 
                           _T("ken Ͽпҿ"), 
                           _T("keng ӿ"), 
                           _T("kong տ׿ؿ"), 
                           _T("kou ڿۿٿޢߵ"), 
                           _T("ku ޿ݿ߿ܥ"), 
                           _T("kua ٨"), 
                           _T("kuai ۦ"), 
                           _T("kuan "), 
                           _T("kuang ڿڲ"), 
                           _T("kui ظ"), 
                           _T("kun "), 
                           _T("kuo "), 
                           _T("la "), 
                           _T("lai "), 
                           _T("lan "), 
                           _T("lang ݹ"), 
                           _T("lao "), 
                           _T("le ߷"), 
                           _T("lei ڳ"), 
                           _T("leng ܨ"), 
                           _T("li ٳٵ۪ݰت߿޼"), 
						   _T("lia z"), 
                           _T("lian "), 
                           _T("liang ܮݹ"), 
                           _T("liao ޤ"), 
                           _T("lie "), 
                           _T("lin "), 
                           _T("ling ۹"), 
                           _T("liu µ½"), 
						   _T("lo "), 
                           _T("long £¡¢Ū¤"), 
                           _T("lou ¥§©ª¶¦¨"), 
                           _T("lu ·¶¼¹½¯¬³±«­®µ°²¸¾º»´ޤ"), 
                           _T("luan "), 
                           _T("lue "), 
                           _T("lun "), 
                           _T("luo 翩"), 
                           _T("lv ¿"), 
                           _T("ma ĨĦ"), 
                           _T("mai ۽ݤ"), 
                           _T("man áܬ"), 
                           _T("mang æâäçãå"), 
                           _T("mao ëðñèìîòïóíêé"), 
                           _T("me ô"), 
                           _T("mei ûÿúþøöùõü÷ýĭݮ"), 
                           _T("men "), 
                           _T("meng åޫ"), 
                           _T("mi "), 
                           _T("mian "), 
                           _T("miao "), 
                           _T("mie ؿ"), 
                           _T("min "), 
                           _T("ming ڤ"), 
                           _T("miu "), 
                           _T("mo ĥĨĩĤīûĪĬħģĦġĮİĭðįԺĢ"), 
                           _T("mou ijıIJٰ"), 
                           _T("mu ľĸĶĻĿĹIJģĺĵĴļĽķ"), 
                           _T("na "), 
                           _T("nai ܵؾ٦"), 
                           _T("nan "), 
                           _T("nang ߭"), 
                           _T("nao ث"), 
                           _T("ne ګ"), 
                           _T("nei "), 
                           _T("nen "), 
                           _T("neng "), 
                           _T("ni ٣"), 
                           _T("nian ճإ"), 
                           _T("niang "), 
                           _T("niao "), 
                           _T("nie ؿ"), 
                           _T("nin "), 
                           _T("ning šŢ"), 
                           _T("niu ţŤŦť"), 
                           _T("nong ŪŨũŧٯ"), 
                           _T("nu ŭŬū"), 
                           _T("nuan ů"), 
                           _T("nue Űű"), 
                           _T("nuo ŲŵųŴ"), 
                           _T("nv Ů"), 
                           _T("o Ŷ"), 
                           _T("ou żŻŷźŸŽŹک"), 
                           _T("pa ſžҰ"), 
                           _T("pai ٽ"), 
                           _T("pan ͷ"), 
                           _T("pang Ұ"), 
                           _T("pao "), 
                           _T("pei "), 
                           _T("pen "), 
                           _T("peng ܡ"), 
                           _T("pi ƤƥƨƢƧƣƦơƩاߨۯܱ"), 
                           _T("pian Ƭƪƭƫ"), 
                           _T("piao ƱƮƯưݳ"), 
                           _T("pie ƳƲ"), 
                           _T("pin ƷƶƸƴƵ"), 
                           _T("ping ƽƾƿƹƼƻƺٷ"), 
                           _T("po Ȳӷ۶"), 
                           _T("pou "), 
                           _T("pu ׸ֱձW"), 
                           _T("qi ݽޭܻؽٹ"), 
                           _T("qia ǡǢ"), 
                           _T("qian ǰǮǧǣdzǩǷǦǶǥǨǯǬǴǫDZǸǤDzǭǵǪٻݡܷ"), 
                           _T("qiang ǿǹǽǻǺǼǾ"), 
                           _T("qiao ¿ȸڽ"), 
                           _T("qie ۧ٤"), 
                           _T("qin "), 
                           _T("qing "), 
                           _T("qiong "), 
                           _T("qiu ٴ"), 
                           _T("qu ȥȡȢȤȣ޾ޡ۾ڰ"), 
                           _T("quan ȫȨȰȦȭȮȪȯȧȬȩڹ"), 
                           _T("que ȴȱȷȸȳȵȲȶ"), 
                           _T("qun Ⱥȹ"), 
                           _T("ran ȾȼȻȽ"), 
                           _T("rang ȿ"), 
                           _T("rao "), 
                           _T("re "), 
                           _T("ren "), 
                           _T("reng "), 
                           _T("ri "), 
                           _T("rong "), 
                           _T("rou "), 
                           _T("ru ޸"), 
                           _T("ruan "), 
                           _T("rui ި"), 
                           _T("run "), 
                           _T("ruo ټ"), 
                           _T("sa ئ"), 
                           _T("sai ˼"), 
                           _T("san ɢɡ"), 
                           _T("sang ɣɥɤ"), 
                           _T("sao ɨɩɦɧܣ"), 
                           _T("se ɫɬɪ"), 
                           _T("sen ɭ"), 
                           _T("seng ɮ"), 
                           _T("sha ɱɳɶɴɵɰɲɯɷɼ"), 
                           _T("shai ɹɸɫ"), 
                           _T("shan ɽɼɾɿɺդɻ۷ڨ"), 
                           _T("shang "), 
                           _T("shao ۿ"), 
                           _T("she "), 
						   _T("shei ˭"), 
                           _T("shen ʲݷڷ"), 
                           _T("sheng ʡʣʤʢʥ"), 
                           _T("shi ʹʮʱʯʦʷʽʶʭʸʰʺʻʼʾʿʲֳʧʨʳʴʵʩʪʫʬݪ߱"), 
                           _T("shou "), 
                           _T("shu ˡ"), 
                           _T("shua ˢˣ"), 
                           _T("shuai ˤ˦˧˥"), 
                           _T("shuan ˨˩"), 
                           _T("shuang ˫˪ˬ"), 
                           _T("shui ˮ˭˯˰˵"), 
                           _T("shun ˳˱˲˴"), 
                           _T("shuo ˵˶˸˷"), 
                           _T("si ˿˺˽˻˼˾˹ʳŲٹ"), 
                           _T("song ݿڡ"), 
                           _T("sou ޴"), 
                           _T("su "), 
                           _T("suan "), 
                           _T("sui ݴ"), 
                           _T("sun ݥ"), 
                           _T("suo ɯ"), 
                           _T("ta ̡̢̤̣"), 
                           _T("tai ̧̨̫̬̥̦̩̪̭߾޷ۢ"), 
                           _T("tan ̸̶̵̷̴̲̼̯̰̳̺̹̱̮̻̾̽̿۰"), 
                           _T("tang "), 
                           _T("tao ػ߶"), 
                           _T("te ߯"), 
                           _T("teng "), 
                           _T("ti "), 
                           _T("tian "), 
                           _T("tiao ٬"), 
                           _T("tie "), 
                           _T("ting ͣͦͤͧͥ͢͡"), 
                           _T("tong ͬͨʹͭͰͲͱͳͯͮͩͫͪ١"), 
                           _T("tou ͷ͵͸Ͷ"), 
                           _T("tu ͼͿͺͻͽ͹;ܢݱ"), 
                           _T("tuan "), 
                           _T("tui ߯"), 
                           _T("tun ζ"), 
                           _T("tuo ر٢"), 
						   _T("tei ߯"), 
                           _T("wa ݰ"), 
                           _T("wai "), 
                           _T("wan ݸܹ"), 
                           _T("wang â"), 
                           _T("wei ΪλδΧιθ΢ζβαΰΣΥίκΨάηΩΤΡενξΫγοΦήέμޱ"), 
                           _T("wen "), 
                           _T("weng ޳"), 
                           _T("wo ݫ"), 
                           _T("wu أ"), 
                           _T("xi ϴϸϷϵϲϯϡϪϨϥϢϮϧϰϦϤϣϭϱϳϩ϶ϫϬۭݾ"), 
                           _T("xia ϿϺϹϼϻϽϾ"), 
                           _T("xian ϳ޺ݲ"), 
                           _T("xiang ήܼ"), 
                           _T("xiao СЦЧФТХУ"), 
                           _T("xie дЩЬЪбѪлжЮмзкийШаЭегЫЯвҶߢޯ"), 
                           _T("xin онпѰضݷܰ"), 
                           _T("xing ʡߩ"), 
                           _T("xiong ܺ"), 
                           _T("xiu "), 
                           _T("xu ޣڼ"), 
                           _T("xuan ѡѤѣѢȯ"), 
                           _T("xue ѧѩѪѥѨѦ"), 
                           _T("xun ѰѶѬѵѭѳѮѲѸѱѴѷѫѯަ޹ۨ"), 
                           _T("ya ѽѹѺѿѼѾѻ"), 
                           _T("yan ٲ۱۳Ǧܾ"), 
                           _T("yang "), 
                           _T("yao ҪҡҩҧҤҨҥңҦҫҢԿزسߺűԼ"), 
                           _T("ye ҲҹҵҰҶүҳҺҴҸұҭҮҷҬа"), 
                           _T("yi һҽʳҼҾҿضβܲڱ٫߮޲߽"), 
                           _T("yin ӡܧ۴ط"), 
                           _T("ying ӦӲӰӪӭӳӬӮӥӢӱӨӯӤӣӧӫөݺ۫"), 
                           _T("yo Ӵ"), 
                           _T("yong ӿӵӼӺӽӾӶӻӸӹӷٸܭ"), 
                           _T("you ٧ݬݯݵ"), 
                           _T("yu ξԡԢԣԤԥԦεخٶع"), 
                           _T("yuan ԶԱԪԺԲԭԸ԰ԮԳԹԩԴԵԬԨԷԫԧԯܾܫ"), 
                           _T("yue ԽԼԾԻ˵Կ"), 
                           _T("yun Ա۩ܿ"), 
                           _T("za զ"), 
                           _T("zai "), 
                           _T("zan "), 
                           _T("zang ߲"), 
                           _T("zao "), 
                           _T("ze զ"), 
                           _T("zei "), 
                           _T("zen "), 
                           _T("zeng "), 
                           _T("zha ըբգեէթա߸դզ"), 
                           _T("zhai ժխծիկլ"), 
                           _T("zhan վռսյմճձչջղպտնշոհ"), 
                           _T("zhang ³۵"), 
                           _T("zhao צ׳سگ"), 
                           _T("zhe ߡ"), 
						   _T("zhei "), 
                           _T("zhen "), 
                           _T("zheng ֤֢֣֡ں綡"), 
                           _T("zhi ְֱֲֳִֵֶַָֹֺֻּֽ֪֧֥֦֭֮֨֩֫֬֯־ֿʶۤش΁v~fuЃ"), 
                           _T("zhong ڣ"), 
                           _T("zhou ݧ"), 
                           _T("zhu סעףפ٪ۥ"), 
                           _T("zhua ץצ"), 
                           _T("zhuai קת"), 
                           _T("zhuan תרש׬׫׭"), 
                           _T("zhuang װײׯ׳׮״ױ"), 
                           _T("zhui ׷׹׺׶׸׵"), 
                           _T("zhun ׼׻"), 
                           _T("zhuo ׽׾׿ߪپ"), 
                           _T("zi ֨"), 
                           _T("zong "), 
                           _T("zou ۸"), 
                           _T("zu "), 
                           _T("zuan ׬߬"), 
                           _T("zui Ѿީ"), 
                           _T("zun ߤ"), 
						   _T("zuo "), 
						   _T("* *+-.,;:'\"?!()<>[]{}$%@_=~`|/\\^#") 
}; 
 
 
 
 
CZK::CZK() 
{} 
                            
 
                    
CZK::~CZK() 
{} 
 
 
// ѯ 
CString  CZK::GetInputString(const CString input) 
{ 
	CString strBuffer; //ַ 
	CString strHZ; 
	CString strTemp; 
	 
	strBuffer.Empty(); 
	strHZ.Empty(); 
	strTemp.Empty(); 
 
	if (input.IsEmpty()) 
		return(_T("")); //"ַ0" 
	if (input[0]=='i') 
		return(_T("")); 
	if (input[0]=='u') 
		return(_T("")); 
	if (input[0]=='v') 
		return(_T("")); 
 
	for(int i=0;i<408;i++) 
	{ 
		strBuffer = PY[i]; 
 
		int iTemp = strBuffer.Find(char(32)); 
				 
		if(iTemp>0) 
		{ 
			strTemp = strBuffer.Left(iTemp); 
 
			if(input == strTemp) 
			{ 
				//strHZ = strBuffer.Right(strBuffer.GetLength() - iTemp -1); 
				strHZ = strBuffer.Mid(iTemp+1); 
				return strHZ; 
			} 
			else if(CompareZD(input,strTemp)) 
			{ 
				strHZ = strBuffer.Mid(iTemp+1); 
				return strHZ; 
			} 
			 
		} 
		strBuffer.Empty(); 
	} 
 
	return strHZ; 
} 
 
bool CZK::py_check(const CString input) 
{ 
	CString strBuffer = _T(""); //ַ 
	CString strInput = _T(""); 
	CString strTemp = _T(""); 
 
 
	BYTE bIsCorrect=0; 
	long  dwTemp=0; 
	if (input[0]==0) return(0); //"ַ0" 
	if (input[0]=='i') return(0); 
	if (input[0]=='u') return(0); 
	if (input[0]=='v') return(0); 
 
	if(input.GetLength() == 1) 
	{ 
		return true; 
	} 
 
	for(int i=0;i<408;i++) 
	{ 
		strBuffer = PY[i]; 
 
		int iTemp = strBuffer.Find(char(32)); 
				 
		if(iTemp>0) 
		{ 
			strTemp = strBuffer.Left(iTemp); 
 
			if(input == strTemp) 
			{ 
				return true; 
			} 
			else if(CompareZD(input,strTemp)) 
			{ 
				return true; 
			} 
			 
		} 
		strBuffer = _T(""); 
	} 
 
	return false; 
 
} 
 
 
bool CZK::CompareZD(const CString input,CString str) 
{ 
	int num=0,index=0; 
	num = input.GetLength(); 
	int iTemp = str.GetLength(); 
 
	for(int i=0;i<num;i++) 
	{	 
		if(i > iTemp || i > num) 
		{ 
			return false; 
		} 
 
		if(input.Mid(i,1) == str.Mid(i,1)) 
		{ 
			index++; 
		} 
	} 
 
	if(index == num) 
	{ 
		return true; 
	} 
 
	return false; 
}