LCOV - code coverage report
Current view: top level - sal/textenc - tables.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 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 <config_locales.h>
      21             : 
      22             : #include "sal/config.h"
      23             : 
      24             : #include <cassert>
      25             : #include <cstddef>
      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 unsigned char 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             : static sal_uInt16 const aImplDoubleByteIdentifierTab[1] = { 0 };
      57             : 
      58             : #include "tcvtarb1.tab"
      59             : #include "tcvteas1.tab"
      60             : #include "tcvtest1.tab"
      61             : #include "tcvtjp1.tab"
      62             : #include "tcvtjp2.tab"
      63             : #include "tcvtjp3.tab"
      64             : #include "tcvtjp4.tab"
      65             : #include "tcvtjp5.tab"
      66             : #include "tcvtjp6.tab"
      67             : #include "tcvtkr1.tab"
      68             : #include "tcvtkr2.tab"
      69             : #include "tcvtkr4.tab"
      70             : #include "tcvtkr5.tab"
      71             : #include "tcvtkr6.tab"
      72             : #include "tcvtlat1.tab"
      73             : #include "tcvtscn1.tab"
      74             : #include "tcvtscn2.tab"
      75             : #include "tcvtscn3.tab"
      76             : #include "tcvtscn4.tab"
      77             : #include "tcvtscn5.tab"
      78             : #include "tcvtscn6.tab"
      79             : #include "tcvtsym1.tab"
      80             : #include "tcvttcn1.tab"
      81             : #include "tcvttcn2.tab"
      82             : #include "tcvttcn6.tab"
      83             : #include "tcvtuni1.tab"
      84             : 
      85             : #include "convertadobe.tab"
      86             : #include "convertbig5hkscs.tab"
      87             : #include "converteuctw.tab"
      88             : #include "convertgb18030.tab"
      89             : #include "convertisciidevangari.tab"
      90             : #include "convertiso2022cn.tab"
      91             : #include "convertiso2022jp.tab"
      92             : #include "convertiso2022kr.tab"
      93             : 
      94             : extern "C" SAL_DLLPUBLIC_EXPORT ImplTextEncodingData const *
      95       36164 :     sal_getFullTextEncodingData( rtl_TextEncoding nEncoding )
      96             : {
      97             :     assert(
      98             :         nEncoding != RTL_TEXTENCODING_ASCII_US &&
      99             :         nEncoding != RTL_TEXTENCODING_ISO_8859_1 &&
     100             :         nEncoding != RTL_TEXTENCODING_JAVA_UTF8 &&
     101             :         nEncoding != RTL_TEXTENCODING_MS_1252 &&
     102             :         nEncoding != RTL_TEXTENCODING_UTF8);
     103             :         // handled by Impl_getTextEncodingData
     104             :     static ImplTextEncodingData const * const aData[]
     105             :         = { NULL, /* DONTKNOW */
     106             :             NULL, /* MS_1252, see above */
     107             :             &aImplAPPLEROMANTextEncodingData, /* APPLE_ROMAN */
     108             :             &aImplIBM437TextEncodingData, /* IBM_437 */
     109             :             &aImplIBM850TextEncodingData, /* IBM_850 */
     110             :             &aImplIBM860TextEncodingData, /* IBM_860 */
     111             :             &aImplIBM861TextEncodingData, /* IBM_861 */
     112             :             &aImplIBM863TextEncodingData, /* IBM_863 */
     113             :             &aImplIBM865TextEncodingData, /* IBM_865 */
     114             :             NULL, /* reserved (SYSTEM) */
     115             :             &aImplSYMBOLTextEncodingData, /* SYMBOL */
     116             :             NULL, /* ASCII_US, see above */
     117             :             NULL, /* ISO_8859_1, see above */
     118             :             &aImplISO88592TextEncodingData, /* ISO_8859_2 */
     119             :             &aImplISO88593TextEncodingData, /* ISO_8859_3 */
     120             :             &aImplISO88594TextEncodingData, /* ISO_8859_4 */
     121             :             &aImplISO88595TextEncodingData, /* ISO_8859_5 */
     122             :             &aImplISO88596TextEncodingData, /* ISO_8859_6 */
     123             :             &aImplISO88597TextEncodingData, /* ISO_8859_7 */
     124             :             &aImplISO88598TextEncodingData, /* ISO_8859_8 */
     125             :             &aImplISO88599TextEncodingData, /* ISO_8859_9 */
     126             :             &aImplISO885914TextEncodingData, /* ISO_8859_14 */
     127             :             &aImplISO885915TextEncodingData, /* ISO_8859_15 */
     128             :             &aImplIBM737TextEncodingData, /* IBM_737 */
     129             :             &aImplIBM775TextEncodingData, /* IBM_775 */
     130             :             &aImplIBM852TextEncodingData, /* IBM_852 */
     131             :             &aImplIBM855TextEncodingData, /* IBM_855 */
     132             :             &aImplIBM857TextEncodingData, /* IBM_857 */
     133             :             &aImplIBM862TextEncodingData, /* IBM_862 */
     134             :             &aImplIBM864TextEncodingData, /* IBM_864 */
     135             :             &aImplIBM866TextEncodingData, /* IBM_866 */
     136             :             &aImplIBM869TextEncodingData, /* IBM_869 */
     137             :             &aImplMS874TextEncodingData, /* MS_874 */
     138             :             &aImplMS1250TextEncodingData, /* MS_1250 */
     139             :             &aImplMS1251TextEncodingData, /* MS_1251 */
     140             :             &aImplMS1253TextEncodingData, /* MS_1253 */
     141             :             &aImplMS1254TextEncodingData, /* MS_1254 */
     142             :             &aImplMS1255TextEncodingData, /* MS_1255 */
     143             :             &aImplMS1256TextEncodingData, /* MS_1256 */
     144             :             &aImplMS1257TextEncodingData, /* MS_1257 */
     145             :             &aImplMS1258TextEncodingData, /* MS_1258 */
     146             :             NULL, /* TODO! APPLE_ARABIC */
     147             :             &aImplAPPLECENTEUROTextEncodingData, /* APPLE_CENTEURO */
     148             :             &aImplAPPLECROATIANTextEncodingData, /* APPLE_CROATIAN */
     149             :             &aImplAPPLECYRILLICTextEncodingData, /* APPLE_CYRILLIC */
     150             :             NULL, /* TODO! APPLE_DEVANAGARI */
     151             :             NULL, /* TODO! APPLE_FARSI */
     152             :             &aImplAPPLEGREEKTextEncodingData, /* APPLE_GREEK */
     153             :             NULL, /* TODO! APPLE_GUJARATI */
     154             :             NULL, /* TODO! APPLE_GURMUKHI */
     155             :             NULL, /* TODO! APPLE_HEBREW */
     156             :             &aImplAPPLEICELANDTextEncodingData, /* APPLE_ICELAND */
     157             :             &aImplAPPLEROMANIANTextEncodingData, /* APPLE_ROMANIAN */
     158             :             NULL, /* TODO! APPLE_THAI */
     159             :             &aImplAPPLETURKISHTextEncodingData, /* APPLE_TURKISH */
     160             :             &aImplAPPLEUKRAINIANTextEncodingData, /* APPLE_UKRAINIAN */
     161             : #if WITH_LOCALE_ALL || WITH_LOCALE_zh
     162             :             &aImplAPPLECHINSIMPTextEncodingData, /* APPLE_CHINSIMP */
     163             :             &aImplAPPLECHINTRADTextEncodingData, /* APPLE_CHINTRAD */
     164             : #else
     165             :             NULL,
     166             :             NULL,
     167             : #endif
     168             : #if WITH_LOCALE_ALL || WITH_LOCALE_ja
     169             :             &aImplAPPLEJAPANESETextEncodingData, /* APPLE_JAPANESE */
     170             : #else
     171             :             NULL,
     172             : #endif
     173             : #if WITH_LOCALE_ALL || WITH_LOCALE_ko
     174             :             &aImplAPPLEKOREANTextEncodingData, /* APPLE_KOREAN */
     175             : #else
     176             :             NULL,
     177             : #endif
     178             :             &aImplMS932TextEncodingData, /* MS_932 */
     179             :             &aImplMS936TextEncodingData, /* MS_936 */
     180             :             &aImplMS949TextEncodingData, /* MS_949 */
     181             :             &aImplMS950TextEncodingData, /* MS_950 */
     182             : #if WITH_LOCALE_ALL || WITH_LOCALE_ja
     183             :             &aImplSJISTextEncodingData, /* SHIFT_JIS */
     184             : #else
     185             :             NULL,
     186             : #endif
     187             : #if WITH_LOCALE_ALL || WITH_LOCALE_zh
     188             :             &aImplGB2312TextEncodingData, /* GB_2312 */
     189             :             &aImplGBT12345TextEncodingData, /* GBT_12345 */
     190             :             &aImplGBKTextEncodingData, /* GBK */
     191             :             &aImplBIG5TextEncodingData, /* BIG5 */
     192             : #else
     193             :             NULL,
     194             :             NULL,
     195             :             NULL,
     196             :             NULL,
     197             : #endif
     198             : #if WITH_LOCALE_ALL || WITH_LOCALE_ja
     199             :             &aImplEUCJPTextEncodingData, /* EUC_JP */
     200             : #else
     201             :             NULL,
     202             : #endif
     203             : #if WITH_LOCALE_ALL || WITH_LOCALE_zh
     204             :             &aImplEUCCNTextEncodingData, /* EUC_CN */
     205             :             &aImplEucTwTextEncodingData, /* EUC_TW */
     206             : #else
     207             :             NULL,
     208             :             NULL,
     209             : #endif
     210             : #if WITH_LOCALE_ALL || WITH_LOCALE_ja
     211             :             &aImplIso2022JpTextEncodingData, /* ISO_2022_JP */
     212             : #else
     213             :             NULL,
     214             : #endif
     215             : #if WITH_LOCALE_ALL || WITH_LOCALE_zh
     216             :             &aImplIso2022CnTextEncodingData, /* ISO_2022_CN */
     217             : #else
     218             :             NULL,
     219             : #endif
     220             :             &aImplKOI8RTextEncodingData, /* KOI8_R */
     221             :             &aImplUTF7TextEncodingData, /* UTF7 */
     222             :             NULL, /* UTF8, see above */
     223             :             &aImplISO885910TextEncodingData, /* ISO_8859_10 */
     224             :             &aImplISO885913TextEncodingData, /* ISO_8859_13 */
     225             : #if WITH_LOCALE_ALL || WITH_LOCALE_ko
     226             :             &aImplEUCKRTextEncodingData, /* EUC_KR */
     227             :             &aImplIso2022KrTextEncodingData, /* ISO_2022_KR */
     228             : #else
     229             :             NULL,
     230             :             NULL,
     231             : #endif
     232             : #if WITH_LOCALE_ALL || WITH_LOCALE_ja
     233             :             &aImplJISX0201TextEncodingData, /* JIS_X_0201 */
     234             :             &aImplJISX0208TextEncodingData, /* JIS_X_0208 */
     235             :             &aImplJISX0212TextEncodingData, /* JIS_X_0212 */
     236             : #else
     237             :             NULL,
     238             :             NULL,
     239             :             NULL,
     240             : #endif
     241             :             &aImplMS1361TextEncodingData, /* MS_1361 */
     242             : #if WITH_LOCALE_ALL || WITH_LOCALE_zh
     243             :             &aImplGb18030TextEncodingData, /* GB_18030 */
     244             :             &aImplBig5HkscsTextEncodingData, /* BIG5_HKSCS */
     245             : #else
     246             :             NULL,
     247             :             NULL,
     248             : #endif
     249             :             &aImplTis620TextEncodingData, /* TIS_620 */
     250             :             &aImplKoi8UTextEncodingData, /* KOI8_U */
     251             : #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
     252             :             &aImplIsciiDevanagariTextEncodingData, /* ISCII_DEVANAGARI */
     253             : #else
     254             :             NULL,
     255             : #endif
     256             :             NULL, /* JAVA_UTF8, see above */
     257             :             &adobeStandardEncodingData, /* ADOBE_STANDARD */
     258             :             &adobeSymbolEncodingData, /* ADOBE_SYMBOL */
     259             :             &aImplPT154TextEncodingData, /* PT154 */
     260             :             &adobeDingbatsEncodingData }; /* ADOBE_DINGBATS */
     261             : 
     262             :     static_assert(
     263             :         SAL_N_ELEMENTS(aData) == RTL_TEXTENCODING_ADOBE_DINGBATS + 1,
     264             :         "update table above if a new encoding is added");
     265             : 
     266             :     return
     267       36164 :         nEncoding < SAL_N_ELEMENTS(aData) ? aData[nEncoding] : NULL;
     268             : }
     269             : 
     270             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11