| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QICUCODEC_P_H |
| 5 | #define QICUCODEC_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <private/qtextcodec_p.h> |
| 19 | |
| 20 | extern "C" { |
| 21 | typedef struct UConverter UConverter; |
| 22 | } |
| 23 | |
| 24 | QT_REQUIRE_CONFIG(textcodec); |
| 25 | |
| 26 | QT_BEGIN_NAMESPACE |
| 27 | |
| 28 | class QIcuCodec : public QTextCodec |
| 29 | { |
| 30 | public: |
| 31 | static QList<QByteArray> availableCodecs(); |
| 32 | static QList<int> availableMibs(); |
| 33 | |
| 34 | static QTextCodec *defaultCodecUnlocked(); |
| 35 | |
| 36 | static QTextCodec *codecForNameUnlocked(const char *name); |
| 37 | static QTextCodec *codecForMibUnlocked(int mib); |
| 38 | |
| 39 | QString convertToUnicode(const char *, int, ConverterState *) const override; |
| 40 | QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; |
| 41 | |
| 42 | QByteArray name() const override; |
| 43 | QList<QByteArray> aliases() const override; |
| 44 | int mibEnum() const override; |
| 45 | |
| 46 | private: |
| 47 | QIcuCodec(const char *name); |
| 48 | ~QIcuCodec(); |
| 49 | |
| 50 | UConverter *getConverter(QTextCodec::ConverterState *state) const; |
| 51 | |
| 52 | const char *m_name; |
| 53 | }; |
| 54 | |
| 55 | QT_END_NAMESPACE |
| 56 | |
| 57 | #endif |
| 58 | |