LCOV - code coverage report
Current view: top level - libreoffice/sal/textenc - tables.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-12-27 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "sal/config.h"
      21             : 
      22             : #include <cassert>
      23             : #include <cstddef>
      24             : 
      25             : #include <boost/static_assert.hpp>
      26             : 
      27             : #include "rtl/textenc.h"
      28             : #include "sal/types.h"
      29             : 
      30             : #define NOTABUNI_START 0xFF
      31             : #define NOTABUNI_END 0x00
      32             : 
      33             : #define NOTABCHAR_START 0xFFFF
      34             : #define NOTABCHAR_END 0x0000
      35             : 
      36             : #define SAME8090UNI_START 0x80
      37             : #define SAME8090UNI_END 0x9F
      38             : static sal_uInt16 const aImpl8090SameToUniTab[SAME8090UNI_END
      39             :                                                   - SAME8090UNI_START
      40             :                                                   + 1]
      41             : = { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, /* 0x80 */
      42             :     0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
      43             :     0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, /* 0x90 */
      44             :     0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F };
      45             : 
      46             : #define SAME8090CHAR_START 0x0080
      47             : #define SAME8090CHAR_END 0x009F
      48             : static sal_uChar const aImpl8090SameToCharTab[SAME8090CHAR_END
      49             :                                                   - SAME8090CHAR_START
      50             :                                                   + 1]
      51             :     = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x0080 */
      52             :         0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
      53             :         0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x0090 */
      54             :         0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F };
      55             : 
      56             : #define SAMEA0FFCHAR_START 0x00A0
      57             : #define SAMEA0FFCHAR_END 0x00FF
      58             : static sal_uChar const aImplA0FFSameToCharTab[SAMEA0FFCHAR_END
      59             :                                                   - SAMEA0FFCHAR_START
      60             :                                                   + 1]
      61             :     = { 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, /* 0x00A0 */
      62             :         0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
      63             :         0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, /* 0x00B0 */
      64             :         0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
      65             :         0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 0x00C0 */
      66             :         0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
      67             :         0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 0x00D0 */
      68             :         0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
      69             :         0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* 0x00E0 */
      70             :         0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
      71             :         0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 0x00F0 */
      72             :         0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF };
      73             : 
      74             : static sal_uInt16 const aImplDoubleByteIdentifierTab[1] = { 0 };
      75             : 
      76             : #include "tcvtarb1.tab"
      77             : #include "tcvteas1.tab"
      78             : #include "tcvtest1.tab"
      79             : #include "tcvtjp1.tab"
      80             : #include "tcvtjp2.tab"
      81             : #include "tcvtjp3.tab"
      82             : #include "tcvtjp4.tab"
      83             : #include "tcvtjp5.tab"
      84             : #include "tcvtjp6.tab"
      85             : #include "tcvtkr1.tab"
      86             : #include "tcvtkr2.tab"
      87             : #include "tcvtkr4.tab"
      88             : #include "tcvtkr5.tab"
      89             : #include "tcvtkr6.tab"
      90             : #include "tcvtlat1.tab"
      91             : #include "tcvtscn1.tab"
      92             : #include "tcvtscn2.tab"
      93             : #include "tcvtscn3.tab"
      94             : #include "tcvtscn4.tab"
      95             : #include "tcvtscn5.tab"
      96             : #include "tcvtscn6.tab"
      97             : #include "tcvtsym1.tab"
      98             : #include "tcvttcn1.tab"
      99             : #include "tcvttcn2.tab"
     100             : #include "tcvttcn6.tab"
     101             : #include "tcvtuni1.tab"
     102             : 
     103             : #include "convertadobe.tab"
     104             : #include "convertbig5hkscs.tab"
     105             : #include "converteuctw.tab"
     106             : #include "convertgb18030.tab"
     107             : #include "convertisciidevangari.tab"
     108             : #include "convertiso2022cn.tab"
     109             : #include "convertiso2022jp.tab"
     110             : #include "convertiso2022kr.tab"
     111             : 
     112             : extern "C" SAL_DLLPUBLIC_EXPORT ImplTextEncodingData const *
     113        4466 :     sal_getFullTextEncodingData( rtl_TextEncoding nEncoding )
     114             : {
     115             :     assert(
     116             :         nEncoding != RTL_TEXTENCODING_ASCII_US &&
     117             :         nEncoding != RTL_TEXTENCODING_ISO_8859_1 &&
     118             :         nEncoding != RTL_TEXTENCODING_JAVA_UTF8 &&
     119             :         nEncoding != RTL_TEXTENCODING_MS_1252 &&
     120             :         nEncoding != RTL_TEXTENCODING_UTF8);
     121             :         // handled by Impl_getTextEncodingData
     122             :     static ImplTextEncodingData const * const aData[]
     123             :         = { NULL, /* DONTKNOW */
     124             :             NULL, /* MS_1252, see above */
     125             :             &aImplAPPLEROMANTextEncodingData, /* APPLE_ROMAN */
     126             :             &aImplIBM437TextEncodingData, /* IBM_437 */
     127             :             &aImplIBM850TextEncodingData, /* IBM_850 */
     128             :             &aImplIBM860TextEncodingData, /* IBM_860 */
     129             :             &aImplIBM861TextEncodingData, /* IBM_861 */
     130             :             &aImplIBM863TextEncodingData, /* IBM_863 */
     131             :             &aImplIBM865TextEncodingData, /* IBM_865 */
     132             :             NULL, /* reserved (SYSTEM) */
     133             :             &aImplSYMBOLTextEncodingData, /* SYMBOL */
     134             :             NULL, /* ASCII_US, see above */
     135             :             NULL, /* ISO_8859_1, see above */
     136             :             &aImplISO88592TextEncodingData, /* ISO_8859_2 */
     137             :             &aImplISO88593TextEncodingData, /* ISO_8859_3 */
     138             :             &aImplISO88594TextEncodingData, /* ISO_8859_4 */
     139             :             &aImplISO88595TextEncodingData, /* ISO_8859_5 */
     140             :             &aImplISO88596TextEncodingData, /* ISO_8859_6 */
     141             :             &aImplISO88597TextEncodingData, /* ISO_8859_7 */
     142             :             &aImplISO88598TextEncodingData, /* ISO_8859_8 */
     143             :             &aImplISO88599TextEncodingData, /* ISO_8859_9 */
     144             :             &aImplISO885914TextEncodingData, /* ISO_8859_14 */
     145             :             &aImplISO885915TextEncodingData, /* ISO_8859_15 */
     146             :             &aImplIBM737TextEncodingData, /* IBM_737 */
     147             :             &aImplIBM775TextEncodingData, /* IBM_775 */
     148             :             &aImplIBM852TextEncodingData, /* IBM_852 */
     149             :             &aImplIBM855TextEncodingData, /* IBM_855 */
     150             :             &aImplIBM857TextEncodingData, /* IBM_857 */
     151             :             &aImplIBM862TextEncodingData, /* IBM_862 */
     152             :             &aImplIBM864TextEncodingData, /* IBM_864 */
     153             :             &aImplIBM866TextEncodingData, /* IBM_866 */
     154             :             &aImplIBM869TextEncodingData, /* IBM_869 */
     155             :             &aImplMS874TextEncodingData, /* MS_874 */
     156             :             &aImplMS1250TextEncodingData, /* MS_1250 */
     157             :             &aImplMS1251TextEncodingData, /* MS_1251 */
     158             :             &aImplMS1253TextEncodingData, /* MS_1253 */
     159             :             &aImplMS1254TextEncodingData, /* MS_1254 */
     160             :             &aImplMS1255TextEncodingData, /* MS_1255 */
     161             :             &aImplMS1256TextEncodingData, /* MS_1256 */
     162             :             &aImplMS1257TextEncodingData, /* MS_1257 */
     163             :             &aImplMS1258TextEncodingData, /* MS_1258 */
     164             :             NULL, /* TODO! APPLE_ARABIC */
     165             :             &aImplAPPLECENTEUROTextEncodingData, /* APPLE_CENTEURO */
     166             :             &aImplAPPLECROATIANTextEncodingData, /* APPLE_CROATIAN */
     167             :             &aImplAPPLECYRILLICTextEncodingData, /* APPLE_CYRILLIC */
     168             :             NULL, /* TODO! APPLE_DEVANAGARI */
     169             :             NULL, /* TODO! APPLE_FARSI */
     170             :             &aImplAPPLEGREEKTextEncodingData, /* APPLE_GREEK */
     171             :             NULL, /* TODO! APPLE_GUJARATI */
     172             :             NULL, /* TODO! APPLE_GURMUKHI */
     173             :             NULL, /* TODO! APPLE_HEBREW */
     174             :             &aImplAPPLEICELANDTextEncodingData, /* APPLE_ICELAND */
     175             :             &aImplAPPLEROMANIANTextEncodingData, /* APPLE_ROMANIAN */
     176             :             NULL, /* TODO! APPLE_THAI */
     177             :             &aImplAPPLETURKISHTextEncodingData, /* APPLE_TURKISH */
     178             :             &aImplAPPLEUKRAINIANTextEncodingData, /* APPLE_UKRAINIAN */
     179             :             &aImplAPPLECHINSIMPTextEncodingData, /* APPLE_CHINSIMP */
     180             :             &aImplAPPLECHINTRADTextEncodingData, /* APPLE_CHINTRAD */
     181             :             &aImplAPPLEJAPANESETextEncodingData, /* APPLE_JAPANESE */
     182             :             &aImplAPPLEKOREANTextEncodingData, /* APPLE_KOREAN */
     183             :             &aImplMS932TextEncodingData, /* MS_932 */
     184             :             &aImplMS936TextEncodingData, /* MS_936 */
     185             :             &aImplMS949TextEncodingData, /* MS_949 */
     186             :             &aImplMS950TextEncodingData, /* MS_950 */
     187             :             &aImplSJISTextEncodingData, /* SHIFT_JIS */
     188             :             &aImplGB2312TextEncodingData, /* GB_2312 */
     189             :             &aImplGBT12345TextEncodingData, /* GBT_12345 */
     190             :             &aImplGBKTextEncodingData, /* GBK */
     191             :             &aImplBIG5TextEncodingData, /* BIG5 */
     192             :             &aImplEUCJPTextEncodingData, /* EUC_JP */
     193             :             &aImplEUCCNTextEncodingData, /* EUC_CN */
     194             :             &aImplEucTwTextEncodingData, /* EUC_TW */
     195             :             &aImplIso2022JpTextEncodingData, /* ISO_2022_JP */
     196             :             &aImplIso2022CnTextEncodingData, /* ISO_2022_CN */
     197             :             &aImplKOI8RTextEncodingData, /* KOI8_R */
     198             :             &aImplUTF7TextEncodingData, /* UTF7 */
     199             :             NULL, /* UTF8, see above */
     200             :             &aImplISO885910TextEncodingData, /* ISO_8859_10 */
     201             :             &aImplISO885913TextEncodingData, /* ISO_8859_13 */
     202             :             &aImplEUCKRTextEncodingData, /* EUC_KR */
     203             :             &aImplIso2022KrTextEncodingData, /* ISO_2022_KR */
     204             :             &aImplJISX0201TextEncodingData, /* JIS_X_0201 */
     205             :             &aImplJISX0208TextEncodingData, /* JIS_X_0208 */
     206             :             &aImplJISX0212TextEncodingData, /* JIS_X_0212 */
     207             :             &aImplMS1361TextEncodingData, /* MS_1361 */
     208             :             &aImplGb18030TextEncodingData, /* GB_18030 */
     209             :             &aImplBig5HkscsTextEncodingData, /* BIG5_HKSCS */
     210             :             &aImplTis620TextEncodingData, /* TIS_620 */
     211             :             &aImplKoi8UTextEncodingData, /* KOI8_U */
     212             :             &aImplIsciiDevanagariTextEncodingData, /* ISCII_DEVANAGARI */
     213             :             NULL, /* JAVA_UTF8, see above */
     214             :             &adobeStandardEncodingData, /* ADOBE_STANDARD */
     215             :             &adobeSymbolEncodingData, /* ADOBE_SYMBOL */
     216             :             &aImplPT154TextEncodingData, /* PT154 */
     217             :             &adobeDingbatsEncodingData }; /* ADOBE_DINGBATS */
     218             : 
     219             :     //update table above if a new encoding is added
     220             :     BOOST_STATIC_ASSERT(
     221             :         SAL_N_ELEMENTS(aData) == RTL_TEXTENCODING_ADOBE_DINGBATS + 1);
     222             : 
     223             :     return
     224        4466 :         nEncoding < SAL_N_ELEMENTS(aData) ? aData[nEncoding] : NULL;
     225             : }
     226             : 
     227             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10