LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/rtl - character.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 16 75.0 %
Date: 2013-07-09 Functions: 6 8 75.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_RTL_CHARACTER_HXX
      21             : #define INCLUDED_RTL_CHARACTER_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include "sal/types.h"
      26             : 
      27             : namespace rtl
      28             : {
      29             : /** Check for ASCII character.
      30             : 
      31             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
      32             : 
      33             :     @return  True if nChar is a ASCII character (0x00--0x7F).
      34             : 
      35             :     @since LibreOffice 4.1
      36             :  */
      37     9495774 : inline bool isAscii(sal_uInt32 nUtf32)
      38             : {
      39     9495774 :     return nUtf32 <= 0x7F;
      40             : }
      41             : 
      42             : /** Check for ASCII lower case character.
      43             : 
      44             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
      45             : 
      46             :     @return  True if nChar is a US-ASCII lower case alphabetic character
      47             :     (ASCII 'a'--'z').
      48             : 
      49             :     @since LibreOffice 4.1
      50             :  */
      51     1274353 : inline bool isAsciiLowerCase(sal_uInt32 nUtf32)
      52             : {
      53     1274353 :     return nUtf32 >= 'a' && nUtf32 <= 'z';
      54             : }
      55             : 
      56             : /** Check for US-ASCII upper case character.
      57             : 
      58             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
      59             : 
      60             :     @return  True if nChar is a US-ASCII upper case alphabetic character
      61             :     (US-ASCII 'A'--'Z').
      62             : 
      63             :     @since LibreOffice 4.1
      64             :  */
      65     4288709 : inline bool isAsciiUpperCase(sal_uInt32 nUtf32)
      66             : {
      67     4288709 :     return nUtf32 >= 'A' && nUtf32 <= 'Z';
      68             : }
      69             : 
      70             : /** Check for ASCII alphanumeric character.
      71             : 
      72             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
      73             : 
      74             :     @return  True if nUtf32 is a US-ASCII alphanumeric character
      75             :     (ASCII '0'--'9', 'A'--'Z' or 'a'--'z').
      76             : 
      77             :     @since LibreOffice 4.1
      78             :  */
      79     1274146 : inline bool isAsciiAlpha(sal_uInt32 nUtf32)
      80             : {
      81     1274146 :     return isAsciiLowerCase(nUtf32) || isAsciiUpperCase(nUtf32);
      82             : }
      83             : 
      84             : /** Check for ASCII digit character.
      85             : 
      86             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
      87             : 
      88             :     @return  True if nChar is a ASCII (decimal) digit character
      89             :     (ASCII '0'--'9').
      90             : 
      91             :     @since LibreOffice 4.1
      92             :  */
      93     1607539 : inline bool isAsciiDigit(sal_uInt32 nUtf32)
      94             : {
      95     1607539 :     return nUtf32 >= '0' && nUtf32 <= '9';
      96             : }
      97             : 
      98             : /** Check for US-ASCII alphanumeric character.
      99             : 
     100             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
     101             : 
     102             :     @return  True if nChar is a US-ASCII alphanumeric character (US-ASCII
     103             :     '0'--'9', 'A'--'Z' or 'a'--'z').
     104             : 
     105             :     @since LibreOffice 4.1
     106             :  */
     107      722227 : inline bool isAsciiAlphanumeric(sal_uInt32 nUtf32)
     108             : {
     109      722227 :     return isAsciiDigit(nUtf32) || isAsciiAlpha(nUtf32);
     110             : }
     111             : 
     112             : /** Check for US-ASCII canonic hexadecimal digit character.
     113             : 
     114             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
     115             : 
     116             :     @return  True if nChar is a US-ASCII canonic (i.e., upper case)
     117             :     hexadecimal digit character (US-ASCII '0'--'9' or 'A'--'F').
     118             : 
     119             :     @since LibreOffice 4.1
     120             :  */
     121           0 : inline bool isAsciiCanonicHexDigit(sal_uInt32 nUtf32)
     122             : {
     123           0 :     return isAsciiDigit(nUtf32) || (nUtf32 >= 'A' && nUtf32 <= 'F');
     124             : }
     125             : 
     126             : /** Check for US-ASCII hexadecimal digit character.
     127             : 
     128             :     @param nUtf32  A Unicode scalar value (represented as a UTF-32 code unit).
     129             : 
     130             :     @return  True if nChar is a US-ASCII hexadecimal digit character (US-
     131             :     ASCII '0'--'9', 'A'--'F', 'a'--'f').
     132             : 
     133             :     @since LibreOffice 4.1
     134             :  */
     135           0 : inline bool isAsciiHexDigit(sal_uInt32 nUtf32)
     136             : {
     137           0 :     return isAsciiCanonicHexDigit(nUtf32) || (nUtf32 >= 'a' && nUtf32 <= 'f');
     138             : }
     139             : 
     140             : }//rtl namespace
     141             : 
     142             : #endif
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10