Definition at line 953 of file qtextcodec.cpp.
QTextCodecFromIOD::QTextCodecFromIOD |
( |
QIODevice * |
iod | ) |
|
|
inline |
Definition at line 973 of file qtextcodec.cpp.
986 while (iod->
readLine(line,maxlen) > 0) {
987 if (0==
qstrnicmp(line,
"<code_set_name>",15))
989 else if (0==
qstrnicmp(line,
"<escape_char> ",14))
991 else if (0==
qstrnicmp(line,
"<comment_char> ",15))
993 else if (line[0]==comm && 0==
qstrnicmp(line+1,
" alias ",7)) {
995 }
else if (0==
qstrnicmp(line,
"CHARMAP",7)) {
998 for (
int i=0; i<256; i++)
1005 }
else if (0==
qstrnicmp(line,
"END CHARMAP",11))
1008 char* cursor =
line;
1009 int byte=0,unicode=-1;
1016 if (cursor[0]==
'<' && cursor[1]==
'U' &&
1017 cursor[2]>=
'0' && cursor[2]<=
'9' &&
1018 cursor[3]>=
'0' && cursor[3]<=
'9') {
1020 unicode = (
int)strtol(cursor+2,&cursor,16);
1022 }
else if (*cursor==esc) {
1026 if ( *cursor == esc ) {
1030 for (
int i=0; i<256; i++) {
1041 while ( nmb < maxmb && *cursor == esc ) {
1063 if (unicode >= 0 && unicode <= 0xffff)
1068 for (
int i=0; i<256; i++)
1075 for (
int i=0; i<256; i++)
1080 for (
int i=0; i<256; i++)
1086 *mb_unicode = unicode;
QMultiByteUnicodeTable * multibyte
QCString stripWhiteSpace() const
QMultiByteUnicodeTable * to_unicode_multibyte
static int getByte(char *&cursor)
The QChar class provides a light-weight Unicode character.
char *** from_unicode_page_multibyte
static constexpr double mb
void append(const type *d)
virtual int readLine(char *data, uint maxlen)
char ** from_unicode_page
byte_as<> byte
Type of data size stored in bytes, in long long precision.
void line(double t, double *p, double &x, double &y, double &z)
char * qstrdup(const char *str)
int qstrnicmp(const char *str1, const char *str2, uint len)
QTextCodecFromIOD::~QTextCodecFromIOD |
( |
| ) |
|
|
inline |
Definition at line 1103 of file qtextcodec.cpp.
1106 for (
int i=0; i<256; i++)
1111 for (
int i=0; i<256; i++)
1113 for (
int j=0; j<256; j++)
QMultiByteUnicodeTable * to_unicode_multibyte
char *** from_unicode_page_multibyte
char ** from_unicode_page
QCString QTextCodecFromIOD::fromUnicode |
( |
const QString & |
uc, |
|
|
int & |
lenInOut |
|
) |
| const |
|
inlinevirtual |
Subclasses of QTextCodec must reimplement either this function or makeEncoder(). It converts the first lenInOut characters of uc from Unicode to the encoding of the subclass. If lenInOut is negative or too large, the length of uc is used instead.
The value returned is the property of the caller, which is responsible for deleting it with "delete []". The length of the resulting Unicode character sequence is returned in lenInOut.
The default implementation makes an encoder with makeEncoder() and converts the input with that. Note that the default makeEncoder() implementation makes an encoder that simply calls this function, hence subclasses must reimplement one function or the other to avoid infinite recursion.
Reimplemented from QTextCodec.
Definition at line 1189 of file qtextcodec.cpp.
1191 if (lenInOut > (
int)uc.
length())
1195 char* cursor = rstr.rawData();
1199 for (
int i=0; i<
l; i++) {
The QChar class provides a light-weight Unicode character.
char *** from_unicode_page_multibyte
char ** from_unicode_page
QT_STATIC_CONST QChar null
int QTextCodecFromIOD::heuristicContentMatch |
( |
const char * |
chars, |
|
|
int |
len |
|
) |
| const |
|
inlinevirtual |
Subclasses of QTextCodec must reimplement this function. It examines the first len bytes of chars and returns a value indicating how likely it is that the string is a prefix of text encoded in the encoding of the subclass. Any negative return value indicates that the text is detectably not in the encoding (eg. it contains undefined characters). A return value of 0 indicates that the text should be decoded with this codec rather than as ASCII, but there is no particular evidence. The value should range up to len. Thus, most decoders will return -1, 0, or -len.
The characters are not null terminated.
- See also
- codecForContent().
Implements QTextCodec.
Definition at line 1146 of file qtextcodec.cpp.
int QTextCodecFromIOD::heuristicNameMatch |
( |
const char * |
hint | ) |
const |
|
inlinevirtual |
Returns a value indicating how likely this decoder is for decoding some format that has the given name.
A good match returns a positive number around the length of the string. A bad match is negative.
The default implementation calls simpleHeuristicNameMatch() with the name of the codec.
Reimplemented from QTextCodec.
Definition at line 1151 of file qtextcodec.cpp.
1156 while ((a=it.current())) {
static int simpleHeuristicNameMatch(const char *name, const char *hint)
virtual int heuristicNameMatch(const char *hint) const
Creates a QTextDecoder which stores enough state to decode chunks of char* data to create chunks of Unicode data. The default implementation creates a stateless decoder, which is sufficient for only the simplest encodings where each byte corresponds to exactly one Unicode character.
The caller is responsible for deleting the returned object.
Reimplemented from QTextCodec.
Definition at line 1128 of file qtextcodec.cpp.
virtual QTextDecoder * makeDecoder() const
friend class QTextCodecFromIODDecoder
int QTextCodecFromIOD::mibEnum |
( |
| ) |
const |
|
inlinevirtual |
const char* QTextCodecFromIOD::name |
( |
| ) |
const |
|
inlinevirtual |
Subclasses of QTextCodec must reimplement this function. It returns the name of the encoding supported by the subclass. When choosing a name for an encoding, consider these points:
-
On X11, heuristicNameMatch( const char * hint ) is used to test if a the QTextCodec can convert between Unicode and the encoding of a font with encoding hint, such as "iso8859-1" for Latin-1 fonts, "koi8-r" for Russian KOI8 fonts. The default algorithm of heuristicNameMatch() uses name().
-
Some applications may use this function to present encodings to the end user.
Implements QTextCodec.
Definition at line 1136 of file qtextcodec.cpp.
bool QTextCodecFromIOD::ok |
( |
| ) |
const |
|
inline |
bool QTextCodecFromIOD::stateless |
( |
| ) |
const |
|
inlineprivate |
Definition at line 970 of file qtextcodec.cpp.
QMultiByteUnicodeTable * to_unicode_multibyte
QString QTextCodecFromIOD::toUnicode |
( |
const char * |
chars, |
|
|
int |
len |
|
) |
| const |
|
inlinevirtual |
Subclasses of QTextCodec must reimplement this function or makeDecoder(). It converts the first len characters of chars to Unicode.
The default implementation makes a decoder with makeDecoder() and converts the input with that. Note that the default makeDecoder() implementation makes a decoder that simply calls this function, hence subclasses must reimplement one function or the other to avoid infinite recursion.
Reimplemented from QTextCodec.
Definition at line 1165 of file qtextcodec.cpp.
QMultiByteUnicodeTable * multibyte
QMultiByteUnicodeTable * to_unicode_multibyte
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
The QChar class provides a light-weight Unicode character.
static constexpr double mb
char** QTextCodecFromIOD::from_unicode_page |
|
private |
char*** QTextCodecFromIOD::from_unicode_page_multibyte |
|
private |
int QTextCodecFromIOD::max_bytes_per_char |
|
private |
ushort* QTextCodecFromIOD::to_unicode |
|
private |
char QTextCodecFromIOD::unkn |
|
private |
The documentation for this class was generated from the following file: