LibreOffice
LibreOffice 4.1 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
character.hxx
Go to the documentation of this file.
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 {
37 inline bool isAscii(sal_uInt32 nUtf32)
38 {
39  return nUtf32 <= 0x7F;
40 }
41 
51 inline bool isAsciiLowerCase(sal_uInt32 nUtf32)
52 {
53  return nUtf32 >= 'a' && nUtf32 <= 'z';
54 }
55 
65 inline bool isAsciiUpperCase(sal_uInt32 nUtf32)
66 {
67  return nUtf32 >= 'A' && nUtf32 <= 'Z';
68 }
69 
79 inline bool isAsciiAlpha(sal_uInt32 nUtf32)
80 {
81  return isAsciiLowerCase(nUtf32) || isAsciiUpperCase(nUtf32);
82 }
83 
93 inline bool isAsciiDigit(sal_uInt32 nUtf32)
94 {
95  return nUtf32 >= '0' && nUtf32 <= '9';
96 }
97 
107 inline bool isAsciiAlphanumeric(sal_uInt32 nUtf32)
108 {
109  return isAsciiDigit(nUtf32) || isAsciiAlpha(nUtf32);
110 }
111 
121 inline bool isAsciiCanonicHexDigit(sal_uInt32 nUtf32)
122 {
123  return isAsciiDigit(nUtf32) || (nUtf32 >= 'A' && nUtf32 <= 'F');
124 }
125 
135 inline bool isAsciiHexDigit(sal_uInt32 nUtf32)
136 {
137  return isAsciiCanonicHexDigit(nUtf32) || (nUtf32 >= 'a' && nUtf32 <= 'f');
138 }
139 
140 }//rtl namespace
141 
142 #endif
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool isAsciiAlpha(sal_uInt32 nUtf32)
Check for ASCII alphanumeric character.
Definition: character.hxx:79
bool isAscii(sal_uInt32 nUtf32)
Check for ASCII character.
Definition: character.hxx:37
bool isAsciiDigit(sal_uInt32 nUtf32)
Check for ASCII digit character.
Definition: character.hxx:93
bool isAsciiCanonicHexDigit(sal_uInt32 nUtf32)
Check for US-ASCII canonic hexadecimal digit character.
Definition: character.hxx:121
bool isAsciiLowerCase(sal_uInt32 nUtf32)
Check for ASCII lower case character.
Definition: character.hxx:51
bool isAsciiUpperCase(sal_uInt32 nUtf32)
Check for US-ASCII upper case character.
Definition: character.hxx:65
bool isAsciiHexDigit(sal_uInt32 nUtf32)
Check for US-ASCII hexadecimal digit character.
Definition: character.hxx:135
bool isAsciiAlphanumeric(sal_uInt32 nUtf32)
Check for US-ASCII alphanumeric character.
Definition: character.hxx:107