24 #ifndef INCLUDED_RTL_CHARACTER_HXX 25 #define INCLUDED_RTL_CHARACTER_HXX 34 #if defined LIBO_INTERNAL_ONLY 35 #include <type_traits> 64 #if defined LIBO_INTERNAL_ONLY 66 bool isAscii(
signed char) =
delete;
68 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
71 return isAscii(sal_uInt32(code));
87 return code >=
'a' && code <=
'z';
90 #if defined LIBO_INTERNAL_ONLY 94 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
113 return code >=
'A' && code <=
'Z';
116 #if defined LIBO_INTERNAL_ONLY 119 template <
typename T>
120 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
142 #if defined LIBO_INTERNAL_ONLY 145 template <
typename T>
146 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
165 return code >=
'0' && code <=
'9';
168 #if defined LIBO_INTERNAL_ONLY 171 template <
typename T>
172 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
194 #if defined LIBO_INTERNAL_ONLY 197 template <
typename T>
198 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
217 return isAsciiDigit(code) || (code >=
'A' && code <=
'F');
220 #if defined LIBO_INTERNAL_ONLY 223 template <
typename T>
224 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
246 #if defined LIBO_INTERNAL_ONLY 249 template <
typename T>
250 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
268 return code >=
'0' && code <=
'7';
271 #if defined LIBO_INTERNAL_ONLY 274 template <
typename T>
275 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
294 return code ==
' ' || code ==
'\f' || code ==
'\n' || code ==
'\r' || code ==
'\t' 298 #if defined LIBO_INTERNAL_ONLY 301 template <
typename T>
302 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
bool>
323 #if defined LIBO_INTERNAL_ONLY 326 template <
typename T>
327 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
349 #if defined LIBO_INTERNAL_ONLY 352 template <
typename T>
353 inline constexpr std::enable_if_t<std::is_integral_v<T> &&
sizeof(T) <=
sizeof(sal_uInt32),
384 sal_uInt32
const surrogatesHighFirst = 0xD800;
385 sal_uInt32
const surrogatesHighLast = 0xDBFF;
386 sal_uInt32
const surrogatesLowFirst = 0xDC00;
387 sal_uInt32
const surrogatesLowLast = 0xDFFF;
402 return code >= detail::surrogatesHighFirst && code <= detail::surrogatesLowLast;
416 return code >= detail::surrogatesHighFirst && code <= detail::surrogatesHighLast;
430 return code >= detail::surrogatesLowFirst && code <= detail::surrogatesLowLast;
444 assert(code >= 0x10000);
445 return static_cast<sal_Unicode>(((code - 0x10000) >> 10) | detail::surrogatesHighFirst);
459 assert(code >= 0x10000);
460 return static_cast<sal_Unicode>(((code - 0x10000) & 0x3FF) | detail::surrogatesLowFirst);
477 return ((high - detail::surrogatesHighFirst) << 10) + (low - detail::surrogatesLowFirst)
496 assert(output != NULL);
SAL_CONSTEXPR bool isAsciiLowerCase(sal_uInt32 code)
Check for ASCII lower case character.
Definition: character.hxx:84
SAL_CONSTEXPR sal_Unicode getLowSurrogate(sal_uInt32 code)
Get low surrogate half of a non-BMP Unicode code point.
Definition: character.hxx:456
SAL_CONSTEXPR bool isLowSurrogate(sal_uInt32 code)
Check for low surrogate.
Definition: character.hxx:427
SAL_CONSTEXPR bool isAsciiCanonicHexDigit(sal_uInt32 code)
Check for ASCII canonic hexadecimal digit character.
Definition: character.hxx:214
SAL_CONSTEXPR sal_uInt32 toAsciiLowerCase(sal_uInt32 code)
Convert a character, if ASCII, to lower case.
Definition: character.hxx:343
SAL_CONSTEXPR bool isAsciiOctalDigit(sal_uInt32 code)
Check for ASCII octal digit character.
Definition: character.hxx:265
SAL_CONSTEXPR bool isAsciiAlphanumeric(sal_uInt32 code)
Check for ASCII alphanumeric character.
Definition: character.hxx:188
SAL_CONSTEXPR bool isAsciiDigit(sal_uInt32 code)
Check for ASCII digit character.
Definition: character.hxx:162
SAL_CONSTEXPR sal_Int32 compareIgnoreAsciiCase(sal_uInt32 code1, sal_uInt32 code2)
Compare two characters ignoring ASCII case.
Definition: character.hxx:373
SAL_CONSTEXPR bool isAsciiHexDigit(sal_uInt32 code)
Check for ASCII hexadecimal digit character.
Definition: character.hxx:240
sal_uInt16 sal_Unicode
Definition: types.h:123
SAL_CONSTEXPR sal_uInt32 toAsciiUpperCase(sal_uInt32 code)
Convert a character, if ASCII, to upper case.
Definition: character.hxx:317
SAL_CONSTEXPR bool isSurrogate(sal_uInt32 code)
Check for surrogate.
Definition: character.hxx:399
SAL_CONSTEXPR bool isUnicodeCodePoint(sal_uInt32 code)
Check for Unicode code point.
Definition: character.hxx:48
SAL_CONSTEXPR bool isAsciiUpperCase(sal_uInt32 code)
Check for ASCII upper case character.
Definition: character.hxx:110
Definition: bootstrap.hxx:33
SAL_CONSTEXPR bool isAsciiAlpha(sal_uInt32 code)
Check for ASCII alphabetic character.
Definition: character.hxx:136
SAL_CONSTEXPR std::size_t splitSurrogates(sal_uInt32 code, sal_Unicode *output)
Split a Unicode code point into UTF-16 code units.
Definition: character.hxx:493
SAL_CONSTEXPR bool isHighSurrogate(sal_uInt32 code)
Check for high surrogate.
Definition: character.hxx:413
SAL_CONSTEXPR bool isAsciiWhiteSpace(sal_uInt32 code)
Check for ASCII white space character.
Definition: character.hxx:291
SAL_CONSTEXPR sal_Unicode getHighSurrogate(sal_uInt32 code)
Get high surrogate half of a non-BMP Unicode code point.
Definition: character.hxx:441
#define SAL_CONSTEXPR
C++11 "constexpr" feature.
Definition: types.h:404
SAL_CONSTEXPR bool isUnicodeScalarValue(sal_uInt32 code)
Check for Unicode scalar value.
Definition: character.hxx:518
SAL_CONSTEXPR bool isAscii(sal_uInt32 code)
Check for ASCII character.
Definition: character.hxx:58
SAL_CONSTEXPR sal_uInt32 combineSurrogates(sal_uInt32 high, sal_uInt32 low)
Combine surrogates to form a code point.
Definition: character.hxx:473