qtextcodec.3qt

来自「tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件」· 3QT 代码 · 共 238 行

3QT
238
字号
.TH QTextCodec 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQTextCodec \- Provides conversion between text encodings.SH SYNOPSIS.br.PP\fC#include <qtextcodec.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "virtual \fB~QTextCodec\fR ()".br.ti -1c.BI "virtual const char* \fBname\fR () const".br.ti -1c.BI "virtual int \fBmibEnum\fR () const".br.ti -1c.BI "virtual QTextDecoder* \fBmakeDecoder\fR () const".br.ti -1c.BI "virtual QTextEncoder* \fBmakeEncoder\fR () const".br.ti -1c.BI "virtual QString \fBtoUnicode\fR ( const char * " "chars" ", int len ) const".br.ti -1c.BI "virtual QCString \fBfromUnicode\fR ( const QString & " "uc" ", int & lenInOut ) const".br.ti -1c.BI "QCString \fBfromUnicode\fR ( const QString & uc ) const".br.ti -1c.BI "QString \fBtoUnicode\fR ( const QByteArray &, int len ) const".br.ti -1c.BI "QString \fBtoUnicode\fR ( const QByteArray & ) const".br.ti -1c.BI "QString \fBtoUnicode\fR ( const char * chars ) const".br.ti -1c.BI "virtual bool \fBcanEncode\fR ( QChar ) const".br.ti -1c.BI "virtual bool \fBcanEncode\fR ( const QString & ) const".br.ti -1c.BI "virtual int \fBheuristicContentMatch\fR ( const char * " "chars" ", int len ) const".br.ti -1c.BI "virtual int \fBheuristicNameMatch\fR ( const char * hint ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QTextCodec* \fBloadCharmap\fR ( QIODevice * )".br.ti -1c.BI "QTextCodec* \fBloadCharmapFile\fR ( QString filename )".br.ti -1c.BI "QTextCodec* \fBcodecForMib\fR ( int mib )".br.ti -1c.BI "QTextCodec* \fBcodecForName\fR ( const char * " "hint" ", int " "accuracy" "=0 )".br.ti -1c.BI "QTextCodec* \fBcodecForContent\fR ( const char * " "chars" ", int len )".br.ti -1c.BI "QTextCodec* \fBcodecForIndex\fR ( int i )".br.ti -1c.BI "QTextCodec* \fBcodecForLocale\fR ()".br.ti -1c.BI "void \fBdeleteAllCodecs\fR ()".br.ti -1c.BI "const char* \fBlocale\fR ()".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "\fBQTextCodec\fR ()".br.in -1c.SS "Static Protected Members".in +1c.ti -1c.BI "int \fBsimpleHeuristicNameMatch\fR ( const char * " "name" ", const char * hint )".br.in -1c.SH DESCRIPTIONProvides conversion between text encodings..PPBy making objects of subclasses of QTextCodec, support for new text encodings can be added to Qt..PPThe abstract virtual functions describe the encoder to the system and the coder is used as required in the different text file formats supported QTextStream and, under X11 for the locale-specific character input and output (under Windows NT codecs are not needed for GUI I/O since the system works with Unicode already)..PPMore recently created QTextCodec objects take precedence over earlier ones..SH MEMBER FUNCTION DOCUMENTATION.SH "QTextCodec::QTextCodec () \fC[protected]\fR"Constructs a QTextCodec, making it of highest precedence. The QTextCodec should always be constructed on the heap (with new), and once constructed it becomes the responsibility of Qt to delete it (which is done at QApplication destruction)..SH "QTextCodec::~QTextCodec () \fC[virtual]\fR"Destructs the QTextCodec. Note that you should not delete codecs yourself - once created they become the responsibility of Qt to delete..SH "bool QTextCodec::canEncode ( QChar ch ) const \fC[virtual]\fR"Returns TRUE if the unicode character \fIch\fR can be fully encoded with this codec. The default implementation tests if the result of toUnicode(fromUnicode(ch)) is the original \fIch.\fR Subclasses may be able to improve the efficiency..SH "bool QTextCodec::canEncode ( const QString & s ) const \fC[virtual]\fR"Returns TRUE if the unicode string \fIs\fR can be fully encoded with this codec. The default implementation tests if the result of toUnicode(fromUnicode(s)) is the original \fIs.\fR Subclasses may be able to improve the efficiency..SH "QTextCodec* QTextCodec::codecForContent ( const char * chars, int len ) \fC[static]\fR"Searches all installed QTextCodec objects, returning the one which most recognizes the given content. May return 0..PPSee also: heuristicContentMatch()..SH "QTextCodec* QTextCodec::codecForIndex ( int i ) \fC[static]\fR"Returns the QTextCodec \fIi\fR places from the more recently inserted, or NULL if there is no such QTextCodec. Thus, codecForIndex(0) returns the most recently created QTextCodec..SH "QTextCodec* QTextCodec::codecForLocale () \fC[static]\fR"Returns a pointer to the codec most suitable for this locale..SH "QTextCodec* QTextCodec::codecForMib ( int mib ) \fC[static]\fR"Returns the QTextCodec which matches the MIBenum \fImib.\fR.SH "QTextCodec* QTextCodec::codecForName ( const char * hint, int accuracy=0 ) \fC[static]\fR"Searches all installed QTextCodec objects, returning the one which best matches given name. Returns NULL if no codec has a match closeness above \fIaccuracy.\fR.PPSee also: heuristicNameMatch()..SH "void QTextCodec::deleteAllCodecs () \fC[static]\fR"Deletes all the created codecs..PP\fBWarning:\fR Do not call this function..PPQApplication calls this just before exiting, to delete any QTextCodec objects that may be lying around. Since various other classes hold pointers to QTextCodec objects, it is not safe to call this function earlier..PPIf you are using the utility classes (like QString) but not using QApplication, calling this function at the very end of your application can be helpful to chasing down memory leaks, as QTextCodec objects will not show up..SH "QCString QTextCodec::fromUnicode ( const QString & uc, int & lenInOut ) const \fC[virtual]\fR"Subclasses of QTextCodec must override either this function or makeEncoder(). It converts the first \fIlenInOut\fR characters of \fIuc\fR from Unicode to the encoding of the subclass. If \fIlenInOut\fR is negative or too large, the length of \fIuc\fR is used instead..PPThe 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 \fIlenInOut.\fR.PPThe 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 \fImust\fR reimplement one function or the other to avoid infinite recursion..SH "QCString QTextCodec::fromUnicode ( const QString & uc ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "int QTextCodec::heuristicContentMatch ( const char * chars, int len ) const \fC[virtual]\fR"Subclasses of QTextCodec must override this function. It examines the first \fIlen\fR bytes of \fIchars\fR 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 \fIlen.\fR Thus, most decoders will return -1, 0, or -\fIlen.\fR.PPThe characters are not null terminated..PPSee also: codecForContent()..SH "int QTextCodec::heuristicNameMatch ( const char * hint ) const \fC[virtual]\fR"Returns a value indicating how likely this decoder is for decoding some format that has the given name..PPA good match returns a positive number around the length of the string. A bad match is negative..PPThe default implementation calls simpleHeuristicNameMatch() with the name of the codec..SH "QTextCodec* QTextCodec::loadCharmap ( QIODevice * iod ) \fC[static]\fR"Reads a POSIX2 charmap definition from \fIiod.\fR The parser recognises the following lines:.PP.nf.br   &lt;code_set_name&gt; <i>name</i>.br   &lt;escape_char&gt; <i>character</i>.br   % alias <i>alias</i>.br   CHARMAP.br   &lt;<i>token</i>&gt; /x<i>hexbyte</i> &lt;U<i>unicode</i>&gt; ....br   &lt;<i>token</i>&gt; /d<i>decbyte</i> &lt;U<i>unicode</i>&gt; ....br   &lt;<i>token</i>&gt; /<i>octbyte</i> &lt;U<i>unicode</i>&gt; ....br   &lt;<i>token</i>&gt; /<i>any</i>/<i>any</i>... &lt;U<i>unicode</i>&gt; ....br   END CHARMAP.fi.PPThe resulting QTextCodec is returned (and also added to the global list of codecs). The name() of the result is taken from the code_set_name..PPNote that a codec constructed in this way uses much more memory and is slower than a hand-written QTextCodec subclass, since tables in code are in memory shared by all applications simultaneously using Qt..PPSee also: loadCharmapFile()..SH "QTextCodec* QTextCodec::loadCharmapFile ( QString filename ) \fC[static]\fR"A convenience function for QTextCodec::loadCharmap()..SH "const char* QTextCodec::locale () \fC[static]\fR"Returns a string representing the current language..SH "QTextDecoder* QTextCodec::makeDecoder () const \fC[virtual]\fR"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..PPThe caller is responsible for deleting the returned object..SH "QTextEncoder* QTextCodec::makeEncoder () const \fC[virtual]\fR"Creates a QTextEncoder which stores enough state to encode chunks of Unicode data as char* data. The default implementation creates a stateless encoder, which is sufficient for only the simplest encodings where each Unicode character corresponds to exactly one char..PPThe caller is responsible for deleting the returned object..SH "int QTextCodec::mibEnum () const \fC[virtual]\fR"Subclasses of QTextCodec must override this function. It returns the MIBenum (see the IANA character-sets encoding file for more information). It is important that each QTextCodec subclass return the correct unique value for this function..SH "const char* QTextCodec::name () const \fC[virtual]\fR"Subclasses of QTextCodec must override this function. It returns the name of the encoding supported by the subclass. When choosing a name for an encoding, consider these points:.TPOn X11,.IP.nf.br heuristicNameMatch(<em>charset).fi</em> is used to test if a the QTextCodec can convert between Unicode and the encoding of a font with encoding \fIcharset,\fR such as "iso8859-1" for Latin-1 fonts, "koi8-r" for Russian KOI8 fonts. The default algorithm of heuristicNameMatch() uses name()..TPSome applications may use this function to present encodings to the end user..SH "int QTextCodec::simpleHeuristicNameMatch ( const char * name, const char * hint ) \fC[static protected]\fR"A simple utility function for heuristicNameMatch() - it does some very minor character-skipping so that almost-exact matches score high..SH "QString QTextCodec::toUnicode ( const char * chars, int len ) const \fC[virtual]\fR"Subclasses of QTextCodec must override this function or makeDecoder(). It converts the first \fIlen\fR characters of \fIchars\fR to Unicode..PPThe default implementation makes an encoder with makeDecoder() and converts the input with that. Note that the default makeDecoder() implementation makes a decoder that simply calls this function, hence subclasses \fImust\fR reimplement one function or the other to avoid infinite recursion..SH "QString QTextCodec::toUnicode ( const QByteArray & a ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "QString QTextCodec::toUnicode ( const QByteArray & a, int len ) const"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "QString QTextCodec::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..SH "SEE ALSO".BR http://www.troll.no/qt/qtextcodec.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS.  See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?