Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "strimp.hxx"
30 : :
31 : 3754623 : sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix )
32 : : {
33 : 3754623 : sal_Int16 n = -1;
34 [ + + ][ + + ]: 3754623 : if ( (ch >= '0') && (ch <= '9') )
35 : 3648074 : n = ch-'0';
36 [ + + ][ + - ]: 106549 : else if ( (ch >= 'a') && (ch <= 'z') )
37 : 15681 : n = ch-'a'+10;
38 [ + + ][ + + ]: 90868 : else if ( (ch >= 'A') && (ch <= 'Z') )
39 : 26226 : n = ch-'A'+10;
40 [ + + ]: 3754623 : return (n < nRadix) ? n : -1;
41 : : }
42 : :
43 : 4511968 : sal_Bool rtl_ImplIsWhitespace( sal_Unicode c )
44 : : {
45 : : /* Space or Control character? */
46 [ + + ][ + - ]: 4511968 : if ( (c <= 32) && c )
47 : 1037361 : return sal_True;
48 : :
49 : : /* Only in the General Punctuation area Space or Control characters are included? */
50 [ + + ][ + + ]: 3474607 : if ( (c < 0x2000) || (c > 0x206F) )
51 : 3474589 : return sal_False;
52 : :
53 [ + - ][ + - ]: 18 : if ( ((c >= 0x2000) && (c <= 0x200B)) || /* All Spaces */
[ + - ][ - + ]
54 : : (c == 0x2028) || /* LINE SEPARATOR */
55 : : (c == 0x2029) ) /* PARAGRAPH SEPARATOR */
56 : 0 : return sal_True;
57 : :
58 : 4511968 : return sal_False;
59 : : }
60 : :
61 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|