Eneboo - Documentación para desarrolladores
src/qt/include/qjpunicode.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qjpunicode.h   3.3.8   edited Jan 11 14:37 $
00003 **
00004 ** Definition of QJpUnicodeConv class
00005 **
00006 ** Created : 990225
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the tools module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 // Most of the code here was originally written by Serika Kurusugawa
00039 // a.k.a. Junji Takagi, and is included in Qt with the author's permission,
00040 // and the grateful thanks of the Trolltech team.
00041 
00042 /*
00043  * Copyright (C) 1999 Serika Kurusugawa, All rights reserved.
00044  *
00045  * Redistribution and use in source and binary forms, with or without
00046  * modification, are permitted provided that the following conditions
00047  * are met:
00048  * 1. Redistributions of source code must retain the above copyright
00049  *    notice, this list of conditions and the following disclaimer.
00050  * 2. Redistributions in binary form must reproduce the above copyright
00051  *    notice, this list of conditions and the following disclaimer in the
00052  *    documentation and/or other materials provided with the distribution.
00053  *
00054  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00055  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00056  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00057  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00058  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00059  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00060  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00061  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00062  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00063  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00064  * SUCH DAMAGE.
00065  */
00066 
00067 #ifndef QJPUNICODE_H
00068 #define QJPUNICODE_H
00069 
00070 #ifndef QT_H
00071 #include "qglobal.h"
00072 #endif // QT_H
00073 
00074 #ifndef QT_NO_BIG_CODECS
00075 
00076 #if defined(QT_PLUGIN)
00077 #define Q_EXPORT_CODECS_JP
00078 #else
00079 #define Q_EXPORT_CODECS_JP Q_EXPORT
00080 #endif
00081 
00082 class Q_EXPORT_CODECS_JP QJpUnicodeConv {
00083 public:
00084     enum Rules {
00085         // "ASCII" is ANSI X.3.4-1986, a.k.a. US-ASCII here.
00086         Default                 = 0x0000,
00087 
00088         Unicode                 = 0x0001,
00089         Unicode_JISX0201                = 0x0001,
00090         Unicode_ASCII           = 0x0002,
00091         JISX0221_JISX0201       = 0x0003,
00092         JISX0221_ASCII          = 0x0004,
00093         Sun_JDK117              = 0x0005,
00094         Microsoft_CP932         = 0x0006,
00095 
00096         NEC_VDC         = 0x0100,               // NEC Vender Defined Char
00097         UDC                     = 0x0200,               // User Defined Char
00098         IBM_VDC         = 0x0400                // IBM Vender Defined Char
00099     };
00100     static QJpUnicodeConv *newConverter(int rule);
00101 
00102     virtual uint asciiToUnicode(uint h, uint l) const;
00103     /*virtual*/ uint jisx0201ToUnicode(uint h, uint l) const;
00104     virtual uint jisx0201LatinToUnicode(uint h, uint l) const;
00105     /*virtual*/ uint jisx0201KanaToUnicode(uint h, uint l) const;
00106     virtual uint jisx0208ToUnicode(uint h, uint l) const;
00107     virtual uint jisx0212ToUnicode(uint h, uint l) const;
00108 
00109     uint asciiToUnicode(uint ascii) const {
00110         return asciiToUnicode((ascii & 0xff00) >> 8, (ascii & 0x00ff));
00111     }
00112     uint jisx0201ToUnicode(uint jis) const {
00113         return jisx0201ToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
00114     }
00115     uint jisx0201LatinToUnicode(uint jis) const {
00116         return jisx0201LatinToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
00117     }
00118     uint jisx0201KanaToUnicode(uint jis) const {
00119         return jisx0201KanaToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
00120     }
00121     uint jisx0208ToUnicode(uint jis) const {
00122         return jisx0208ToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
00123     }
00124     uint jisx0212ToUnicode(uint jis) const {
00125         return jisx0212ToUnicode((jis & 0xff00) >> 8, (jis & 0x00ff));
00126     }
00127 
00128     virtual uint unicodeToAscii(uint h, uint l) const;
00129     /*virtual*/ uint unicodeToJisx0201(uint h, uint l) const;
00130     virtual uint unicodeToJisx0201Latin(uint h, uint l) const;
00131     /*virtual*/ uint unicodeToJisx0201Kana(uint h, uint l) const;
00132     virtual uint unicodeToJisx0208(uint h, uint l) const;
00133     virtual uint unicodeToJisx0212(uint h, uint l) const;
00134 
00135     uint unicodeToAscii(uint unicode) const {
00136         return unicodeToAscii((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00137     }
00138     uint unicodeToJisx0201(uint unicode) const {
00139         return unicodeToJisx0201((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00140     }
00141     uint unicodeToJisx0201Latin(uint unicode) const {
00142         return unicodeToJisx0201Latin((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00143     }
00144     uint unicodeToJisx0201Kana(uint unicode) const {
00145         return unicodeToJisx0201Kana((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00146     }
00147     uint unicodeToJisx0208(uint unicode) const {
00148         return unicodeToJisx0208((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00149     }
00150     uint unicodeToJisx0212(uint unicode) const {
00151         return unicodeToJisx0212((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00152     }
00153 
00154     uint sjisToUnicode(uint h, uint l) const;
00155     uint unicodeToSjis(uint h, uint l) const;
00156 
00157     uint sjisToUnicode(uint sjis) const {
00158         return sjisToUnicode((sjis & 0xff00) >> 8, (sjis & 0x00ff));
00159     }
00160     uint unicodeToSjis(uint unicode) const {
00161         return unicodeToSjis((unicode & 0xff00) >> 8, (unicode & 0x00ff));
00162     }
00163 
00164 protected:
00165     QJpUnicodeConv(int r) : rule(r) {}
00166 
00167 private:
00168     int rule;
00169 };
00170 
00171 #endif // QT_NO_BIG_CODECS
00172 #endif /* QJPUNICODE_H */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'