📄 qjpunicode.cpp
字号:
}#endif return QJpUnicodeConv::Jisx0212ToUnicode(h, l);}uint QJpUnicodeConv_Sun::UnicodeToAscii(uint h, uint l) const{ if ((h == 0x00) && (l == 0xa5)) { return 0x005c; } else if ((h == 0x20) && (l == 0x3e)) { return 0x007e; } return QJpUnicodeConv::UnicodeToAscii(h, l);}uint QJpUnicodeConv_Sun::UnicodeToJisx0201Latin(uint h, uint l) const{ return QJpUnicodeConv::UnicodeToAscii(h, l);}uint QJpUnicodeConv_Sun::UnicodeToJisx0208(uint h, uint l) const{ if ((h == 0x00) && (l == 0xa5)) { return 0x0000; } else if ((h == 0x20) && (l == 0x3e)) { return 0x0000; } else if ((h == 0xff) && (l == 0x3c)) { return 0x2140; } return QJpUnicodeConv::UnicodeToJisx0208(h, l);}/*! \internal */uint QJpUnicodeConv_Sun::UnicodeToJisx0212(uint h, uint l) const{#if 1 // Added by Serika Kususugawa to avoid conflict on U+007c. if ((h == 0x00) && (l == 0x7e)) { return 0x0000; } if ((h == 0xff) && (l == 0x5e)) { return 0x2237; }#endif return QJpUnicodeConv::UnicodeToJisx0212(h, l);}/* * Microsoft conversion. */class QJpUnicodeConv_Microsoft : public QJpUnicodeConv {public: QJpUnicodeConv_Microsoft(int r) : QJpUnicodeConv(r) {}// uint AsciiToUnicode(uint h, uint l) const;// uint Jisx0201ToUnicode(uint h, uint l) const; uint Jisx0201LatinToUnicode(uint h, uint l) const;// uint Jisx0201KanaToUnicode(uint h, uint l) const; uint Jisx0208ToUnicode(uint h, uint l) const; uint Jisx0212ToUnicode(uint h, uint l) const;// uint UnicodeToAscii(uint h, uint l) const;// uint UnicodeToJisx0201(uint h, uint l) const; uint UnicodeToJisx0201Latin(uint h, uint l) const;// uint UnicodeToJisx0201Kana(uint h, uint l) const; uint UnicodeToJisx0208(uint h, uint l) const; uint UnicodeToJisx0212(uint h, uint l) const;};uint QJpUnicodeConv_Microsoft::Jisx0201LatinToUnicode(uint h, uint l) const{ return AsciiToUnicode(h, l);}uint QJpUnicodeConv_Microsoft::Jisx0208ToUnicode(uint h, uint l) const{ if (h == 0x21) { if (l == 0x40) { return 0xff3c; } else if (l == 0x41) { return 0xff5e; } else if (l == 0x42) { return 0x2225; } else if (l == 0x5d) { return 0xff0d; } else if (l == 0x71) { return 0xffe0; } else if (l == 0x72) { return 0xffe1; } } else if (h == 0x22) { if (l == 0x4c) { return 0xffe2; } } return QJpUnicodeConv::Jisx0208ToUnicode(h, l);}uint QJpUnicodeConv_Microsoft::Jisx0212ToUnicode(uint h, uint l) const{ if (h == 0x22) { if (l == 0x37) { return 0xff5e; } else if (l == 0x43) { return 0xffe4; } } return QJpUnicodeConv::Jisx0212ToUnicode(h, l);}uint QJpUnicodeConv_Microsoft::UnicodeToJisx0201Latin(uint h, uint l) const{ return QJpUnicodeConv::UnicodeToAscii(h, l);}uint QJpUnicodeConv_Microsoft::UnicodeToJisx0208(uint h, uint l) const{#ifdef STRICT if (((h == 0x00) && ((l == 0x5c) || (l == 0xa2) || (l == 0xa3) || (l == 0xac))) || ((h == 0x20) && (l == 0x16)) || ((h == 0x22) && (l == 0x12)) || ((h == 0x30) && (l == 0x1c))) { return 0x0000; }#else if ((h == 0x00) && (l == 0x5c)) { return 0x0000; }#endif if ((h == 0x22) && (l == 0x25)) { return 0x2142; } else if (h == 0xff) { if (l == 0x0d) { return 0x215d; } else if (l == 0x3c) { return 0x2140; } else if (l == 0x5e) { return 0x2141; } else if (l == 0xe0) { return 0x2171; } else if (l == 0xe1) { return 0x2172; } else if (l == 0xe2) { return 0x224c; } } return QJpUnicodeConv::UnicodeToJisx0208(h, l);}uint QJpUnicodeConv_Microsoft::UnicodeToJisx0212(uint h, uint l) const{#ifdef STRICT if ((h == 0x00) && ((l == 0x7e) || (l == 0xa6))) { return 0x0000; }#else if ((h == 0x00) && (l == 0x7e)) { return 0x0000; }#endif if (h == 0xff) { if (l == 0x5e) { return 0x2237; } else if (l == 0xe4) { return 0x2243; } } return QJpUnicodeConv::UnicodeToJisx0212(h, l);}/*! \internal */const QJpUnicodeConv *QJpUnicodeConv::newConverter(int rule){ const char * e = 0; if ( rule == JU_Default && (e=getenv("UNICODEMAP_JP")) != 0 ) { QCString env( e ); for (int i = 0; i < (int)env.length(); ) { int j = env.find(',', i); QCString s; if (j < 0) { s = env.mid(i).stripWhiteSpace(); i = env.length(); } else { s = env.mid(i, j - i).stripWhiteSpace(); i = j + 1; } if (qstricmp(s, "unicode-0.9") == 0) { rule = (rule & 0xff00) | JU_Unicode; } else if (qstricmp(s, "unicode-0201") == 0) { rule = (rule & 0xff00) | JU_Unicode_JISX0201; } else if (qstricmp(s, "unicode-ascii") == 0) { rule = (rule & 0xff00) | JU_Unicode_ASCII; } else if (qstricmp(s, "jisx0221-1995") == 0) { rule = (rule & 0xff00) | JU_JISX0221_JISX0201; } else if ((qstricmp(s, "open-0201") == 0) || (qstricmp(s, "open-19970715-0201") == 0)) { rule = (rule & 0xff00) | JU_JISX0221_JISX0201; } else if ((qstricmp(s, "open-ascii") == 0) || (qstricmp(s, "open-19970715-ascii") == 0)) { rule = (rule & 0xff00) | JU_JISX0221_ASCII; } else if ((qstricmp(s, "open-ms") == 0) || (qstricmp(s, "open-19970715-ms") == 0)) { rule = (rule & 0xff00) | JU_Microsoft_CP932; } else if (qstricmp(s, "cp932") == 0) { rule = (rule & 0xff00) | JU_Microsoft_CP932; } else if (qstricmp(s, "jdk1.1.7") == 0) { rule = (rule & 0xff00) | JU_Sun_JDK117; } else if (qstricmp(s, "nec-vdc") == 0) { rule = rule | JU_NEC_VDC; } else if (qstricmp(s, "ibm-vdc") == 0) { rule = rule | JU_IBM_VDC; } else if (qstricmp(s, "udc") == 0) { rule = rule | JU_UDC; } } } switch (rule & 0x00ff) { case JU_Unicode_JISX0201: return new QJpUnicodeConv_Unicode_JISX0201(rule); case JU_Unicode_ASCII: return new QJpUnicodeConv_Unicode_ASCII(rule); case JU_JISX0221_JISX0201: return new QJpUnicodeConv_JISX0221_JISX0201(rule); case JU_JISX0221_ASCII: return new QJpUnicodeConv_JISX0221_ASCII(rule); case JU_Sun_JDK117: return new QJpUnicodeConv_Sun(rule); case JU_Microsoft_CP932: return new QJpUnicodeConv_Microsoft(rule); default: return new QJpUnicodeConv_Unicode_ASCII(rule); }}/* * JISX0208 <-> ShiftJIS conversion. */static uint Jisx0208ToSjis(uint h, uint l){ if ((0x0021 <= h) && (h <= 0x007e) && (0x0021 <= l) && (l <= 0x007e)) { return ((((h - 1) >> 1) + ((h <= 0x5e) ? 0x71 : 0xb1)) << 8) | (l + ((h & 1) ? ((l < 0x60) ? 0x1f : 0x20) : 0x7e)); } return 0x0000;}static uint SjisToJisx0208(uint h, uint l){ if ((((0x81 <= h) && (h <= 0x9f)) || ((0xe0 <= h) && (h <= 0xef))) && ((0x40 <= l) && (l != 0x7f) && (l <= 0xfc))) { if (l < 0x9f) { return (((h << 1) - ((h <= 0x9f) ? 0x00e1 : 0x0161)) << 8) | (l - ((l <= 0x7f) ? 0x1f : 0x20)); } else { return (((h << 1) - ((h <= 0x9f) ? 0x00e1 : 0x0161) + 1) << 8) | (l - 0x7e); } } return 0x0000;}/* * This function is derived from Unicode 1.1, * JIS X 0201 (1976) to Unicode mapping table version 0.9 . */#define JISX0201_YEN_SIGN 0x005c#define UNICODE_YEN_SIGN 0x00a5#define JISX0201_OVERLINE 0x007e#define UNICODE_OVERLINE 0x203estatic uint Jisx0201ToUnicode11(uint h, uint l){ if (h == 0x00) { if (l < 0x80) { if (l == JISX0201_YEN_SIGN) { return UNICODE_YEN_SIGN; } else if (l == JISX0201_OVERLINE) { return UNICODE_OVERLINE; } else { return l; } } else if ((0xa1 <= l) && (l <= 0x00df)) { return 0xff61 + l - 0x00a1; } } return 0x0000;}/* * This function is derived from Unicode 1.1, * JIS X 0201 (1976) to Unicode mapping table version 0.9 . */static uint Unicode11ToJisx0201(uint h, uint l){ if ((h == 0x00) && (l < 0x80)) { if ((l == JISX0201_YEN_SIGN) || (l == JISX0201_OVERLINE)) { return 0x0000; } return l; } else if ((h == 0x00) && (l == 0xa5)) { return JISX0201_YEN_SIGN; } else if ((h == 0x20) && (l == 0x3e)) { return JISX0201_OVERLINE; } else if ((h == 0xff) && (0x61 <= l) && (l <= 0x9f)) { return 0x00a1 + l - 0x61; } return 0x0000;}/* * This data is derived from Unicode 1.1,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -