/* Generated automatically by jlpp - do not edit. */ #include static jakelib::lang::String* jakelib2_strings[] = {null}; // "CharToByteConverter: " static jchar chars_jakelib2_str_0[] = {67,104,97,114,84,111,66,121,116,101,67,111,110,118,101,114,116,101,114,58,32}; #line 1 "text/enc/CharToByteConverter.jlc" // -*- c++ -*- /* * Jakelib2 - General purpose C++ library * Copyright (C) 2001 Florian Wolff (florian@donuz.de) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: CharToByteConverter.jlc,v 1.6 2003/09/27 08:10:28 florian Exp $ */ #include "jakelib2.h" #include "jakelib2/text/enc/CharToByteConverter.h" #include "jakelib2/lang/Synchronizer.h" #include "jakelib2/util/Hashtable.h" #include "jakelib2/text/enc/all.h" #include "jakelib2/text/enc/CharToByteISO8859_1.h" #include "jakelib2/text/enc/CharToByteISO8859_2.h" #include "jakelib2/text/enc/CharToByteISO8859_3.h" #include "jakelib2/text/enc/CharToByteISO8859_4.h" #include "jakelib2/text/enc/CharToByteISO8859_5.h" #include "jakelib2/text/enc/CharToByteISO8859_6.h" #include "jakelib2/text/enc/CharToByteISO8859_7.h" #include "jakelib2/text/enc/CharToByteISO8859_8.h" #include "jakelib2/text/enc/CharToByteISO8859_9.h" #include "jakelib2/text/enc/CharToByteISO8859_10.h" #include "jakelib2/text/enc/CharToByteISO8859_11.h" #include "jakelib2/text/enc/CharToByteISO8859_13.h" #include "jakelib2/text/enc/CharToByteISO8859_14.h" #include "jakelib2/text/enc/CharToByteISO8859_15.h" #include "jakelib2/text/enc/CharToByteCP1252.h" #include "jakelib2/text/enc/CharToByteCP437.h" #include "jakelib2/text/enc/CharToByteCP850.h" #include "jakelib2/text/enc/CharToByteUTF8.h" #include "jakelib2/text/enc/CharToByteASCII.h" using namespace jakelib::lang; using namespace jakelib::util; using namespace jakelib::io; using namespace jakelib::text::enc; JAKELIB_IMPLEMENT_CLASS("jakelib.text.enc.CharToByteConverter", CharToByteConverter, Object); Hashtable* CharToByteConverter::converters = null; CharToByteConverter* CharToByteConverter::defaultConverter = null; /*****************************************************************************\ * CharToByteConverter | *****************************************************************************/ CharToByteConverter::CharToByteConverter(char* characterEncoding) { this->characterEncoding = new String(characterEncoding); this->substitutionMode = true; } /*****************************************************************************\ * toString | *****************************************************************************/ String* CharToByteConverter::toString() { return JAKELIB_ONDEMAND(jakelib2_strings[0], new jakelib::lang::String(chars_jakelib2_str_0, 0, 21)) ->plus( getCharacterEncoding()); } /*****************************************************************************\ * getCharacterEncoding | *****************************************************************************/ String* CharToByteConverter::getCharacterEncoding() { return characterEncoding; } /*****************************************************************************\ * getDefault | *****************************************************************************/ CharToByteConverter* CharToByteConverter::getDefault() { return defaultConverter; } /*****************************************************************************\ * getConverter | *****************************************************************************/ CharToByteConverter* CharToByteConverter::getConverter(String* encoding) { CharToByteConverter* conv = (CharToByteConverter*) converters->get(encoding); if (conv != null) return conv; else throw new UnsupportedEncodingException(encoding ->plus( JAKELIB_AT2("jakelib.text.enc.CharToByteConverter.getConverter"))); } CharToByteConverter* CharToByteConverter::getConverter(char* encoding) { String _encoding(encoding); return getConverter(&_encoding); } /*****************************************************************************\ * initConverters | *****************************************************************************/ void CharToByteConverter::initConverters() { if (converters != null) return; Hashtable* hash = new Hashtable(100); CharToByteConverter* c; c = new CharToByteISO8859_1(); hash->put("ISO8859_1", c); hash->put("8859_1", c); hash->put("iso_8859-1:1987", c); hash->put("iso-ir-100", c); hash->put("iso_8859-1", c); hash->put("iso-8859-1", c); hash->put("iso8859-1", c); hash->put("latin1", c); hash->put("l1", c); hash->put("ibm819", c); hash->put("ibm-819", c); hash->put("cp819", c); hash->put("819", c); hash->put("csisolatin1", c); c = new CharToByteISO8859_2(); hash->put("8859_2", c); hash->put("ISO8859_2", c); hash->put("iso_8859-2:1987", c); hash->put("iso-ir-101", c); hash->put("iso_8859-2", c); hash->put("iso-8859-2", c); hash->put("iso8859-2", c); hash->put("latin2", c); hash->put("l2", c); hash->put("ibm912", c); hash->put("ibm-912", c); hash->put("cp912", c); hash->put("912", c); hash->put("csisolatin2", c); c = new CharToByteISO8859_3(); hash->put("ISO8859_3", c); hash->put("8859_3", c); hash->put("iso_8859-3:1988", c); hash->put("iso-ir-109", c); hash->put("iso_8859-3", c); hash->put("iso-8859-3", c); hash->put("iso8859-3", c); hash->put("latin3", c); hash->put("l3", c); hash->put("ibm913", c); hash->put("ibm-913", c); hash->put("cp913", c); hash->put("913", c); hash->put("csisolatin3", c); c = new CharToByteISO8859_4(); hash->put("ISO8859_4", c); hash->put("8859_4", c); hash->put("iso_8859-4:1988", c); hash->put("iso-ir-110", c); hash->put("iso_8859-4", c); hash->put("iso-8859-4", c); hash->put("iso8859-4", c); hash->put("latin4", c); hash->put("l4", c); hash->put("ibm914", c); hash->put("ibm-914", c); hash->put("cp914", c); hash->put("914", c); hash->put("csisolatin4", c); c = new CharToByteISO8859_5(); hash->put("ISO8859_5", c); hash->put("8859_5", c); hash->put("iso_8859-5:1988", c); hash->put("iso-ir-144", c); hash->put("iso_8859-5", c); hash->put("iso-8859-5", c); hash->put("iso8859-5", c); hash->put("cyrillic", c); hash->put("csisolatincyrillic", c); hash->put("ibm915", c); hash->put("ibm-915", c); hash->put("cp915", c); hash->put("915", c); c = new CharToByteISO8859_6(); hash->put("ISO8859_6", c); hash->put("8859_6", c); hash->put("iso_8859-6:1987", c); hash->put("iso-ir-127", c); hash->put("iso_8859-6", c); hash->put("iso-8859-6", c); hash->put("iso8859-6", c); hash->put("ecma-114", c); hash->put("asmo-708", c); hash->put("arabic", c); hash->put("csisolatinarabic", c); hash->put("ibm1089", c); hash->put("ibm-1089", c); hash->put("cp1089", c); hash->put("1089", c); c = new CharToByteISO8859_7(); hash->put("ISO8859_7", c); hash->put("8859_7", c); hash->put("iso_8859-7:1987", c); hash->put("iso-ir-126", c); hash->put("iso_8859-7", c); hash->put("iso-8859-7", c); hash->put("iso8859-7", c); hash->put("elot_928", c); hash->put("greek", c); hash->put("greek8", c); hash->put("csisolatingreek", c); hash->put("ibm813", c); hash->put("ibm-813", c); hash->put("cp813", c); hash->put("813", c); c = new CharToByteISO8859_8(); hash->put("ISO8859_8", c); hash->put("8859_8", c); hash->put("iso_8859-8:1988", c); hash->put("iso-ir-138", c); hash->put("iso_8859-8", c); hash->put("iso-8859-8", c); hash->put("iso8859-8", c); hash->put("hebrew", c); hash->put("csisolatinhebrew", c); hash->put("ibm916", c); hash->put("ibm-916", c); hash->put("cp916", c); hash->put("916", c); c = new CharToByteISO8859_9(); hash->put("ISO8859_9", c); hash->put("8859_9", c); hash->put("iso-ir-148", c); hash->put("iso_8859-9", c); hash->put("iso-8859-9", c); hash->put("iso8859-9", c); hash->put("latin5", c); hash->put("l5", c); hash->put("ibm920", c); hash->put("ibm-920", c); hash->put("cp920", c); hash->put("920", c); hash->put("csisolatin5", c); c = new CharToByteISO8859_10(); hash->put("ISO8859_10", c); hash->put("8859_10", c); hash->put("iso_8859-10", c); hash->put("iso-8859-10", c); hash->put("iso8859-10", c); c = new CharToByteISO8859_11(); hash->put("ISO8859_11", c); hash->put("8859_11", c); hash->put("iso_8859-11", c); hash->put("iso-8859-11", c); hash->put("iso8859-11", c); c = new CharToByteISO8859_13(); hash->put("ISO8859_13", c); hash->put("8859_13", c); hash->put("iso_8859-13", c); hash->put("iso-8859-13", c); hash->put("iso8859-13", c); c = new CharToByteISO8859_14(); hash->put("ISO8859_14", c); hash->put("8859_14", c); hash->put("iso_8859-14", c); hash->put("iso-8859-14", c); hash->put("iso8859-14", c); c = new CharToByteISO8859_15(); hash->put("ISO8859_15_FDIS", c); hash->put("ISO8859_15", c); hash->put("8859_15", c); hash->put("iso-8859-15", c); hash->put("iso_8859-15", c); hash->put("iso8859-15", c); hash->put("ibm923", c); hash->put("ibm-923", c); hash->put("cp923", c); hash->put("923", c); hash->put("latin0", c); hash->put("latin9", c); hash->put("csisolatin0", c); hash->put("csisolatin9", c); c = new CharToByteUTF8(); hash->put("UTF8", c); hash->put("UTF-8", c); hash->put("utf8", c); hash->put("utf-8", c); c = new CharToByteASCII(); hash->put("ASCII", c); hash->put("ascii", c); c = new CharToByteCP850(); hash->put("cp850", c); hash->put("Cp850", c); hash->put("ibm850", c); hash->put("ibm-850", c); hash->put("850", c); c = new CharToByteCP437(); hash->put("cp437", c); hash->put("Cp437", c); hash->put("ibm437", c); hash->put("ibm-437", c); hash->put("437", c); c = new CharToByteCP1252(); hash->put("cp1252", c); hash->put("Cp1252", c); hash->put("ibm1252", c); hash->put("ibm-1252", c); hash->put("1252", c); #if defined(JAKELIB_MINGW32) defaultConverter = (CharToByteConverter*) hash->get("ASCII"); #elif defined(JAKELIB_WIN32API) defaultConverter = (CharToByteConverter*) hash->get("cp850"); #else defaultConverter = (CharToByteConverter*) hash->get("iso8859-1"); #endif converters = hash; }