]> git.lyx.org Git - lyx.git/blob - src/support/textutils.h
make "make distcheck" work
[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 /// return true if the char is a word separator
19 inline
20 bool IsSeparatorChar(char c)
21 {
22         return c == ' ';
23 }
24
25
26 /// return true if the char is a line separator
27 inline
28 bool IsLineSeparatorChar(char c)
29 {
30         return c == ' ';
31 }
32
33
34 /// return true if a char is alphabetical (including accented chars)
35 inline
36 bool IsLetterChar(unsigned char c)
37 {
38         return (c >= 'A' && c <= 'Z')
39                 || (c >= 'a' && c <= 'z')
40                 || (c >= 192); // in iso-8859-x these are accented chars
41 }
42
43
44 /// return true if the char is printable (masked to 7-bit ASCII)
45 inline
46 bool IsPrintable(unsigned char c)
47 {
48         return (c & 127) >= ' ';
49 }
50
51
52 /// return true if the char is printable and not a space (masked to 7-bit ASCII)
53 inline
54 bool IsPrintableNonspace(unsigned char c)
55 {
56         return IsPrintable(c) && c != ' ';
57 }
58
59
60 /// completely pointless FIXME
61 inline
62 bool IsDigit(unsigned char ch)
63 {
64         return ch >= '0' && ch <= '9';
65 }
66
67
68 #endif // TEXTUTILS_H