summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs/qisciicodec.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-07-25 12:54:56 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-31 11:12:51 +0200
commitbb3637d33c122a5add502239c57dff8afcc555c8 (patch)
tree12997e8caebb12e29f069c80d8b915361870620e /src/corelib/codecs/qisciicodec.cpp
parentb23f048cf9a8eca4a246c65298818c38a4338fe4 (diff)
Add a factory method to QIsciiCodec and fix the names
Make the names all lower case to be in line with what ICU reports. Add a factory method to create the codecs according to their name. Change-Id: Ia3dddaa7701a0645d9d8fbcb52f1f8d58f79cf98 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/codecs/qisciicodec.cpp')
-rw-r--r--src/corelib/codecs/qisciicodec.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/corelib/codecs/qisciicodec.cpp b/src/corelib/codecs/qisciicodec.cpp
index 723a4dcc07..1e5d5128fb 100644
--- a/src/corelib/codecs/qisciicodec.cpp
+++ b/src/corelib/codecs/qisciicodec.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include "qisciicodec_p.h"
+#include "qtextcodec_p.h"
#include "qlist.h"
#ifndef QT_NO_BIG_CODECS
@@ -59,17 +60,26 @@ struct Codecs {
};
static const Codecs codecs [] = {
- { "Iscii-Dev", 0x900 },
- { "Iscii-Bng", 0x980 },
- { "Iscii-Pnj", 0xa00 },
- { "Iscii-Gjr", 0xa80 },
- { "Iscii-Ori", 0xb00 },
- { "Iscii-Tml", 0xb80 },
- { "Iscii-Tlg", 0xc00 },
- { "Iscii-Knd", 0xc80 },
- { "Iscii-Mlm", 0xd00 }
+ { "iscii-dev", 0x900 },
+ { "iscii-bng", 0x980 },
+ { "iscii-pnj", 0xa00 },
+ { "iscii-gjr", 0xa80 },
+ { "iscii-ori", 0xb00 },
+ { "iscii-tml", 0xb80 },
+ { "iscii-tlg", 0xc00 },
+ { "iscii-knd", 0xc80 },
+ { "iscii-mlm", 0xd00 }
};
+QTextCodec *QIsciiCodec::create(const char *name)
+{
+ for (int i = 0; i < 9; ++i) {
+ if (!qstricmp(name, codecs[i].name))
+ return new QIsciiCodec(i);
+ }
+ return 0;
+}
+
QIsciiCodec::~QIsciiCodec()
{
}