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