LCOV - code coverage report
Current view: top level - libreoffice/tools/source/string - tenccvt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 27 70.4 %
Date: 2012-12-27 Functions: 4 5 80.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 <rtl/tencinfo.h>
      21             : #include <tools/tenccvt.hxx>
      22             : 
      23        1671 : rtl_TextEncoding GetExtendedCompatibilityTextEncoding( rtl_TextEncoding eEncoding )
      24             : {
      25             :     // Latin1
      26        1671 :     if ( eEncoding == RTL_TEXTENCODING_ISO_8859_1 )
      27           1 :         return RTL_TEXTENCODING_MS_1252;
      28             :     // Turkey
      29        1670 :     else if ( eEncoding == RTL_TEXTENCODING_ISO_8859_9 )
      30           0 :         return RTL_TEXTENCODING_MS_1254;
      31             :     else
      32        1670 :         return eEncoding;
      33             : }
      34             : 
      35        1670 : rtl_TextEncoding GetExtendedTextEncoding( rtl_TextEncoding eEncoding )
      36             : {
      37             :     // Cyr
      38        1670 :     if ( eEncoding == RTL_TEXTENCODING_ISO_8859_5 )
      39           0 :         return RTL_TEXTENCODING_MS_1251;
      40             :     // Greek (2 Characters different: A1 (0x2018/0x0385), A2 (0x2019/0x0386) -
      41             :     // so it is handled in this function and not in GetExtendedCompatibilityTextEncoding)
      42        1670 :     else if ( eEncoding == RTL_TEXTENCODING_ISO_8859_7 )
      43           0 :         return RTL_TEXTENCODING_MS_1253;
      44             :     // East-Europe - Latin2
      45        1670 :     else if ( eEncoding == RTL_TEXTENCODING_ISO_8859_2 )
      46           0 :         return RTL_TEXTENCODING_MS_1250;
      47             :     // Latin-15 - Latin 1 mit Euro-Sign
      48        1670 :     else if ( eEncoding == RTL_TEXTENCODING_ISO_8859_15 )
      49           0 :         return RTL_TEXTENCODING_MS_1252;
      50             :     else
      51        1670 :         return GetExtendedCompatibilityTextEncoding( eEncoding );
      52             : }
      53             : 
      54        1488 : rtl_TextEncoding GetOneByteTextEncoding( rtl_TextEncoding eEncoding )
      55             : {
      56             :     rtl_TextEncodingInfo aTextEncInfo;
      57        1488 :     aTextEncInfo.StructSize = sizeof( aTextEncInfo );
      58        1488 :     if ( rtl_getTextEncodingInfo( eEncoding, &aTextEncInfo ) )
      59             :     {
      60        1402 :         if ( aTextEncInfo.MaximumCharSize > 1 )
      61        1402 :             return RTL_TEXTENCODING_MS_1252;
      62             :         else
      63           0 :             return eEncoding;
      64             :     }
      65             :     else
      66          86 :         return RTL_TEXTENCODING_MS_1252;
      67             : }
      68             : 
      69           0 : rtl_TextEncoding GetSOLoadTextEncoding( rtl_TextEncoding eEncoding )
      70             : {
      71           0 :     return GetExtendedCompatibilityTextEncoding( GetOneByteTextEncoding( eEncoding ) );
      72             : }
      73             : 
      74        1488 : rtl_TextEncoding GetSOStoreTextEncoding( rtl_TextEncoding eEncoding )
      75             : {
      76        1488 :     return GetExtendedTextEncoding( GetOneByteTextEncoding( eEncoding ) );
      77             : }
      78             : 
      79             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10