QTextCodecPlugin Class

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.

成员函数文档编制

QTextCodecPlugin:: QTextCodecPlugin ( QObject * parent = 0)

Constructs a text codec plugin with the given parent . This is invoked automatically by the Q_EXPORT_PLUGIN2 () 宏。

QTextCodecPlugin:: ~QTextCodecPlugin ()

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 namename 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 ().