The QTextCodecPlugin class provides an abstract base for custom QTextCodec 插件。 更多...
| 頭: | #include <QTextCodecPlugin> |
| 繼承: | QObject |
注意: 此類的所有函數 可重入 .
| QTextCodecPlugin (QObject * parent = 0) | |
| ~QTextCodecPlugin () | |
| virtual QList<QByteArray> | aliases () const = 0 |
| virtual QTextCodec * | createForMib (int mib ) = 0 |
| virtual QTextCodec * | createForName (const QByteArray & name ) = 0 |
| virtual QList<int> | mibEnums () const = 0 |
| virtual QList<QByteArray> | 名稱 () const = 0 |
The QTextCodecPlugin class provides an abstract base for custom QTextCodec 插件。
The text codec plugin is a simple plugin interface that makes it easy to create custom text codecs that can be loaded dynamically into applications.
Writing a text codec plugin is achieved by subclassing this base class, reimplementing the pure virtual functions 名稱 (), aliases (), createForName (), mibEnums () 和 createForMib (),和導齣類采用 Q_EXPORT_PLUGIN2 () macro. See 如何創建 Qt 插件 瞭解細節。
見 IANA character-sets encoding file for more information on mime names and mib enums.
Constructs a text codec plugin with the given parent . This is invoked automatically by the Q_EXPORT_PLUGIN2 () 宏。
Destroys the text codec plugin.
從不需要明確調用這。Qt 自動銷毀插件當不再使用時。
[pure virtual]
QList
<
QByteArray
> QTextCodecPlugin::
aliases
() const
Returns the list of aliases supported by this plugin.
[pure virtual]
QTextCodec
* QTextCodecPlugin::
createForMib
(
int
mib
)
創建 QTextCodec object for the mib enum mib .
見 the IANA character-sets encoding file 瞭解更多信息。
另請參閱 mibEnums ().
[pure virtual]
QTextCodec
* QTextCodecPlugin::
createForName
(const
QByteArray
&
name
)
創建 QTextCodec object for the codec called name 。 name must come from the list of encodings returned by 名稱 (). Encoding names are case sensitive.
範例:
QList<QByteArray> MyCodecPlugin::names() const { return QList<QByteArray> << "IBM01140" << "hp15-tw"; } QTextCodec *MyCodecPlugin::createForName(const QByteArray &name) { if (name == "IBM01140") { return new Ibm01140Codec; } else if (name == "hp15-tw") { return new Hp15TwCodec; } return 0; }
另請參閱 名稱 ().
[pure virtual]
QList
<
int
> QTextCodecPlugin::
mibEnums
() const
Returns the list of mib enums supported by this plugin.
另請參閱 createForMib ().
[pure virtual]
QList
<
QByteArray
> QTextCodecPlugin::
名稱
() const
Returns the list of MIME names supported by this plugin.
If a codec has several names, the extra names are returned by aliases ().
另請參閱 createForName () 和 aliases ().