Qt 4.8
Classes | Public Functions | Static Public Functions | Properties | List of all members
QIconvCodec Class Reference

#include <qiconvcodec_p.h>

Inheritance diagram for QIconvCodec:
QTextCodec

Classes

class  IconvState
 

Public Functions

QByteArray convertFromUnicode (const QChar *, int, ConverterState *) const
 QTextCodec subclasses must reimplement this function. More...
 
QString convertToUnicode (const char *, int, ConverterState *) const
 QTextCodec subclasses must reimplement this function. More...
 
int mibEnum () const
 Subclasses of QTextCodec must reimplement this function. More...
 
QByteArray name () const
 QTextCodec subclasses must reimplement this function. More...
 
 QIconvCodec ()
 
 ~QIconvCodec ()
 
- Public Functions inherited from QTextCodec
virtual QList< QByteArrayaliases () const
 Subclasses can return a number of aliases for the codec in question. More...
 
bool canEncode (QChar) const
 Returns true if the Unicode character ch can be fully encoded with this codec; otherwise returns false. More...
 
bool canEncode (const QString &) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.s contains the string being tested for encode-ability. More...
 
QByteArray fromUnicode (const QString &uc) const
 Converts str from Unicode to the encoding of this codec, and returns the result in a QByteArray. More...
 
QByteArray fromUnicode (const QChar *in, int length, ConverterState *state=0) const
 Converts the first number of characters from the input array from Unicode to the encoding of this codec, and returns the result in a QByteArray. More...
 
QTextDecodermakeDecoder () const
 Creates a QTextDecoder which stores enough state to decode chunks of char * data to create chunks of Unicode data. More...
 
QTextDecodermakeDecoder (ConversionFlags flags) const
 
QTextEncodermakeEncoder () const
 Creates a QTextEncoder which stores enough state to encode chunks of Unicode data as char * data. More...
 
QTextEncodermakeEncoder (ConversionFlags flags) const
 
QString toUnicode (const QByteArray &) const
 Converts a from the encoding of this codec to Unicode, and returns the result in a QString. More...
 
QString toUnicode (const char *chars) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.chars contains the source characters. More...
 
QString toUnicode (const char *in, int length, ConverterState *state=0) const
 Converts the first size characters from the input from the encoding of this codec to Unicode, and returns the result in a QString. More...
 

Static Public Functions

static iconv_t createIconv_t (const char *to, const char *from)
 
- Static Public Functions inherited from QTextCodec
static QList< QByteArrayavailableCodecs ()
 Returns the list of all available codecs, by name. More...
 
static QList< int > availableMibs ()
 Returns the list of MIBs for all available codecs. More...
 
static QTextCodeccodecForCStrings ()
 Returns the codec used by QString to convert to and from const char * and QByteArrays. More...
 
static QTextCodeccodecForHtml (const QByteArray &ba)
 Tries to detect the encoding of the provided snippet of HTML in the given byte array, ba, by checking the BOM (Byte Order Mark) and the content-type meta header and returns a QTextCodec instance that is capable of decoding the html to unicode. More...
 
static QTextCodeccodecForHtml (const QByteArray &ba, QTextCodec *defaultCodec)
 Tries to detect the encoding of the provided snippet of HTML in the given byte array, ba, by checking the BOM (Byte Order Mark) and the content-type meta header and returns a QTextCodec instance that is capable of decoding the html to unicode. More...
 
static QTextCodeccodecForLocale ()
 Returns a pointer to the codec most suitable for this locale. More...
 
static QTextCodeccodecForMib (int mib)
 Returns the QTextCodec which matches the MIBenum mib. More...
 
static QTextCodeccodecForName (const QByteArray &name)
 Searches all installed QTextCodec objects and returns the one which best matches name; the match is case-insensitive. More...
 
static QTextCodeccodecForName (const char *name)
 Searches all installed QTextCodec objects and returns the one which best matches name; the match is case-insensitive. More...
 
static QTextCodeccodecForTr ()
 Returns the codec used by QObject::tr() on its argument. More...
 
static QTextCodeccodecForUtfText (const QByteArray &ba)
 Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and returns a QTextCodec instance that is capable of decoding the text to unicode. More...
 
static QTextCodeccodecForUtfText (const QByteArray &ba, QTextCodec *defaultCodec)
 Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and returns a QTextCodec instance that is capable of decoding the text to unicode. More...
 
static void setCodecForCStrings (QTextCodec *c)
 
static void setCodecForLocale (QTextCodec *c)
 Set the codec to c; this will be returned by codecForLocale(). More...
 
static void setCodecForTr (QTextCodec *c)
 

Properties

QTextCodecutf16Codec
 

Additional Inherited Members

- Public Types inherited from QTextCodec
enum  ConversionFlag { DefaultConversion, ConvertInvalidToNull = 0x80000000, IgnoreHeader = 0x1, FreeFunction = 0x2 }
 
- Protected Functions inherited from QTextCodec
 QTextCodec ()
 Constructs a QTextCodec, and gives it the highest precedence. More...
 
virtual ~QTextCodec ()
 Destroys the QTextCodec. More...
 

Detailed Description

Definition at line 68 of file qiconvcodec_p.h.

Constructors and Destructors

◆ QIconvCodec()

QIconvCodec::QIconvCodec ( )

Definition at line 93 of file qiconvcodec.cpp.

94  : utf16Codec(0)
95 {
98  "QIconvCodec::convertToUnicode",
99  "internal error, UTF-16 codec not found");
100  if (!utf16Codec) {
101  fprintf(stderr, "QIconvCodec::convertToUnicode: internal error, UTF-16 codec not found\n");
102  utf16Codec = reinterpret_cast<QTextCodec *>(~0);
103  }
104 #if defined(Q_OS_MAC)
105  if (ptr_iconv_open == 0) {
106  QLibrary libiconv(QLatin1String("/usr/lib/libiconv"));
107  libiconv.setLoadHints(QLibrary::ExportExternalSymbolsHint);
108 
109  ptr_iconv_open = reinterpret_cast<Ptr_iconv_open>(libiconv.resolve("libiconv_open"));
110  if (!ptr_iconv_open)
111  ptr_iconv_open = reinterpret_cast<Ptr_iconv_open>(libiconv.resolve("iconv_open"));
112  ptr_iconv = reinterpret_cast<Ptr_iconv>(libiconv.resolve("libiconv"));
113  if (!ptr_iconv)
114  ptr_iconv = reinterpret_cast<Ptr_iconv>(libiconv.resolve("iconv"));
115  ptr_iconv_close = reinterpret_cast<Ptr_iconv_close>(libiconv.resolve("libiconv_close"));
116  if (!ptr_iconv_close)
117  ptr_iconv_close = reinterpret_cast<Ptr_iconv_close>(libiconv.resolve("iconv_close"));
118 
120  "QIconvCodec::QIconvCodec()",
121  "internal error, could not resolve the iconv functions");
122 
123 # undef iconv_open
124 # define iconv_open ptr_iconv_open
125 # undef iconv
126 # define iconv ptr_iconv
127 # undef iconv_close
128 # define iconv_close ptr_iconv_close
129  }
130 #endif
131 }
static Ptr_iconv ptr_iconv
Definition: qiconvcodec.cpp:85
QTextCodec * utf16Codec
Definition: qiconvcodec_p.h:71
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
iconv_t(* Ptr_iconv_open)(const char *, const char *)
Definition: qiconvcodec.cpp:80
static QTextCodec * codecForMib(int mib)
Returns the QTextCodec which matches the MIBenum mib.
static Ptr_iconv_open ptr_iconv_open
Definition: qiconvcodec.cpp:84
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
static Ptr_iconv_close ptr_iconv_close
Definition: qiconvcodec.cpp:86
int(* Ptr_iconv_close)(iconv_t)
Definition: qiconvcodec.cpp:82
The QTextCodec class provides conversions between text encodings.
Definition: qtextcodec.h:62
size_t(* Ptr_iconv)(iconv_t, const char **, size_t *, char **, size_t *)
Definition: qiconvcodec.cpp:81
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62

◆ ~QIconvCodec()

QIconvCodec::~QIconvCodec ( )

Definition at line 133 of file qiconvcodec.cpp.

134 {
135 }

Functions

◆ convertFromUnicode()

QByteArray QIconvCodec::convertFromUnicode ( const QChar input,
int  number,
ConverterState state 
) const
virtual

QTextCodec subclasses must reimplement this function.

Converts the first number of characters from the input array from Unicode to the encoding of the subclass, and returns the result in a QByteArray.

state can be 0 in which case the conversion is stateless and default conversion rules should be used. If state is not 0, the codec should save the state after the conversion in state, and adjust the remainingChars and invalidChars members of the struct.

Implements QTextCodec.

Definition at line 335 of file qiconvcodec.cpp.

336 {
337  char *inBytes;
338  char *outBytes;
339  size_t inBytesLeft;
340 
341 #if defined(GNU_LIBICONV)
342  const char **inBytesPtr = const_cast<const char **>(&inBytes);
343 #else
344  char **inBytesPtr = &inBytes;
345 #endif
346 
347  IconvState *temporaryState = 0;
348  QThreadStorage<QIconvCodec::IconvState *> *ts = fromUnicodeState();
349  IconvState *&state = (qt_locale_initialized && ts) ? ts->localData() : temporaryState;
350  if (!state) {
352  if (cd != reinterpret_cast<iconv_t>(-1)) {
353  if (!setByteOrder(cd)) {
354  perror("QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for BOM");
355 
356  iconv_close(cd);
357  cd = reinterpret_cast<iconv_t>(-1);
358 
359  return QString(uc, len).toLatin1();
360  }
361  }
362  state = new IconvState(cd);
363  }
364  if (state->cd == reinterpret_cast<iconv_t>(-1)) {
365  static int reported = 0;
366  if (!reported++) {
367  fprintf(stderr,
368  "QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed\n");
369  }
370  delete temporaryState;
371  return QString(uc, len).toLatin1();
372  }
373 
374  size_t outBytesLeft = len;
375  QByteArray ba(outBytesLeft, Qt::Uninitialized);
376  outBytes = ba.data();
377 
378  // now feed iconv() the real data
379  inBytes = const_cast<char *>(reinterpret_cast<const char *>(uc));
380  inBytesLeft = len * sizeof(QChar);
381 
382  QByteArray in;
383  if (convState && convState->remainingChars) {
384  // we have one surrogate char to be prepended
385  in.resize(sizeof(QChar) + len);
386  inBytes = in.data();
387 
388  QChar remaining = convState->state_data[0];
389  memcpy(in.data(), &remaining, sizeof(QChar));
390  memcpy(in.data() + sizeof(QChar), uc, inBytesLeft);
391 
392  inBytesLeft += sizeof(QChar);
393  convState->remainingChars = 0;
394  }
395 
396  int invalidCount = 0;
397  while (inBytesLeft != 0) {
398  if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) {
399  if (errno == EINVAL && convState) {
400  // buffer ends in a surrogate
401  Q_ASSERT(inBytesLeft == 2);
402  convState->remainingChars = 1;
403  convState->state_data[0] = uc[len - 1].unicode();
404  break;
405  }
406 
407  switch (errno) {
408  case EILSEQ:
409  ++invalidCount;
410  // fall through
411  case EINVAL:
412  {
413  inBytes += sizeof(QChar);
414  inBytesLeft -= sizeof(QChar);
415  break;
416  }
417  case E2BIG:
418  {
419  int offset = ba.size() - outBytesLeft;
420  ba.resize(ba.size() * 2);
421  outBytes = ba.data() + offset;
422  outBytesLeft = ba.size() - offset;
423  break;
424  }
425  default:
426  {
427  // note, cannot use qWarning() since we are implementing the codecForLocale :)
428  perror("QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed");
429 
430  // reset to initial state
431  iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
432 
433  delete temporaryState;
434  return QString(uc, len).toLatin1();
435  }
436  }
437  }
438  }
439 
440  // reset to initial state
441  iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
442  setByteOrder(state->cd);
443 
444  ba.resize(ba.size() - outBytesLeft);
445 
446  if (convState)
447  convState->invalidChars = invalidCount;
448 
449  delete temporaryState;
450  return ba;
451 }
#define iconv_close
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QString class provides a Unicode character string.
Definition: qstring.h:83
static bool setByteOrder(iconv_t cd)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
#define iconv
T & localData()
Returns a reference to the data that was set by the calling thread.
void * iconv_t
Definition: qiconvcodec_p.h:61
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
void resize(int size)
Sets the size of the byte array to size bytes.
bool qt_locale_initialized
The QThreadStorage class provides per-thread data storage.
#define UTF16
Definition: qiconvcodec.cpp:68
int errno
static iconv_t createIconv_t(const char *to, const char *from)

◆ convertToUnicode()

QString QIconvCodec::convertToUnicode ( const char *  chars,
int  len,
ConverterState state 
) const
virtual

QTextCodec subclasses must reimplement this function.

Converts the first len characters of chars from the encoding of the subclass to Unicode, and returns the result in a QString.

state can be 0, in which case the conversion is stateless and default conversion rules should be used. If state is not 0, the codec should save the state after the conversion in state, and adjust the remainingChars and invalidChars members of the struct.

Implements QTextCodec.

Definition at line 168 of file qiconvcodec.cpp.

169 {
170  if (utf16Codec == reinterpret_cast<QTextCodec *>(~0))
171  return QString::fromLatin1(chars, len);
172 
173  int invalidCount = 0;
174  int remainingCount = 0;
175  char *remainingBuffer = 0;
176  IconvState *temporaryState = 0;
177  IconvState **pstate;
178 
179  if (convState) {
180  // stateful conversion
181  pstate = reinterpret_cast<IconvState **>(&convState->d);
182  if (convState->d) {
183  // restore state
184  remainingCount = convState->remainingChars;
185  remainingBuffer = (*pstate)->buffer;
186  } else {
187  // first time
188  convState->flags |= FreeFunction;
190  }
191  } else {
192  QThreadStorage<QIconvCodec::IconvState *> *ts = toUnicodeState();
193  if (!qt_locale_initialized || !ts) {
194  // we're running after the Q_GLOBAL_STATIC has been deleted
195  // or before the QCoreApplication initialization
196  // bad programmer, no cookie for you
197  pstate = &temporaryState;
198  } else {
199  // stateless conversion -- use thread-local data
200  pstate = &toUnicodeState()->localData();
201  }
202  }
203 
204  if (!*pstate) {
205  // first time, create the state
207  if (cd == reinterpret_cast<iconv_t>(-1)) {
208  static int reported = 0;
209  if (!reported++) {
210  fprintf(stderr,
211  "QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed\n");
212  }
213  return QString::fromLatin1(chars, len);
214  }
215 
216  *pstate = new IconvState(cd);
217  }
218 
219  IconvState *state = *pstate;
220  size_t inBytesLeft = len;
221  // best case assumption, each byte is converted into one UTF-16 character, plus 2 bytes for the BOM
222 #ifdef GNU_LIBICONV
223  // GNU doesn't disagree with POSIX :/
224  const char *inBytes = chars;
225 #else
226  char *inBytes = const_cast<char *>(chars);
227 #endif
228 
229  QByteArray in;
230  if (remainingCount) {
231  // we have to prepend the remaining bytes from the previous conversion
232  inBytesLeft += remainingCount;
233  in.resize(inBytesLeft);
234  inBytes = in.data();
235 
236  memcpy(in.data(), remainingBuffer, remainingCount);
237  memcpy(in.data() + remainingCount, chars, len);
238 
239  remainingCount = 0;
240  }
241 
242  size_t outBytesLeft = len * 2 + 2;
243  QByteArray ba(outBytesLeft, Qt::Uninitialized);
244  char *outBytes = ba.data();
245  do {
246  size_t ret = iconv(state->cd, &inBytes, &inBytesLeft, &outBytes, &outBytesLeft);
247  if (ret == (size_t) -1) {
248  if (errno == E2BIG) {
249  int offset = ba.size() - outBytesLeft;
250  ba.resize(ba.size() * 2);
251  outBytes = ba.data() + offset;
252  outBytesLeft = ba.size() - offset;
253 
254  continue;
255  }
256 
257  if (errno == EILSEQ) {
258  // conversion stopped because of an invalid character in the sequence
259  ++invalidCount;
260  } else if (errno == EINVAL && convState) {
261  // conversion stopped because the remaining inBytesLeft make up
262  // an incomplete multi-byte sequence; save them for later
263  state->saveChars(inBytes, inBytesLeft);
264  remainingCount = inBytesLeft;
265  break;
266  }
267 
268  if (errno == EILSEQ || errno == EINVAL) {
269  // skip the next character
270  ++inBytes;
271  --inBytesLeft;
272  continue;
273  }
274 
275  // some other error
276  // note, cannot use qWarning() since we are implementing the codecForLocale :)
277  perror("QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv failed");
278 
279  if (!convState) {
280  // reset state
281  iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
282  }
283 
284  delete temporaryState;
285  return QString::fromLatin1(chars, len);
286  }
287  } while (inBytesLeft != 0);
288 
289  QString s;
290 
291  if (convState) {
292  s = utf16Codec->toUnicode(ba.constData(), ba.size() - outBytesLeft, &state->internalState);
293 
294  convState->invalidChars = invalidCount;
295  convState->remainingChars = remainingCount;
296  } else {
297  s = utf16Codec->toUnicode(ba.constData(), ba.size() - outBytesLeft);
298 
299  // reset state
300  iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
301  }
302 
303  delete temporaryState;
304  return s;
305 }
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
QTextCodec * utf16Codec
Definition: qiconvcodec_p.h:71
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define iconv
void * iconv_t
Definition: qiconvcodec_p.h:61
QString toUnicode(const QByteArray &) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString...
static void qIconvCodecStateFree(QTextCodec::ConverterState *state)
static void encode(uint *dst, QTextCodecStateFreeFunction fn)
Definition: qtextcodec_p.h:73
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
void resize(int size)
Sets the size of the byte array to size bytes.
bool qt_locale_initialized
The QThreadStorage class provides per-thread data storage.
#define UTF16
Definition: qiconvcodec.cpp:68
int errno
static iconv_t createIconv_t(const char *to, const char *from)

◆ createIconv_t()

iconv_t QIconvCodec::createIconv_t ( const char *  to,
const char *  from 
)
static

Definition at line 463 of file qiconvcodec.cpp.

Referenced by convertFromUnicode(), and convertToUnicode().

464 {
465  Q_ASSERT((to == 0 && from != 0) || (to != 0 && from == 0));
466 
467  iconv_t cd = (iconv_t) -1;
468 #if defined(__GLIBC__) || defined(GNU_LIBICONV) || defined(Q_OS_QNX)
469 #if defined(Q_OS_QNX)
470  // on QNX the default locale is UTF-8, and an empty string will cause iconv_open to fail
471  static const char empty_codeset[] = "UTF-8";
472 #else
473  // both GLIBC and libgnuiconv will use the locale's encoding if from or to is an empty string
474  static const char empty_codeset[] = "";
475 #endif
476  const char *codeset = empty_codeset;
477  cd = iconv_open(to ? to : codeset, from ? from : codeset);
478 #else
479  char *codeset = 0;
480 #endif
481 
482 #if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)
483  if (cd == (iconv_t) -1) {
484  codeset = nl_langinfo(CODESET);
485  if (codeset)
486  cd = iconv_open(to ? to : codeset, from ? from : codeset);
487  }
488 #endif
489 
490  if (cd == (iconv_t) -1) {
491  // Very poorly defined and followed standards causes lots of
492  // code to try to get all the cases... This logic is
493  // duplicated in QTextCodec, so if you change it here, change
494  // it there too.
495 
496  // Try to determine locale codeset from locale name assigned to
497  // LC_CTYPE category.
498 
499  // First part is getting that locale name. First try setlocale() which
500  // definitely knows it, but since we cannot fully trust it, get ready
501  // to fall back to environment variables.
502  char * ctype = qstrdup(setlocale(LC_CTYPE, 0));
503 
504  // Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG
505  // environment variables.
506  char * lang = qstrdup(qgetenv("LC_ALL").constData());
507  if (!lang || lang[0] == 0 || strcmp(lang, "C") == 0) {
508  if (lang) delete [] lang;
509  lang = qstrdup(qgetenv("LC_CTYPE").constData());
510  }
511  if (!lang || lang[0] == 0 || strcmp(lang, "C") == 0) {
512  if (lang) delete [] lang;
513  lang = qstrdup(qgetenv("LANG").constData());
514  }
515 
516  // Now try these in order:
517  // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15)
518  // 2. CODESET from lang if it contains a .CODESET part
519  // 3. ctype (maybe the locale is named "ISO-8859-1" or something)
520  // 4. locale (ditto)
521  // 5. check for "@euro"
522 
523  // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15)
524  codeset = ctype ? strchr(ctype, '.') : 0;
525  if (codeset && *codeset == '.') {
526  ++codeset;
527  cd = iconv_open(to ? to : codeset, from ? from : codeset);
528  }
529 
530  // 2. CODESET from lang if it contains a .CODESET part
531  codeset = lang ? strchr(lang, '.') : 0;
532  if (cd == (iconv_t) -1 && codeset && *codeset == '.') {
533  ++codeset;
534  cd = iconv_open(to ? to : codeset, from ? from : codeset);
535  }
536 
537  // 3. ctype (maybe the locale is named "ISO-8859-1" or something)
538  if (cd == (iconv_t) -1 && ctype && *ctype != 0 && strcmp (ctype, "C") != 0)
539  cd = iconv_open(to ? to : ctype, from ? from : ctype);
540 
541 
542  // 4. locale (ditto)
543  if (cd == (iconv_t) -1 && lang && *lang != 0)
544  cd = iconv_open(to ? to : lang, from ? from : lang);
545 
546  // 5. "@euro"
547  if ((cd == (iconv_t) -1 && ctype && strstr(ctype, "@euro")) || (lang && strstr(lang, "@euro")))
548  cd = iconv_open(to ? to : "ISO8859-15", from ? from : "ISO8859-15");
549 
550  delete [] ctype;
551  delete [] lang;
552  }
553 
554  return cd;
555 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void * iconv_t
Definition: qiconvcodec_p.h:61
Q_CORE_EXPORT char * qstrdup(const char *)
#define iconv_open

◆ mibEnum()

int QIconvCodec::mibEnum ( ) const
virtual

Subclasses of QTextCodec must reimplement this function.

It returns the MIBenum (see IANA character-sets encoding file for more information). It is important that each QTextCodec subclass returns the correct unique value for this function.

Implements QTextCodec.

Definition at line 458 of file qiconvcodec.cpp.

459 {
460  return 0;
461 }

◆ name()

QByteArray QIconvCodec::name ( ) const
virtual

QTextCodec subclasses must reimplement this function.

It returns the name of the encoding supported by the subclass.

If the codec is registered as a character set in the IANA character-sets encoding file this method should return the preferred mime name for the codec if defined, otherwise its name.

Implements QTextCodec.

Definition at line 453 of file qiconvcodec.cpp.

454 {
455  return "System";
456 }

Properties

◆ utf16Codec

QTextCodec* QIconvCodec::utf16Codec
mutableprivate

Definition at line 71 of file qiconvcodec_p.h.

Referenced by convertToUnicode(), and QIconvCodec().


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