]> git.lyx.org Git - lyx.git/blob - src/support/textutils.h
MacOSX compile fix.
[lyx.git] / src / support / textutils.h
1 // -*- C++ -*-
2 /**
3  * \file textutils.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Matthias Ettrich
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 // FIXME: I can think of a better name for this file ...
14
15 #ifndef TEXTUTILS_H
16 #define TEXTUTILS_H
17
18 #include "support/types.h"
19
20 /// return true if the char is a line separator
21 inline
22 bool isLineSeparatorChar(lyx::char_type c)
23 {
24         return c == ' ';
25 }
26
27
28 /// return true if a char is alphabetical (including accented chars)
29 inline
30 bool isLetterChar(lyx::char_type c)
31 {
32         return (c >= 'A' && c <= 'Z')
33                 || (c >= 'a' && c <= 'z')
34                 || (c >= 192 && c < 256); // in iso-8859-x these are accented chars
35 }
36
37
38 /// return true if the char is printable (masked to 7-bit ASCII)
39 inline
40 bool isPrintable(lyx::char_type c)
41 {
42         return (c & 127) >= ' ';
43 }
44
45
46 /// return true if the char is printable and not a space (masked to 7-bit ASCII)
47 inline
48 bool isPrintableNonspace(lyx::char_type c)
49 {
50         return isPrintable(c) && c != ' ';
51 }
52
53 /// return true if a unicode char is a digit.
54 inline
55 bool isDigit(lyx::char_type ch)
56 {
57         return ch >= '0' && ch <= '9';
58 }
59
60
61 #endif // TEXTUTILS_H