1 /****************************************************************************
4 ** Definition of QTextCodec class
8 ** Copyright (C) 1998-2000 Trolltech AS. All rights reserved.
10 ** This file is part of the tools module of the Qt GUI Toolkit.
12 ** This file may be distributed under the terms of the Q Public License
13 ** as defined by Trolltech AS of Norway and appearing in the file
14 ** LICENSE.QPL included in the packaging of this file.
16 ** This file may be distributed and/or modified under the terms of the
17 ** GNU General Public License version 2 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 ** information about Qt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
33 ** Contact info@trolltech.com if any conditions of this licensing are
36 **********************************************************************/
45 #ifndef QT_NO_TEXTCODEC
50 class Q_EXPORT QTextEncoder {
52 virtual ~QTextEncoder();
53 virtual QCString fromUnicode(const QString& uc, int& lenInOut) = 0;
56 class Q_EXPORT QTextDecoder {
58 virtual ~QTextDecoder();
59 virtual QString toUnicode(const char* chars, int len) = 0;
62 class Q_EXPORT QTextCodec {
64 virtual ~QTextCodec();
67 static QTextCodec* loadCharmap(QIODevice*);
68 static QTextCodec* loadCharmapFile(QString filename);
70 static QTextCodec* codecForMib(int mib);
71 static QTextCodec* codecForName(const char* hint, int accuracy=0);
72 static QTextCodec* codecForContent(const char* chars, int len);
73 static QTextCodec* codecForIndex(int i);
74 static QTextCodec* codecForLocale();
76 static void deleteAllCodecs();
78 static const char* locale();
80 virtual const char* name() const = 0;
81 virtual int mibEnum() const = 0;
83 virtual QTextDecoder* makeDecoder() const;
84 virtual QTextEncoder* makeEncoder() const;
86 virtual QString toUnicode(const char* chars, int len) const;
87 virtual QCString fromUnicode(const QString& uc, int& lenInOut) const;
89 QCString fromUnicode(const QString& uc) const;
90 QString toUnicode(const QByteArray&, int len) const;
91 QString toUnicode(const QByteArray&) const;
92 QString toUnicode(const char* chars) const;
93 virtual bool canEncode( QChar ) const;
94 virtual bool canEncode( const QString& ) const;
96 virtual int heuristicContentMatch(const char* chars, int len) const = 0;
97 virtual int heuristicNameMatch(const char* hint) const;
101 static int simpleHeuristicNameMatch(const char* name, const char* hint);
103 #endif // QT_NO_TEXTCODEC
104 #endif // QTEXTCODEC_H