summaryrefslogtreecommitdiff
path: root/qmake/include/qtextcodec.h
Unidiff
Diffstat (limited to 'qmake/include/qtextcodec.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/qtextcodec.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/qmake/include/qtextcodec.h b/qmake/include/qtextcodec.h
new file mode 100644
index 0000000..149b5cb
--- a/dev/null
+++ b/qmake/include/qtextcodec.h
@@ -0,0 +1,114 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of QTextCodec class
5**
6** Created : 981015
7**
8** Copyright (C) 1998-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the tools module of the Qt GUI Toolkit.
11**
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.
15**
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.
20**
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.
24**
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.
27**
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.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QTEXTCODEC_H
39#define QTEXTCODEC_H
40
41#ifndef QT_H
42#include "qstring.h"
43#endif // QT_H
44
45#ifndef QT_NO_TEXTCODEC
46
47class QTextCodec;
48class QIODevice;
49class QFont;
50
51class Q_EXPORT QTextEncoder {
52public:
53 virtual ~QTextEncoder();
54 virtual QCString fromUnicode(const QString& uc, int& lenInOut) = 0;
55};
56
57class Q_EXPORT QTextDecoder {
58public:
59 virtual ~QTextDecoder();
60 virtual QString toUnicode(const char* chars, int len) = 0;
61};
62
63class Q_EXPORT QTextCodec {
64public:
65 virtual ~QTextCodec();
66
67#ifndef QT_NO_CODECS
68 static QTextCodec* loadCharmap(QIODevice*);
69 static QTextCodec* loadCharmapFile(QString filename);
70#endif //QT_NO_CODECS
71 static QTextCodec* codecForMib(int mib);
72 static QTextCodec* codecForName(const char* hint, int accuracy=0);
73 static QTextCodec* codecForContent(const char* chars, int len);
74 static QTextCodec* codecForIndex(int i);
75 static QTextCodec* codecForLocale();
76 static void setCodecForLocale(QTextCodec *c);
77
78 static void deleteAllCodecs();
79
80 static const char* locale();
81
82 virtual const char* name() const = 0;
83 virtual const char* mimeName() const;
84 virtual int mibEnum() const = 0;
85
86 virtual QTextDecoder* makeDecoder() const;
87 virtual QTextEncoder* makeEncoder() const;
88
89 virtual QString toUnicode(const char* chars, int len) const;
90 virtual QCString fromUnicode(const QString& uc, int& lenInOut) const;
91
92 QCString fromUnicode(const QString& uc) const;
93 QString toUnicode(const QByteArray&, int len) const;
94 QString toUnicode(const QByteArray&) const;
95 QString toUnicode(const QCString&, int len) const;
96 QString toUnicode(const QCString&) const;
97 QString toUnicode(const char* chars) const;
98 virtual bool canEncode( QChar ) const;
99 virtual bool canEncode( const QString& ) const;
100
101 virtual int heuristicContentMatch(const char* chars, int len) const = 0;
102 virtual int heuristicNameMatch(const char* hint) const;
103
104 virtual QByteArray fromUnicode(const QString& uc, int from, int len) const;
105 virtual unsigned short characterFromUnicode(const QString &str, int pos) const;
106
107protected:
108 QTextCodec();
109 static int simpleHeuristicNameMatch(const char* name, const char* hint);
110
111 friend class QFont;
112};
113#endif // QT_NO_TEXTCODEC
114#endif // QTEXTCODEC_H