LCOV - code coverage report
Current view: top level - sal/textenc - unichars.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 14 14 100.0 %
Date: 2014-11-03 Functions: 6 6 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             : #ifndef INCLUDED_SAL_TEXTENC_UNICHARS_HXX
      21             : #define INCLUDED_SAL_TEXTENC_UNICHARS_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : #include <cassert>
      25             : #include "sal/types.h"
      26             : 
      27             : #define RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER 0xFFFD
      28             : 
      29    45820324 : inline bool ImplIsNoncharacter(sal_uInt32 nUtf32)
      30             : {
      31       11274 :     return (nUtf32 >= 0xFDD0 && nUtf32 <= 0xFDEF)
      32    45820324 :            || (nUtf32 & 0xFFFF) >= 0xFFFE
      33    91640644 :            || nUtf32 > 0x10FFFF;
      34             : }
      35             :     // All code points that are noncharacters, as of Unicode 3.1.1.
      36             : 
      37             : bool ImplIsControlOrFormat(sal_uInt32 nUtf32);
      38             : 
      39    46200419 : inline bool ImplIsHighSurrogate(sal_uInt32 nUtf32)
      40    46200419 : { return nUtf32 >= 0xD800 && nUtf32 <= 0xDBFF; }
      41             :     // All code points that are high-surrogates, as of Unicode 3.1.1.
      42             : 
      43    45820336 : inline bool ImplIsLowSurrogate(sal_uInt32 nUtf32)
      44    45820336 : { return nUtf32 >= 0xDC00 && nUtf32 <= 0xDFFF; }
      45             :     // All code points that are low-surrogates, as of Unicode 3.1.1.
      46             : 
      47             : bool ImplIsPrivateUse(sal_uInt32 nUtf32);
      48             : 
      49             : bool ImplIsZeroWidth(sal_uInt32 nUtf32);
      50             : 
      51          18 : inline sal_uInt32 ImplGetHighSurrogate(sal_uInt32 nUtf32)
      52             : {
      53             :     assert(nUtf32 >= 0x10000);
      54          18 :     return ((nUtf32 - 0x10000) >> 10) | 0xD800;
      55             : }
      56             : 
      57          18 : inline sal_uInt32 ImplGetLowSurrogate(sal_uInt32 nUtf32)
      58             : {
      59             :     assert(nUtf32 >= 0x10000);
      60          18 :     return ((nUtf32 - 0x10000) & 0x3FF) | 0xDC00;
      61             : }
      62             : 
      63          12 : inline sal_uInt32 ImplCombineSurrogates(sal_uInt32 nHigh, sal_uInt32 nLow)
      64             : {
      65             :     assert(ImplIsHighSurrogate(nHigh) && ImplIsLowSurrogate(nLow));
      66          12 :     return (((nHigh & 0x3FF) << 10) | (nLow & 0x3FF)) + 0x10000;
      67             : }
      68             : 
      69             : #endif
      70             : 
      71             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10