LCOV - code coverage report
Current view: top level - sal/textenc - tenchelp.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 1 0.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             : #ifndef INCLUDED_SAL_TEXTENC_TENCHELP_HXX
      21             : #define INCLUDED_SAL_TEXTENC_TENCHELP_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include "rtl/tencinfo.h"
      26             : #include "rtl/textcvt.h"
      27             : #include "rtl/textenc.h"
      28             : #include "sal/types.h"
      29             : 
      30             : #include "unichars.hxx"
      31             : 
      32             : #define RTL_TEXTCVT_BYTE_PRIVATE_START 0xF100
      33             : #define RTL_TEXTCVT_BYTE_PRIVATE_END 0xF1FF
      34             : 
      35             : /* ----------------- */
      36             : /* - TextConverter - */
      37             : /* ----------------- */
      38             : 
      39             : typedef
      40             : sal_Size (* ImplConvertToUnicodeProc)(void const * pData,
      41             :                                       void * pContext,
      42             :                                       char const * pSrcBuf,
      43             :                                       sal_Size nSrcBytes,
      44             :                                       sal_Unicode * pDestBuf,
      45             :                                       sal_Size nDestChars,
      46             :                                       sal_uInt32 nFlags,
      47             :                                       sal_uInt32 * pInfo,
      48             :                                       sal_Size * pSrcCvtBytes);
      49             : 
      50             : typedef
      51             : sal_Size (* ImplConvertToTextProc)(void const * pData,
      52             :                                    void * pContext,
      53             :                                    sal_Unicode const * pSrcBuf,
      54             :                                    sal_Size nSrcChars,
      55             :                                    char * pDestBuf,
      56             :                                    sal_Size nDestBytes,
      57             :                                    sal_uInt32 nFlags,
      58             :                                    sal_uInt32 * pInfo,
      59             :                                    sal_Size * pSrcCvtChars);
      60             : 
      61             : typedef void * (* ImplCreateTextContextProc)();
      62             : 
      63             : typedef void (* ImplDestroyTextContextProc)(void * pContext);
      64             : 
      65             : typedef void (* ImplResetTextContextProc)(void * pContext);
      66             : 
      67             : typedef void * (* ImplCreateUnicodeContextProc)();
      68             : 
      69             : typedef void (* ImplDestroyUnicodeContextProc)(void * pContext);
      70             : 
      71             : typedef void (* ImplResetUnicodeContextProc)(void * pContext);
      72             : 
      73             : struct ImplTextConverter
      74             : {
      75             :     void const * mpConvertData;
      76             :     ImplConvertToUnicodeProc mpConvertTextToUnicodeProc;
      77             :     ImplConvertToTextProc mpConvertUnicodeToTextProc;
      78             :     ImplCreateTextContextProc mpCreateTextToUnicodeContext;
      79             :     ImplDestroyTextContextProc mpDestroyTextToUnicodeContext;
      80             :     ImplResetTextContextProc mpResetTextToUnicodeContext;
      81             :     ImplCreateUnicodeContextProc mpCreateUnicodeToTextContext;
      82             :     ImplDestroyUnicodeContextProc mpDestroyUnicodeToTextContext;
      83             :     ImplResetUnicodeContextProc mpResetUnicodeToTextContext;
      84             : };
      85             : 
      86             : /* ----------------------------- */
      87             : /* - TextEncoding - Structures - */
      88             : /* ----------------------------- */
      89             : 
      90             : struct ImplTextEncodingData
      91             : {
      92             :     ImplTextConverter maConverter;
      93             :     sal_uInt8 mnMinCharSize;
      94             :     sal_uInt8 mnMaxCharSize;
      95             :     sal_uInt8 mnAveCharSize;
      96             :     sal_uInt8 mnBestWindowsCharset;
      97             :     char const * mpBestUnixCharset;
      98             :     char const * mpBestMimeCharset;
      99             :     sal_uInt32 mnInfoFlags;
     100             : };
     101             : 
     102             : /* ----------------------------------- */
     103             : /* - TextConverter - Byte-Structures - */
     104             : /* ----------------------------------- */
     105             : 
     106             : struct ImplUniCharTabData
     107             : {
     108             :     sal_uInt16                      mnUniChar;
     109             :     unsigned char                       mnChar;
     110             :     unsigned char                       mnChar2;
     111             :         // to cater for mappings like MS1258 with 1--2 bytes per Unicode char,
     112             :         // 0 if unused
     113             : };
     114             : 
     115             : struct ImplByteConvertData
     116             : {
     117             :     const sal_uInt16*               mpToUniTab1;
     118             :     const sal_uInt16*               mpToUniTab2;
     119             :     unsigned char                       mnToUniStart1;
     120             :     unsigned char                       mnToUniEnd1;
     121             :     unsigned char                       mnToUniStart2;
     122             :     unsigned char                       mnToUniEnd2;
     123             :     const unsigned char*                mpToCharTab1;
     124             :     const unsigned char*                mpToCharTab2;
     125             :     const ImplUniCharTabData*       mpToCharExTab;
     126             :     sal_uInt16                      mnToCharStart1;
     127             :     sal_uInt16                      mnToCharEnd1;
     128             :     sal_uInt16                      mnToCharStart2;
     129             :     sal_uInt16                      mnToCharEnd2;
     130             :     sal_uInt16                      mnToCharExCount;
     131             : };
     132             : 
     133             : /* ----------------------------------- */
     134             : /* - TextConverter - DBCS-Structures - */
     135             : /* ----------------------------------- */
     136             : 
     137             : struct ImplDBCSEUDCData
     138             : {
     139             :     unsigned char                       mnLeadStart;
     140             :     unsigned char                       mnLeadEnd;
     141             :     unsigned char                       mnTrail1Start;
     142             :     unsigned char                       mnTrail1End;
     143             :     unsigned char                       mnTrail2Start;
     144             :     unsigned char                       mnTrail2End;
     145             :     unsigned char                       mnTrail3Start;
     146             :     unsigned char                       mnTrail3End;
     147             :     unsigned char                       mnTrailCount;
     148             :     sal_uInt16                      mnTrailRangeCount;
     149             :     sal_uInt16                      mnUniStart;
     150             :     sal_uInt16                      mnUniEnd;
     151             : };
     152             : 
     153             : struct ImplDBCSToUniLeadTab
     154             : {
     155             :     sal_uInt16                      mnUniChar;
     156             :     sal_uInt8                       mnTrailStart;
     157             :     sal_uInt8                       mnTrailEnd;
     158             :     const sal_uInt16*               mpToUniTrailTab;
     159             : };
     160             : 
     161             : struct ImplUniToDBCSHighTab
     162             : {
     163             :     sal_uInt8                       mnLowStart;
     164             :     sal_uInt8                       mnLowEnd;
     165             :     const sal_uInt16*               mpToUniTrailTab;
     166             : };
     167             : 
     168             : struct ImplDBCSConvertData
     169             : {
     170             :     const ImplDBCSToUniLeadTab*     mpToUniLeadTab;
     171             :     const ImplUniToDBCSHighTab*     mpToDBCSHighTab;
     172             :     unsigned char                       mnLeadStart;
     173             :     unsigned char                       mnLeadEnd;
     174             :     unsigned char                       mnTrailStart;
     175             :     unsigned char                       mnTrailEnd;
     176             :     const ImplDBCSEUDCData*         mpEUDCTab;
     177             :     sal_uInt16                      mnEUDCCount;
     178             : };
     179             : 
     180             : /* ---------------------------------- */
     181             : /* - TextConverter - EUC-Structures - */
     182             : /* ---------------------------------- */
     183             : 
     184             : struct ImplEUCJPConvertData
     185             : {
     186             :     const ImplDBCSToUniLeadTab*     mpJIS0208ToUniLeadTab;
     187             :     const ImplDBCSToUniLeadTab*     mpJIS0212ToUniLeadTab;
     188             :     const ImplUniToDBCSHighTab*     mpUniToJIS0208HighTab;
     189             :     const ImplUniToDBCSHighTab*     mpUniToJIS0212HighTab;
     190             : };
     191             : 
     192             : /* --------------------------------- */
     193             : /* - TextConverter - HelpFunctions - */
     194             : /* --------------------------------- */
     195             : 
     196           0 : inline sal_Unicode ImplGetUndefinedUnicodeChar(
     197             :     unsigned char cChar, sal_uInt32 nFlags)
     198             : {
     199           0 :     return ((nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK)
     200             :                    == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE) ?
     201             :                RTL_TEXTCVT_BYTE_PRIVATE_START + cChar :
     202           0 :                RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
     203             : }
     204             : 
     205             : /* ----------------------------- */
     206             : /* - TextConverter - Functions - */
     207             : /* ----------------------------- */
     208             : 
     209             : sal_Size ImplDBCSToUnicode( const void* pData, void* pContext,
     210             :                             const char* pSrcBuf, sal_Size nSrcBytes,
     211             :                             sal_Unicode* pDestBuf, sal_Size nDestChars,
     212             :                             sal_uInt32 nFlags, sal_uInt32* pInfo,
     213             :                             sal_Size* pSrcCvtBytes );
     214             : sal_Size ImplUnicodeToDBCS( const void* pData, void* pContext,
     215             :                             const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
     216             :                             char* pDestBuf, sal_Size nDestBytes,
     217             :                             sal_uInt32 nFlags, sal_uInt32* pInfo,
     218             :                             sal_Size* pSrcCvtChars );
     219             : sal_Size ImplEUCJPToUnicode( const void* pData,
     220             :                              void* pContext,
     221             :                              const char* pSrcBuf, sal_Size nSrcBytes,
     222             :                              sal_Unicode* pDestBuf, sal_Size nDestChars,
     223             :                              sal_uInt32 nFlags, sal_uInt32* pInfo,
     224             :                              sal_Size* pSrcCvtBytes );
     225             : sal_Size ImplUnicodeToEUCJP( const void* pData,
     226             :                              void* pContext,
     227             :                              const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
     228             :                              char* pDestBuf, sal_Size nDestBytes,
     229             :                              sal_uInt32 nFlags, sal_uInt32* pInfo,
     230             :                              sal_Size* pSrcCvtChars );
     231             : void* ImplUTF7CreateUTF7TextToUnicodeContext();
     232             : void ImplUTF7DestroyTextToUnicodeContext( void* pContext );
     233             : void ImplUTF7ResetTextToUnicodeContext( void* pContext );
     234             : sal_Size ImplUTF7ToUnicode( const void* pData, void* pContext,
     235             :                             const char* pSrcBuf, sal_Size nSrcBytes,
     236             :                             sal_Unicode* pDestBuf, sal_Size nDestChars,
     237             :                             sal_uInt32 nFlags, sal_uInt32* pInfo,
     238             :                             sal_Size* pSrcCvtBytes );
     239             : void* ImplUTF7CreateUnicodeToTextContext();
     240             : void ImplUTF7DestroyUnicodeToTextContext( void* pContext );
     241             : void ImplUTF7ResetUnicodeToTextContext( void* pContext );
     242             : sal_Size ImplUnicodeToUTF7( const void* pData, void* pContext,
     243             :                             const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
     244             :                             char* pDestBuf, sal_Size nDestBytes,
     245             :                             sal_uInt32 nFlags, sal_uInt32* pInfo,
     246             :                             sal_Size* pSrcCvtChars );
     247             : 
     248             : #endif
     249             : 
     250             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10