4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 // FIXME: I can think of a better name for this file ...
16 #include "support/textutils.h"
17 #include "support/qstring_helpers.h"
22 /// Maximum valid UCS4 code point
23 char_type const ucs4_max = 0x10ffff;
27 bool isLetterChar(char_type c)
31 // outside the UCS4 range
33 // assume that all non-utf16 characters are letters
36 return ucs4_to_qchar(c).isLetter();
40 bool isAlphaASCII(char_type c)
42 return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
46 bool isPrintable(char_type c)
50 // outside the UCS4 range
52 // assume that all non-utf16 characters are printable
55 return ucs4_to_qchar(c).isPrint();
59 bool isPrintableNonspace(char_type c)
63 // outside the UCS4 range
65 // assume that all non-utf16 characters are printable and
69 QChar const qc = ucs4_to_qchar(c);
70 return qc.isPrint() && !qc.isSpace();
74 bool isSpace(char_type c)
77 // assume that no non-utf16 character is a space
78 // c outside the UCS4 range is catched as well
81 QChar const qc = ucs4_to_qchar(c);
86 bool isDigit(char_type c)
89 // assume that no non-utf16 character is a digit
90 // c outside the UCS4 range is catched as well
92 return ucs4_to_qchar(c).isDigit();
96 bool isDigitASCII(char_type c)
98 return '0' <= c && c <= '9';