Blame qtools/qtextcodec.h

Packit 1c1d7e
/****************************************************************************
Packit 1c1d7e
** 
Packit 1c1d7e
**
Packit 1c1d7e
** Definition of QTextCodec class
Packit 1c1d7e
**
Packit 1c1d7e
** Created : 981015
Packit 1c1d7e
**
Packit 1c1d7e
** Copyright (C) 1998-2000 Trolltech AS.  All rights reserved.
Packit 1c1d7e
**
Packit 1c1d7e
** This file is part of the tools module of the Qt GUI Toolkit.
Packit 1c1d7e
**
Packit 1c1d7e
** This file may be distributed under the terms of the Q Public License
Packit 1c1d7e
** as defined by Trolltech AS of Norway and appearing in the file
Packit 1c1d7e
** LICENSE.QPL included in the packaging of this file.
Packit 1c1d7e
**
Packit 1c1d7e
** This file may be distributed and/or modified under the terms of the
Packit 1c1d7e
** GNU General Public License version 2 as published by the Free Software
Packit 1c1d7e
** Foundation and appearing in the file LICENSE.GPL included in the
Packit 1c1d7e
** packaging of this file.
Packit 1c1d7e
**
Packit 1c1d7e
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
Packit 1c1d7e
** licenses may use this file in accordance with the Qt Commercial License
Packit 1c1d7e
** Agreement provided with the Software.
Packit 1c1d7e
**
Packit 1c1d7e
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
Packit 1c1d7e
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Packit 1c1d7e
**
Packit 1c1d7e
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
Packit 1c1d7e
**   information about Qt Commercial License Agreements.
Packit 1c1d7e
** See http://www.trolltech.com/qpl/ for QPL licensing information.
Packit 1c1d7e
** See http://www.trolltech.com/gpl/ for GPL licensing information.
Packit 1c1d7e
**
Packit 1c1d7e
** Contact info@trolltech.com if any conditions of this licensing are
Packit 1c1d7e
** not clear to you.
Packit 1c1d7e
**
Packit 1c1d7e
**********************************************************************/
Packit 1c1d7e
Packit 1c1d7e
#ifndef QTEXTCODEC_H
Packit 1c1d7e
#define QTEXTCODEC_H
Packit 1c1d7e
Packit 1c1d7e
#ifndef QT_H
Packit 1c1d7e
#include "qstring.h"
Packit 1c1d7e
#endif // QT_H
Packit 1c1d7e
Packit 1c1d7e
#ifndef QT_NO_TEXTCODEC
Packit 1c1d7e
Packit 1c1d7e
class QTextCodec;
Packit 1c1d7e
class QIODevice;
Packit 1c1d7e
Packit 1c1d7e
class Q_EXPORT QTextEncoder {
Packit 1c1d7e
public:
Packit 1c1d7e
    virtual ~QTextEncoder();
Packit 1c1d7e
    virtual QCString fromUnicode(const QString& uc, int& lenInOut) = 0;
Packit 1c1d7e
};
Packit 1c1d7e
Packit 1c1d7e
class Q_EXPORT QTextDecoder {
Packit 1c1d7e
public:
Packit 1c1d7e
    virtual ~QTextDecoder();
Packit 1c1d7e
    virtual QString toUnicode(const char* chars, int len) = 0;
Packit 1c1d7e
};
Packit 1c1d7e
Packit 1c1d7e
class Q_EXPORT QTextCodec {
Packit 1c1d7e
public:
Packit 1c1d7e
    virtual ~QTextCodec();
Packit 1c1d7e
Packit 1c1d7e
#ifndef QT_NO_CODECS
Packit 1c1d7e
    static QTextCodec* loadCharmap(QIODevice*);
Packit 1c1d7e
    static QTextCodec* loadCharmapFile(QString filename);
Packit 1c1d7e
#endif
Packit 1c1d7e
    static QTextCodec* codecForMib(int mib);
Packit 1c1d7e
    static QTextCodec* codecForName(const char* hint, int accuracy=0);
Packit 1c1d7e
    static QTextCodec* codecForContent(const char* chars, int len);
Packit 1c1d7e
    static QTextCodec* codecForIndex(int i);
Packit 1c1d7e
    static QTextCodec* codecForLocale();
Packit 1c1d7e
Packit 1c1d7e
    static void deleteAllCodecs();
Packit 1c1d7e
Packit 1c1d7e
    static const char* locale();
Packit 1c1d7e
Packit 1c1d7e
    virtual const char* name() const = 0;
Packit 1c1d7e
    virtual int mibEnum() const = 0;
Packit 1c1d7e
Packit 1c1d7e
    virtual QTextDecoder* makeDecoder() const;
Packit 1c1d7e
    virtual QTextEncoder* makeEncoder() const;
Packit 1c1d7e
Packit 1c1d7e
    virtual QString toUnicode(const char* chars, int len) const;
Packit 1c1d7e
    virtual QCString fromUnicode(const QString& uc, int& lenInOut) const;
Packit 1c1d7e
Packit 1c1d7e
    QCString fromUnicode(const QString& uc) const;
Packit 1c1d7e
    QString toUnicode(const QByteArray&, int len) const;
Packit 1c1d7e
    QString toUnicode(const QByteArray&) const;
Packit 1c1d7e
    QString toUnicode(const char* chars) const;
Packit 1c1d7e
    virtual bool canEncode( QChar ) const;
Packit 1c1d7e
    virtual bool canEncode( const QString& ) const;
Packit 1c1d7e
Packit 1c1d7e
    virtual int heuristicContentMatch(const char* chars, int len) const = 0;
Packit 1c1d7e
    virtual int heuristicNameMatch(const char* hint) const;
Packit 1c1d7e
Packit 1c1d7e
protected:
Packit 1c1d7e
    QTextCodec();
Packit 1c1d7e
    static int simpleHeuristicNameMatch(const char* name, const char* hint);
Packit 1c1d7e
};
Packit 1c1d7e
#endif // QT_NO_TEXTCODEC
Packit 1c1d7e
#endif // QTEXTCODEC_H