/////////////////////////////////////////////////////////////////////// #ifndef KoreanRomanNotationH #define KoreanRomanNotationH /////////////////////////////////////////////////////////////////////// #include #include namespace Koreanromannotation { typedef std::basic_string string_type; typedef enum{enpt_invalid=-1,enpt_cho_seong=1,enpt_jung_seong=2,enpt_jong_seong=4,enpt_char}PhonemeType; typedef unsigned short int KorCodeType; struct TCharInfo { KorCodeType kor_code; KorCodeType cho_seong, jung_seong, jong_seong; string_type cho_seong_roman, jung_seong_roman, jong_seong_roman; void Parse() { cho_seong = (kor_code&0x007C) | 0x4180; jung_seong = (kor_code&0xE003) | 0x0184; jong_seong = (kor_code&0x1F00) | 0x4084; } void Clear() { kor_code = 0; cho_seong = jung_seong = jong_seong = 0; cho_seong_roman = jung_seong_roman = jong_seong_roman = ""; } }; string_type RomanFromKor(const string_type& str,bool by_pronunciation,bool each_char_to_capital,bool space_each_char); bool RomanFromKorChar(KorCodeType kor_code,TCharInfo& char_info); int GetRomanCodeIndexFromChoseong(KorCodeType choseong_code); int GetRomanCodeIndexFromJungseong(KorCodeType jungseong_code); int GetRomanCodeIndexFromJongseong(KorCodeType jongseong_code); PhonemeType WhatPhoneme(KorCodeType phoneme); void Pronounce(TCharInfo& prev_char_info,TCharInfo& char_info,string_type& res); #define CP_KOREAN_WANSUNG 949 #define CP_KOREAN_JOHAB 1361 #define CP_KOREAN CP_KOREAN_WANSUNG #define CP_JAPANESE 932 char* ConvertCodePage(const char *buff,UINT nCPFrom,UINT nCPTo, DWORD dwFlags); wchar_t* mbcs2wcs(const char *mbcs, UINT cp, DWORD dwFlags); char* wcs2mbcs(const wchar_t *wcs, UINT cp, DWORD dwFlags); extern const char* const Cho_seong_roman_by_char[]; extern const char* const Jung_seong_roman_by_char[]; extern const char* const Jong_seong_roman_by_char[]; extern const char* const Cho_seong_roman_by_pronunciation[]; extern const char* const Jung_seong_roman_by_pronunciation[]; extern const char* const Jong_seong_roman_by_pronunciation[]; }//namespace Koreanromannotation #endif