Qt 4.8
Public Types | Public Functions | Static Public Functions | Protected Functions | Properties | List of all members
QJpUnicodeConv Class Reference

#include <qjpunicode.h>

Inheritance diagram for QJpUnicodeConv:
QJpUnicodeConv_JISX0221_ASCII QJpUnicodeConv_JISX0221_JISX0201 QJpUnicodeConv_Microsoft QJpUnicodeConv_Sun QJpUnicodeConv_Unicode_ASCII QJpUnicodeConv_Unicode_JISX0201

Public Types

enum  Rules {
  Default = 0x0000, Unicode = 0x0001, Unicode_JISX0201 = 0x0001, Unicode_ASCII = 0x0002,
  JISX0221_JISX0201 = 0x0003, JISX0221_ASCII = 0x0004, Sun_JDK117 = 0x0005, Microsoft_CP932 = 0x0006,
  NEC_VDC = 0x0100, UDC = 0x0200, IBM_VDC = 0x0400
}
 

Public Functions

virtual uint asciiToUnicode (uint h, uint l) const
 
uint asciiToUnicode (uint ascii) const
 
uint cp932ToUnicode (uint h, uint l) const
 
uint jisx0201KanaToUnicode (uint h, uint l) const
 
uint jisx0201KanaToUnicode (uint jis) const
 
virtual uint jisx0201LatinToUnicode (uint h, uint l) const
 
uint jisx0201LatinToUnicode (uint jis) const
 
uint jisx0201ToUnicode (uint h, uint l) const
 
uint jisx0201ToUnicode (uint jis) const
 
virtual uint jisx0208ToUnicode (uint h, uint l) const
 
uint jisx0208ToUnicode (uint jis) const
 
virtual uint jisx0212ToUnicode (uint h, uint l) const
 
uint jisx0212ToUnicode (uint jis) const
 
uint sjisibmvdcToUnicode (uint h, uint l) const
 
uint sjisToUnicode (uint h, uint l) const
 
uint sjisToUnicode (uint sjis) const
 
virtual uint unicodeToAscii (uint h, uint l) const
 
uint unicodeToAscii (uint unicode) const
 
uint unicodeToCp932 (uint h, uint l) const
 
uint unicodeToJisx0201 (uint h, uint l) const
 
uint unicodeToJisx0201 (uint unicode) const
 
uint unicodeToJisx0201Kana (uint h, uint l) const
 
uint unicodeToJisx0201Kana (uint unicode) const
 
virtual uint unicodeToJisx0201Latin (uint h, uint l) const
 
uint unicodeToJisx0201Latin (uint unicode) const
 
virtual uint unicodeToJisx0208 (uint h, uint l) const
 
uint unicodeToJisx0208 (uint unicode) const
 
virtual uint unicodeToJisx0212 (uint h, uint l) const
 
uint unicodeToJisx0212 (uint unicode) const
 
uint unicodeToSjis (uint h, uint l) const
 
uint unicodeToSjis (uint unicode) const
 
uint unicodeToSjisibmvdc (uint h, uint l) const
 
virtual ~QJpUnicodeConv ()
 

Static Public Functions

static QJpUnicodeConvnewConverter (int rule)
 

Protected Functions

 QJpUnicodeConv (int r)
 

Properties

int rule
 

Detailed Description

Note
This class or function is reentrant.
Warning
This function is not part of the public interface.

Definition at line 78 of file qjpunicode.h.

Enumerations

◆ Rules

Enumerator
Default 
Unicode 
Unicode_JISX0201 
Unicode_ASCII 
JISX0221_JISX0201 
JISX0221_ASCII 
Sun_JDK117 
Microsoft_CP932 
NEC_VDC 
UDC 
IBM_VDC 

Definition at line 81 of file qjpunicode.h.

81  {
82  // "ASCII" is ANSI X.3.4-1986, a.k.a. US-ASCII here.
83  Default = 0x0000,
84 
85  Unicode = 0x0001,
86  Unicode_JISX0201 = 0x0001,
87  Unicode_ASCII = 0x0002,
88  JISX0221_JISX0201 = 0x0003,
89  JISX0221_ASCII = 0x0004,
90  Sun_JDK117 = 0x0005,
91  Microsoft_CP932 = 0x0006,
92 
93  NEC_VDC = 0x0100, // NEC Vender Defined Char
94  UDC = 0x0200, // User Defined Char
95  IBM_VDC = 0x0400 // IBM Vender Defined Char
96  };

Constructors and Destructors

◆ ~QJpUnicodeConv()

virtual QJpUnicodeConv::~QJpUnicodeConv ( )
inlinevirtual

Definition at line 80 of file qjpunicode.h.

80 {}

◆ QJpUnicodeConv()

QJpUnicodeConv::QJpUnicodeConv ( int  r)
inlineexplicitprotected
Warning
This function is not part of the public interface.

Definition at line 166 of file qjpunicode.h.

166 : rule(r) {}

Functions

◆ asciiToUnicode() [1/2]

uint QJpUnicodeConv::asciiToUnicode ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_JISX0221_JISX0201.

Definition at line 103 of file qjpunicode.cpp.

Referenced by asciiToUnicode(), QJpUnicodeConv_JISX0221_ASCII::jisx0201LatinToUnicode(), QJpUnicodeConv_Sun::jisx0201LatinToUnicode(), QJpUnicodeConv_Microsoft::jisx0201LatinToUnicode(), and QJpUnicodeConv_JISX0221_JISX0201::QJpUnicodeConv_JISX0221_JISX0201().

104 {
105  if ((h == 0) && (l < 0x80)) {
106  return l;
107  }
108  return 0x0000;
109 }
QFactoryLoader * l

◆ asciiToUnicode() [2/2]

uint QJpUnicodeConv::asciiToUnicode ( uint  ascii) const
inline
Warning
This function is not part of the public interface.

Definition at line 106 of file qjpunicode.h.

106  {
107  return asciiToUnicode((ascii & 0xff00) >> 8, (ascii & 0x00ff));
108  }
virtual uint asciiToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:103

◆ cp932ToUnicode()

uint QJpUnicodeConv::cp932ToUnicode ( uint  h,
uint  l 
) const

Definition at line 10593 of file qjpunicode.cpp.

Referenced by QSjisCodec::convertToUnicode(), and unicodeToJisx0212().

10594 {
10595  if (rule & Microsoft_CP932) {
10596  if (h == 0x0087 && (l >= 0x0040 && l <= 0x009c))
10597  return cp932_87_unicode[l-0x0040];
10598  else if ((h == 0x00ed || h == 0x00ee) && (l >= 0x0040 && l <= 0x00fc))
10599  return cp932_ed_ee_unicode[((h - 0x00ed)*189 + (l-0x0040))];
10600  }
10601  return 0;
10602 }
static unsigned short const cp932_ed_ee_unicode[]
QFactoryLoader * l
static unsigned short const cp932_87_unicode[]

◆ jisx0201KanaToUnicode() [1/2]

uint QJpUnicodeConv::jisx0201KanaToUnicode ( uint  h,
uint  l 
) const
Warning
This function is not part of the public interface.

Definition at line 134 of file qjpunicode.cpp.

Referenced by jisx0201KanaToUnicode(), and jisx0201ToUnicode().

135 {
136  if ((h == 0) && IsKana(l)) {
137  return jisx0201ToUnicode11(h, l);
138  }
139  return 0x0000;
140 }
static uint jisx0201ToUnicode11(uint h, uint l)
Definition: qjpunicode.cpp:829
QFactoryLoader * l
#define IsKana(c)
Definition: qjpunicode.cpp:59

◆ jisx0201KanaToUnicode() [2/2]

uint QJpUnicodeConv::jisx0201KanaToUnicode ( uint  jis) const
inline
Warning
This function is not part of the public interface.

Definition at line 115 of file qjpunicode.h.

115  {
116  return jisx0201KanaToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
117  }
uint jisx0201KanaToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:134

◆ jisx0201LatinToUnicode() [1/2]

uint QJpUnicodeConv::jisx0201LatinToUnicode ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_Microsoft, QJpUnicodeConv_Sun, and QJpUnicodeConv_JISX0221_ASCII.

Definition at line 125 of file qjpunicode.cpp.

Referenced by QJpUnicodeConv_JISX0221_JISX0201::asciiToUnicode(), jisx0201LatinToUnicode(), jisx0201ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::QJpUnicodeConv_JISX0221_ASCII(), QJpUnicodeConv_Microsoft::QJpUnicodeConv_Microsoft(), and QJpUnicodeConv_Sun::QJpUnicodeConv_Sun().

126 {
127  if ((h == 0) && IsLatin(l)) {
128  return jisx0201ToUnicode11(h, l);
129  }
130  return 0x0000;
131 }
static uint jisx0201ToUnicode11(uint h, uint l)
Definition: qjpunicode.cpp:829
#define IsLatin(c)
Definition: qjpunicode.cpp:58
QFactoryLoader * l

◆ jisx0201LatinToUnicode() [2/2]

uint QJpUnicodeConv::jisx0201LatinToUnicode ( uint  jis) const
inline
Warning
This function is not part of the public interface.

Definition at line 112 of file qjpunicode.h.

112  {
113  return jisx0201LatinToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
114  }
virtual uint jisx0201LatinToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:125

◆ jisx0201ToUnicode() [1/2]

uint QJpUnicodeConv::jisx0201ToUnicode ( uint  h,
uint  l 
) const
Warning
This function is not part of the public interface.

Definition at line 112 of file qjpunicode.cpp.

Referenced by QEucJpCodec::convertToUnicode(), QSjisCodec::convertToUnicode(), QJisCodec::convertToUnicode(), jisx0201ToUnicode(), and sjisToUnicode().

113 {
114  if (h == 0) {
115  if (IsLatin(l)) {
116  return jisx0201LatinToUnicode(h, l);
117  } else if (IsKana(l)) {
118  return jisx0201KanaToUnicode(h, l);
119  }
120  }
121  return 0x0000;
122 }
#define IsLatin(c)
Definition: qjpunicode.cpp:58
uint jisx0201KanaToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:134
virtual uint jisx0201LatinToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:125
QFactoryLoader * l
#define IsKana(c)
Definition: qjpunicode.cpp:59

◆ jisx0201ToUnicode() [2/2]

uint QJpUnicodeConv::jisx0201ToUnicode ( uint  jis) const
inline
Warning
This function is not part of the public interface.

Definition at line 109 of file qjpunicode.h.

109  {
110  return jisx0201ToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
111  }
uint jisx0201ToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:112

◆ jisx0208ToUnicode() [1/2]

uint QJpUnicodeConv::jisx0208ToUnicode ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_Microsoft, QJpUnicodeConv_Sun, QJpUnicodeConv_JISX0221_ASCII, QJpUnicodeConv_JISX0221_JISX0201, and QJpUnicodeConv_Unicode_ASCII.

Definition at line 143 of file qjpunicode.cpp.

Referenced by QEucJpCodec::convertToUnicode(), QJisCodec::convertToUnicode(), jisx0208ToUnicode(), QJpUnicodeConv_Unicode_ASCII::jisx0208ToUnicode(), QJpUnicodeConv_JISX0221_JISX0201::jisx0208ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::jisx0208ToUnicode(), QJpUnicodeConv_Sun::jisx0208ToUnicode(), QJpUnicodeConv_Microsoft::jisx0208ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::QJpUnicodeConv_JISX0221_ASCII(), QJpUnicodeConv_JISX0221_JISX0201::QJpUnicodeConv_JISX0221_JISX0201(), QJpUnicodeConv_Microsoft::QJpUnicodeConv_Microsoft(), QJpUnicodeConv_Sun::QJpUnicodeConv_Sun(), QJpUnicodeConv_Unicode_ASCII::QJpUnicodeConv_Unicode_ASCII(), and sjisToUnicode().

144 {
145  if (rule & UDC){
146  if ((0x75 <= h) && (h <= 0x7e) && IsJisChar(l)/*0x21 - 0x7e*/) {
147  // User Defined Char (mapped to Private Use Area)
148  return 0xe000 + (h - 0x75) * 0x5e + (l - 0x21);
149  }
150  }
151  if ((rule & NEC_VDC) == 0) {
152  if ((h == 0x2d) && (IsJisChar(l)/*0x21 - 0x7c*/)) {
153  // NEC Vendor Defined Char
154  return 0x0000;
155  }
156  }
157  return jisx0208ToUnicode11(h, l);
158 }
static uint jisx0208ToUnicode11(uint h, uint l)
#define IsJisChar(c)
Definition: qjpunicode.cpp:60
QFactoryLoader * l

◆ jisx0208ToUnicode() [2/2]

uint QJpUnicodeConv::jisx0208ToUnicode ( uint  jis) const
inline
Warning
This function is not part of the public interface.

Definition at line 118 of file qjpunicode.h.

118  {
119  return jisx0208ToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
120  }
virtual uint jisx0208ToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:143

◆ jisx0212ToUnicode() [1/2]

uint QJpUnicodeConv::jisx0212ToUnicode ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_Microsoft, QJpUnicodeConv_Sun, QJpUnicodeConv_JISX0221_ASCII, and QJpUnicodeConv_Unicode_ASCII.

Definition at line 161 of file qjpunicode.cpp.

Referenced by QEucJpCodec::convertToUnicode(), QJisCodec::convertToUnicode(), jisx0212ToUnicode(), QJpUnicodeConv_Unicode_ASCII::jisx0212ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::jisx0212ToUnicode(), QJpUnicodeConv_Sun::jisx0212ToUnicode(), QJpUnicodeConv_Microsoft::jisx0212ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::QJpUnicodeConv_JISX0221_ASCII(), QJpUnicodeConv_Microsoft::QJpUnicodeConv_Microsoft(), QJpUnicodeConv_Sun::QJpUnicodeConv_Sun(), and QJpUnicodeConv_Unicode_ASCII::QJpUnicodeConv_Unicode_ASCII().

162 {
163  if (rule & UDC){
164  if ((0x75 <= h) && (h <= 0x7e) && IsJisChar(l)/*0x21 - 0x7e*/) {
165  // User Defined Char (mapped to Private Use Area)
166  return 0xe3ac + (h - 0x75) * 0x5e + (l - 0x21);
167  }
168  }
169  if ((rule & IBM_VDC) == 0){
170  if (((h == 0x73) && (0x73 <= l) && (l <= 0x7e)) ||
171  ((h == 0x74) && (IsJisChar(l)/*0x21 - 0x7e*/))) {
172  // IBM Vendor Defined Char
173  return 0x0000;
174  }
175  }
176  return jisx0212ToUnicode11(h, l);
177 }
#define IsJisChar(c)
Definition: qjpunicode.cpp:60
QFactoryLoader * l
static uint jisx0212ToUnicode11(uint h, uint l)

◆ jisx0212ToUnicode() [2/2]

uint QJpUnicodeConv::jisx0212ToUnicode ( uint  jis) const
inline
Warning
This function is not part of the public interface.

Definition at line 121 of file qjpunicode.h.

121  {
122  return jisx0212ToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
123  }
virtual uint jisx0212ToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:161

◆ newConverter()

QJpUnicodeConv * QJpUnicodeConv::newConverter ( int  rule)
static
Warning
This function is not part of the public interface.

Definition at line 727 of file qjpunicode.cpp.

Referenced by QFontJis0208Codec::QFontJis0208Codec().

728 {
729  QByteArray env = qgetenv("UNICODEMAP_JP");
730  if (rule == Default && !env.isNull()) {
731  for (int i = 0; i < (int)env.length();) {
732  int j = env.indexOf(',', i);
733  QByteArray s;
734  if (j < 0) {
735  s = env.mid(i).trimmed();
736  i = env.length();
737  } else {
738  s = env.mid(i, j - i).trimmed();
739  i = j + 1;
740  }
741  if (qstricmp(s, "unicode-0.9") == 0) {
742  rule = (rule & 0xff00) | Unicode;
743  } else if (qstricmp(s, "unicode-0201") == 0) {
744  rule = (rule & 0xff00) | Unicode_JISX0201;
745  } else if (qstricmp(s, "unicode-ascii") == 0) {
746  rule = (rule & 0xff00) | Unicode_ASCII;
747  } else if (qstricmp(s, "jisx0221-1995") == 0) {
748  rule = (rule & 0xff00) | JISX0221_JISX0201;
749  } else if ((qstricmp(s, "open-0201") == 0) ||
750  (qstricmp(s, "open-19970715-0201") == 0)) {
751  rule = (rule & 0xff00) | JISX0221_JISX0201;
752  } else if ((qstricmp(s, "open-ascii") == 0) ||
753  (qstricmp(s, "open-19970715-ascii") == 0)) {
754  rule = (rule & 0xff00) | JISX0221_ASCII;
755  } else if ((qstricmp(s, "open-ms") == 0) ||
756  (qstricmp(s, "open-19970715-ms") == 0)) {
757  rule = (rule & 0xff00) | Microsoft_CP932;
758  } else if (qstricmp(s, "cp932") == 0) {
759  rule = (rule & 0xff00) | Microsoft_CP932;
760  } else if (qstricmp(s, "jdk1.1.7") == 0) {
761  rule = (rule & 0xff00) | Sun_JDK117;
762  } else if (qstricmp(s, "nec-vdc") == 0) {
763  rule = rule | NEC_VDC;
764  } else if (qstricmp(s, "ibm-vdc") == 0) {
765  rule = rule | IBM_VDC;
766  } else if (qstricmp(s, "udc") == 0) {
767  rule = rule | UDC;
768  }
769  }
770  }
771 
772  switch (rule & 0x00ff) {
773  case Unicode_JISX0201:
775  case Unicode_ASCII:
777  case JISX0221_JISX0201:
779  case JISX0221_ASCII:
781  case Sun_JDK117:
782  return new QJpUnicodeConv_Sun(rule);
783  case Microsoft_CP932:
784  return new QJpUnicodeConv_Microsoft(rule);
785  default:
787  }
788 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QByteArray trimmed() const
Returns a byte array that has whitespace removed from the start and the end.
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
int length() const
Same as size().
Definition: qbytearray.h:356
Q_CORE_EXPORT int qstricmp(const char *, const char *)

◆ sjisibmvdcToUnicode()

uint QJpUnicodeConv::sjisibmvdcToUnicode ( uint  h,
uint  l 
) const

Definition at line 10499 of file qjpunicode.cpp.

Referenced by QSjisCodec::convertToUnicode(), and unicodeToJisx0212().

10500 {
10501  if (((rule & IBM_VDC) || (rule & Microsoft_CP932)) && IsSjisIBMVDCChar1(h))
10502  return sjis208ibmvdc_unicode[((h - 0x00fa)*189 + (l-0x0040))];
10503  else
10504  return 0;
10505 }
#define IsSjisIBMVDCChar1(c)
Definition: qjpunicode.cpp:66
static unsigned short const sjis208ibmvdc_unicode[]
QFactoryLoader * l

◆ sjisToUnicode() [1/2]

uint QJpUnicodeConv::sjisToUnicode ( uint  h,
uint  l 
) const
Warning
This function is not part of the public interface.

Definition at line 264 of file qjpunicode.cpp.

Referenced by QSjisCodec::convertToUnicode(), sjisToUnicode(), and unicodeToJisx0212().

265 {
266  if (h == 0) {
267  return jisx0201ToUnicode(h, l);
268  } else if (IsSjisChar1(h) && IsSjisChar2(l)) {
269  return jisx0208ToUnicode(sjisToJisx0208(h, l));
270  }
271  return 0x0000;
272 }
virtual uint jisx0208ToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:143
#define IsSjisChar1(c)
Definition: qjpunicode.cpp:61
uint jisx0201ToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:112
static uint sjisToJisx0208(uint h, uint l)
Definition: qjpunicode.cpp:803
QFactoryLoader * l
#define IsSjisChar2(c)
Definition: qjpunicode.cpp:64

◆ sjisToUnicode() [2/2]

uint QJpUnicodeConv::sjisToUnicode ( uint  sjis) const
inline
Warning
This function is not part of the public interface.

Definition at line 158 of file qjpunicode.h.

158  {
159  return sjisToUnicode((sjis & 0xff00) >> 8, (sjis & 0x00ff));
160  }
uint sjisToUnicode(uint h, uint l) const
Definition: qjpunicode.cpp:264

◆ unicodeToAscii() [1/2]

uint QJpUnicodeConv::unicodeToAscii ( uint  h,
uint  l 
) const
virtual

◆ unicodeToAscii() [2/2]

uint QJpUnicodeConv::unicodeToAscii ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 132 of file qjpunicode.h.

132  {
133  return unicodeToAscii((unicode & 0xff00) >> 8, (unicode & 0x00ff));
134  }
virtual uint unicodeToAscii(uint h, uint l) const
Definition: qjpunicode.cpp:180

◆ unicodeToCp932()

uint QJpUnicodeConv::unicodeToCp932 ( uint  h,
uint  l 
) const

Definition at line 10604 of file qjpunicode.cpp.

Referenced by QSjisCodec::convertFromUnicode(), and unicodeToJisx0212().

10605 {
10606  if ((rule & Microsoft_CP932)) {
10607  uint u = (h<<8) | l;
10608  //since there is no direct mapping, do a linear search
10609  for (uint i =0; i<sizeof(cp932_87_unicode)/sizeof(short) ; i++) {
10610  //the table has zeros for some characters
10611  if (!cp932_87_unicode[i])
10612  return 0;
10613  if (u == cp932_87_unicode[i]){
10614  return ((0x0087<<8) | (0x0040+i));
10615  }
10616  }
10617  for (uint j =0; j<sizeof(cp932_ed_ee_unicode)/sizeof(short) ; j++) {
10618  if (!cp932_ed_ee_unicode[j])
10619  return 0;
10620  if (u==cp932_ed_ee_unicode[j]){
10621  return (((0x00ed +(j/189))<<8) | (0x0040+(j%189)));
10622  }
10623  }
10624  }
10625  return 0;
10626 }
static unsigned short const cp932_ed_ee_unicode[]
quint16 u
unsigned int uint
Definition: qglobal.h:996
QFactoryLoader * l
static unsigned short const cp932_87_unicode[]

◆ unicodeToJisx0201() [1/2]

uint QJpUnicodeConv::unicodeToJisx0201 ( uint  h,
uint  l 
) const
Warning
This function is not part of the public interface.

Definition at line 189 of file qjpunicode.cpp.

Referenced by QEucJpCodec::convertFromUnicode(), QJisCodec::convertFromUnicode(), QSjisCodec::convertFromUnicode(), jisx0212ToUnicode(), unicodeToJisx0201(), and unicodeToSjis().

190 {
191  uint jis;
192  if ((jis = unicodeToJisx0201Latin(h, l)) != 0) {
193  return jis;
194  } else if ((jis = unicodeToJisx0201Kana(h, l)) != 0) {
195  return jis;
196  }
197  return 0x0000;
198 }
uint unicodeToJisx0201Kana(uint h, uint l) const
Definition: qjpunicode.cpp:211
unsigned int uint
Definition: qglobal.h:996
QFactoryLoader * l
virtual uint unicodeToJisx0201Latin(uint h, uint l) const
Definition: qjpunicode.cpp:201

◆ unicodeToJisx0201() [2/2]

uint QJpUnicodeConv::unicodeToJisx0201 ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 135 of file qjpunicode.h.

135  {
136  return unicodeToJisx0201((unicode & 0xff00) >> 8, (unicode & 0x00ff));
137  }
uint unicodeToJisx0201(uint h, uint l) const
Definition: qjpunicode.cpp:189

◆ unicodeToJisx0201Kana() [1/2]

uint QJpUnicodeConv::unicodeToJisx0201Kana ( uint  h,
uint  l 
) const
Warning
This function is not part of the public interface.

Definition at line 211 of file qjpunicode.cpp.

Referenced by jisx0212ToUnicode(), unicodeToJisx0201(), and unicodeToJisx0201Kana().

212 {
213  uint jis = unicode11ToJisx0201(h, l);
214  if (IsKana(jis)) {
215  return jis;
216  }
217  return 0x0000;
218 }
unsigned int uint
Definition: qglobal.h:996
QFactoryLoader * l
static uint unicode11ToJisx0201(uint h, uint l)
Definition: qjpunicode.cpp:852
#define IsKana(c)
Definition: qjpunicode.cpp:59

◆ unicodeToJisx0201Kana() [2/2]

uint QJpUnicodeConv::unicodeToJisx0201Kana ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 141 of file qjpunicode.h.

141  {
142  return unicodeToJisx0201Kana((unicode & 0xff00) >> 8, (unicode & 0x00ff));
143  }
uint unicodeToJisx0201Kana(uint h, uint l) const
Definition: qjpunicode.cpp:211

◆ unicodeToJisx0201Latin() [1/2]

uint QJpUnicodeConv::unicodeToJisx0201Latin ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_Microsoft, QJpUnicodeConv_Sun, and QJpUnicodeConv_JISX0221_ASCII.

Definition at line 201 of file qjpunicode.cpp.

Referenced by jisx0212ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::QJpUnicodeConv_JISX0221_ASCII(), QJpUnicodeConv_Microsoft::QJpUnicodeConv_Microsoft(), QJpUnicodeConv_Sun::QJpUnicodeConv_Sun(), QJpUnicodeConv_JISX0221_JISX0201::unicodeToAscii(), unicodeToJisx0201(), and unicodeToJisx0201Latin().

202 {
203  uint jis = unicode11ToJisx0201(h, l);
204  if (IsLatin(jis)) {
205  return jis;
206  }
207  return 0x0000;
208 }
#define IsLatin(c)
Definition: qjpunicode.cpp:58
unsigned int uint
Definition: qglobal.h:996
QFactoryLoader * l
static uint unicode11ToJisx0201(uint h, uint l)
Definition: qjpunicode.cpp:852

◆ unicodeToJisx0201Latin() [2/2]

uint QJpUnicodeConv::unicodeToJisx0201Latin ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 138 of file qjpunicode.h.

138  {
139  return unicodeToJisx0201Latin((unicode & 0xff00) >> 8, (unicode & 0x00ff));
140  }
virtual uint unicodeToJisx0201Latin(uint h, uint l) const
Definition: qjpunicode.cpp:201

◆ unicodeToJisx0208() [1/2]

uint QJpUnicodeConv::unicodeToJisx0208 ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_Microsoft, QJpUnicodeConv_Sun, QJpUnicodeConv_JISX0221_ASCII, QJpUnicodeConv_JISX0221_JISX0201, and QJpUnicodeConv_Unicode_ASCII.

Definition at line 221 of file qjpunicode.cpp.

Referenced by QEucJpCodec::convertFromUnicode(), QJisCodec::convertFromUnicode(), jisx0212ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::QJpUnicodeConv_JISX0221_ASCII(), QJpUnicodeConv_JISX0221_JISX0201::QJpUnicodeConv_JISX0221_JISX0201(), QJpUnicodeConv_Microsoft::QJpUnicodeConv_Microsoft(), QJpUnicodeConv_Sun::QJpUnicodeConv_Sun(), QJpUnicodeConv_Unicode_ASCII::QJpUnicodeConv_Unicode_ASCII(), unicodeToJisx0208(), QJpUnicodeConv_Unicode_ASCII::unicodeToJisx0208(), QJpUnicodeConv_JISX0221_JISX0201::unicodeToJisx0208(), QJpUnicodeConv_JISX0221_ASCII::unicodeToJisx0208(), QJpUnicodeConv_Sun::unicodeToJisx0208(), QJpUnicodeConv_Microsoft::unicodeToJisx0208(), QJpUnicodeConv_Unicode_ASCII::unicodeToJisx0212(), and unicodeToSjis().

222 {
223  if (rule & UDC){
224  uint unicode = (h << 8) | l;
225  if ((0xe000 <= unicode) && (unicode <= 0xe3ab)) {
226  // User Defined Char (mapped to Private Use Area)
227  unicode -= 0xe000;
228  return ((0x75 + unicode / 0x5e) << 8) | (0x21 + unicode % 0x5e);
229  }
230  }
231  uint jis = unicode11ToJisx0208(h, l);
232  if ((rule & NEC_VDC) == 0) {
233  if ((0x2d21 <= jis) && (jis <= 0x2d7c)) {
234  // NEC Vendor Defined Char
235  return 0x0000;
236  }
237  }
238  return jis;
239 }
unsigned int uint
Definition: qglobal.h:996
QFactoryLoader * l
static uint unicode11ToJisx0208(uint h, uint l)

◆ unicodeToJisx0208() [2/2]

uint QJpUnicodeConv::unicodeToJisx0208 ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 144 of file qjpunicode.h.

144  {
145  return unicodeToJisx0208((unicode & 0xff00) >> 8, (unicode & 0x00ff));
146  }
virtual uint unicodeToJisx0208(uint h, uint l) const
Definition: qjpunicode.cpp:221

◆ unicodeToJisx0212() [1/2]

uint QJpUnicodeConv::unicodeToJisx0212 ( uint  h,
uint  l 
) const
virtual
Warning
This function is not part of the public interface.

Reimplemented in QJpUnicodeConv_Microsoft, QJpUnicodeConv_Sun, QJpUnicodeConv_JISX0221_ASCII, and QJpUnicodeConv_Unicode_ASCII.

Definition at line 242 of file qjpunicode.cpp.

Referenced by QEucJpCodec::convertFromUnicode(), QJisCodec::convertFromUnicode(), QSjisCodec::convertFromUnicode(), jisx0212ToUnicode(), QJpUnicodeConv_JISX0221_ASCII::QJpUnicodeConv_JISX0221_ASCII(), QJpUnicodeConv_Microsoft::QJpUnicodeConv_Microsoft(), QJpUnicodeConv_Sun::QJpUnicodeConv_Sun(), QJpUnicodeConv_Unicode_ASCII::QJpUnicodeConv_Unicode_ASCII(), unicodeToJisx0212(), QJpUnicodeConv_JISX0221_ASCII::unicodeToJisx0212(), QJpUnicodeConv_Sun::unicodeToJisx0212(), QJpUnicodeConv_Microsoft::unicodeToJisx0212(), and unicodeToSjis().

243 {
244  if (rule & UDC){
245  uint unicode = (h << 8) | l;
246  if ((0xe3ac <= unicode) && (unicode <= 0xe757)) {
247  // User Defined Char (mapped to Private Use Area)
248  unicode -= 0xe3ac;
249  return ((0x75 + unicode / 0x5e) << 8) | (0x21 + unicode % 0x5e);
250  }
251  }
252  uint jis = unicode11ToJisx0212(h, l);
253  if ((rule & IBM_VDC) == 0){
254  if (((0x7373 <= jis) && (jis <= 0x737e)) ||
255  ((0x7421 <= jis) && (jis <= 0x747e))) {
256  // IBM Vendor Defined Char
257  return 0x0000;
258  }
259  }
260  return jis;
261 }
static uint unicode11ToJisx0212(uint h, uint l)
unsigned int uint
Definition: qglobal.h:996
QFactoryLoader * l

◆ unicodeToJisx0212() [2/2]

uint QJpUnicodeConv::unicodeToJisx0212 ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 147 of file qjpunicode.h.

147  {
148  return unicodeToJisx0212((unicode & 0xff00) >> 8, (unicode & 0x00ff));
149  }
virtual uint unicodeToJisx0212(uint h, uint l) const
Definition: qjpunicode.cpp:242

◆ unicodeToSjis() [1/2]

uint QJpUnicodeConv::unicodeToSjis ( uint  h,
uint  l 
) const
Warning
This function is not part of the public interface.

Definition at line 275 of file qjpunicode.cpp.

Referenced by QSjisCodec::convertFromUnicode(), unicodeToJisx0212(), and unicodeToSjis().

276 {
277  uint jis;
278  if ((jis = unicodeToJisx0201(h, l)) != 0x0000) {
279  return jis;
280  } else if ((jis = unicodeToJisx0208(h, l)) != 0x0000) {
281  return jisx0208ToSjis(jis);
282  } else if ((jis = unicodeToJisx0212(h, l)) != 0x0000) {
283  return 0x0000;
284  }
285  return 0x0000;
286 }
virtual uint unicodeToJisx0212(uint h, uint l) const
Definition: qjpunicode.cpp:242
uint unicodeToJisx0201(uint h, uint l) const
Definition: qjpunicode.cpp:189
unsigned int uint
Definition: qglobal.h:996
virtual uint unicodeToJisx0208(uint h, uint l) const
Definition: qjpunicode.cpp:221
QFactoryLoader * l
static uint jisx0208ToSjis(uint h, uint l)
Definition: qjpunicode.cpp:794

◆ unicodeToSjis() [2/2]

uint QJpUnicodeConv::unicodeToSjis ( uint  unicode) const
inline
Warning
This function is not part of the public interface.

Definition at line 161 of file qjpunicode.h.

161  {
162  return unicodeToSjis((unicode & 0xff00) >> 8, (unicode & 0x00ff));
163  }
uint unicodeToSjis(uint h, uint l) const
Definition: qjpunicode.cpp:275

◆ unicodeToSjisibmvdc()

uint QJpUnicodeConv::unicodeToSjisibmvdc ( uint  h,
uint  l 
) const

Definition at line 10507 of file qjpunicode.cpp.

Referenced by QSjisCodec::convertFromUnicode(), and unicodeToJisx0212().

10508 {
10509  if ((rule & IBM_VDC) || (rule & Microsoft_CP932)) {
10510  uint u = (h<<8) | l;
10511  //since there is no direct mapping, do a linear search
10512  for (uint i =0; i<sizeof(sjis208ibmvdc_unicode)/sizeof(short) ; i++) {
10513  //the table has zeros after 0xfc4b
10514  if (!sjis208ibmvdc_unicode[i])
10515  return 0;
10516  if (u==sjis208ibmvdc_unicode[i]){
10517  return (((0x00fa +(i/189))<<8) | (0x0040+(i%189)));
10518  }
10519  }
10520  }
10521  return 0;
10522 }
quint16 u
unsigned int uint
Definition: qglobal.h:996
static unsigned short const sjis208ibmvdc_unicode[]
QFactoryLoader * l

Properties

◆ rule

int QJpUnicodeConv::rule
private

The documentation for this class was generated from the following files: