/****************************************************************************
**
** Copyright (C) 1992-2004 Trolltech AS. All rights reserved.
**
** This file is part of the internationalization module of the Qt Toolkit.
**
** Licensees holding valid Qt Preview licenses may use this file in
** accordance with the Qt Preview License Agreement provided with the
** Software.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/

#include <qtextcodecplugin.h>
#include <qtextcodec.h>
#include <qstringlist.h>

#include <private/qeucjpcodec_p.h>
#include <private/qjiscodec_p.h>
#include <private/qsjiscodec_p.h>
#include <private/qfontcodecs_p.h>


class JPTextCodecs : public QTextCodecPlugin
{
public:
    JPTextCodecs() {}

    QStringList names() const { return QStringList() << "eucJP" << "JIS7" << "SJIS" << "jisx0208.1983-0"; }
    QList<int> mibEnums() const { return QList<int>() << 16 << 17 << 18 << 63; }
    QTextCodec *createForMib(int);
    QTextCodec *createForName(const QString &);
};

QTextCodec *JPTextCodecs::createForMib(int mib)
{
    switch (mib) {
    case 16:
        return new QJisCodec;
    case 17:
        return new QSjisCodec;
    case 18:
        return new QEucJpCodec;
    case 63:
        return new QFontJis0208Codec;
    default:
        ;
    }

    return 0;
}


QTextCodec *JPTextCodecs::createForName(const QString &name)
{
    if (name == "JIS7")
        return new QJisCodec;
    if (name == "SJIS")
        return new QSjisCodec;
    if (name == "eucJP")
        return new QEucJpCodec;
    if (name == "jisx0208.1983-0")
        return new QFontJis0208Codec;

    return 0;
}


Q_EXPORT_PLUGIN(JPTextCodecs);
