Qt 4.8
|
The QGb2312Codec class provides conversion to and from the Chinese GB2312 encoding. More...
#include <qgb18030codec.h>
Public Functions | |
QByteArray | convertFromUnicode (const QChar *, int, ConverterState *) const |
Reimplemented 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... | |
QGb2312Codec () | |
Constructs a QGb2312Codec object. More... | |
Public Functions inherited from QGb18030Codec | |
QList< QByteArray > | aliases () const |
Subclasses can return a number of aliases for the codec in question. More... | |
QGb18030Codec () | |
Public Functions inherited from QTextCodec | |
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... | |
QTextDecoder * | makeDecoder () const |
Creates a QTextDecoder which stores enough state to decode chunks of char * data to create chunks of Unicode data. More... | |
QTextDecoder * | makeDecoder (ConversionFlags flags) const |
QTextEncoder * | makeEncoder () const |
Creates a QTextEncoder which stores enough state to encode chunks of Unicode data as char * data. More... | |
QTextEncoder * | makeEncoder (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 QList< QByteArray > | _aliases () |
static int | _mibEnum () |
static QByteArray | _name () |
Static Public Functions inherited from QGb18030Codec | |
static QList< QByteArray > | _aliases () |
static int | _mibEnum () |
static QByteArray | _name () |
Static Public Functions inherited from QTextCodec | |
static QList< QByteArray > | availableCodecs () |
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 QTextCodec * | codecForCStrings () |
Returns the codec used by QString to convert to and from const char * and QByteArrays. More... | |
static QTextCodec * | codecForHtml (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 QTextCodec * | codecForHtml (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 QTextCodec * | codecForLocale () |
Returns a pointer to the codec most suitable for this locale. More... | |
static QTextCodec * | codecForMib (int mib) |
Returns the QTextCodec which matches the MIBenum mib. More... | |
static QTextCodec * | codecForName (const QByteArray &name) |
Searches all installed QTextCodec objects and returns the one which best matches name; the match is case-insensitive. More... | |
static QTextCodec * | codecForName (const char *name) |
Searches all installed QTextCodec objects and returns the one which best matches name; the match is case-insensitive. More... | |
static QTextCodec * | codecForTr () |
Returns the codec used by QObject::tr() on its argument. More... | |
static QTextCodec * | codecForUtfText (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 QTextCodec * | codecForUtfText (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) |
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... | |
The QGb2312Codec class provides conversion to and from the Chinese GB2312 encoding.
The GB2312 encoding has been superseded by the GB18030 encoding and GB18030 is backward compatible to GB2312. For this reason the QGb2312Codec class is implemented in terms of the GB18030 codec and uses its 0xA1A1-0xFEFE subset for conversion from and to Unicode.
The QGb2312Codec is kept mainly for compatibility reasons with older software.
Definition at line 86 of file qgb18030codec.h.
QGb2312Codec::QGb2312Codec | ( | ) |
|
inlinestatic |
Definition at line 91 of file qgb18030codec.h.
Referenced by CNTextCodecs::aliases(), and CNTextCodecs::createForName().
|
static |
Definition at line 462 of file qgb18030codec.cpp.
Referenced by CNTextCodecs::createForMib(), and CNTextCodecs::mibEnums().
|
static |
Definition at line 467 of file qgb18030codec.cpp.
Referenced by CNTextCodecs::createForName(), and CNTextCodecs::names().
|
virtual |
Reimplemented Function
Reimplemented from QGb18030Codec.
Definition at line 548 of file qgb18030codec.cpp.
|
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.
Reimplemented from QGb18030Codec.
Definition at line 473 of file qgb18030codec.cpp.
|
inlinevirtual |
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.
Reimplemented from QGb18030Codec.
Definition at line 95 of file qgb18030codec.h.
|
inlinevirtual |
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.
Reimplemented from QGb18030Codec.
Definition at line 94 of file qgb18030codec.h.