Qt 4.8
Macros | Typedefs | Functions | Variables
qiconvcodec.cpp File Reference
#include "qiconvcodec_p.h"
#include "qtextcodec_p.h"
#include <qlibrary.h>
#include <qdebug.h>
#include <qthreadstorage.h>
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define GNU_LIBICONV
 
#define iconv   ptr_iconv
 
#define iconv_close   ptr_iconv_close
 
#define iconv_open   ptr_iconv_open
 
#define NO_BOM
 
#define UTF16   "UTF-16BE"
 

Typedefs

typedef size_t(* Ptr_iconv) (iconv_t, const char **, size_t *, char **, size_t *)
 
typedef int(* Ptr_iconv_close) (iconv_t)
 
typedef iconv_t(* Ptr_iconv_open) (const char *, const char *)
 

Functions

static void qIconvCodecStateFree (QTextCodec::ConverterState *state)
 
static bool setByteOrder (iconv_t cd)
 

Variables

static Ptr_iconv ptr_iconv = 0
 
static Ptr_iconv_close ptr_iconv_close = 0
 
static Ptr_iconv_open ptr_iconv_open = 0
 
bool qt_locale_initialized
 

Macro Definition Documentation

◆ GNU_LIBICONV

#define GNU_LIBICONV

Definition at line 78 of file qiconvcodec.cpp.

◆ iconv

#define iconv   ptr_iconv

◆ iconv_close

#define iconv_close   ptr_iconv_close

◆ iconv_open

#define iconv_open   ptr_iconv_open

◆ NO_BOM

#define NO_BOM

Definition at line 66 of file qiconvcodec.cpp.

◆ UTF16

#define UTF16   "UTF-16BE"

Typedef Documentation

◆ Ptr_iconv

typedef size_t(* Ptr_iconv) (iconv_t, const char **, size_t *, char **, size_t *)

Definition at line 81 of file qiconvcodec.cpp.

◆ Ptr_iconv_close

typedef int(* Ptr_iconv_close) (iconv_t)

Definition at line 82 of file qiconvcodec.cpp.

◆ Ptr_iconv_open

typedef iconv_t(* Ptr_iconv_open) (const char *, const char *)

Definition at line 80 of file qiconvcodec.cpp.

Function Documentation

◆ qIconvCodecStateFree()

static void qIconvCodecStateFree ( QTextCodec::ConverterState state)
static

Definition at line 161 of file qiconvcodec.cpp.

Referenced by QIconvCodec::convertToUnicode().

162 {
163  delete reinterpret_cast<QIconvCodec::IconvState *>(state->d);
164 }

◆ setByteOrder()

static bool setByteOrder ( iconv_t  cd)
static

Definition at line 309 of file qiconvcodec.cpp.

Referenced by QIconvCodec::convertFromUnicode().

310 {
311 #if !defined(NO_BOM)
312  // give iconv() a BOM
313  char buf[4];
315 
316  char *outBytes = buf;
317  char *inBytes = reinterpret_cast<char *>(bom);
318  size_t outBytesLeft = sizeof buf;
319  size_t inBytesLeft = sizeof bom;
320 
321 #if defined(GNU_LIBICONV)
322  const char **inBytesPtr = const_cast<const char **>(&inBytes);
323 #else
324  char **inBytesPtr = &inBytes;
325 #endif
326 
327  if (iconv(cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) {
328  return false;
329  }
330 #endif // NO_BOM
331 
332  return true;
333 }
QTextStream & bom(QTextStream &stream)
Toggles insertion of the Byte Order Mark on stream when QTextStream is used with a UTF codec...
#define iconv
unsigned short ushort
Definition: qglobal.h:995

Variable Documentation

◆ ptr_iconv

Ptr_iconv ptr_iconv = 0
static

Definition at line 85 of file qiconvcodec.cpp.

Referenced by QIconvCodec::QIconvCodec().

◆ ptr_iconv_close

Ptr_iconv_close ptr_iconv_close = 0
static

Definition at line 86 of file qiconvcodec.cpp.

Referenced by QIconvCodec::QIconvCodec().

◆ ptr_iconv_open

Ptr_iconv_open ptr_iconv_open = 0
static

Definition at line 84 of file qiconvcodec.cpp.

Referenced by QIconvCodec::QIconvCodec().

◆ qt_locale_initialized

bool qt_locale_initialized