formatting

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4973 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-08-14 17:15:18 +00:00
parent f84e3d1296
commit b3992b9a64
2 changed files with 30 additions and 16 deletions

View File

@ -1,11 +1,15 @@
2002-08-14 Lars Gullik Bjønnes <larsbj@gullik.net>
* textutils.h: formatting.
2002-08-08 John Levon <levon@movementarian.org>
* limited_stack.h: default to 100 not 10
2002-08-01 John Levon <levon@movementarian.org>
* forkedcall.C: more details on error
2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
* lstrings.[hC]: rename stip to rtrim and frontStrip to ltrim,

View File

@ -8,48 +8,54 @@
*/
// FIXME: I can think of a better name for this file ...
#ifndef TEXTUTILS_H
#define TEXTUTILS_H
/// return true if the char is a meta-character newline
inline
bool IsNewlineChar(char c) {
bool IsNewlineChar(char c)
{
return (c == Paragraph::META_NEWLINE);
}
/// return true if the char is a word separator
inline
bool IsSeparatorChar(char c) {
bool IsSeparatorChar(char c)
{
return (c == ' ');
}
/// return true if the char is a line separator
inline
bool IsLineSeparatorChar(char c) {
bool IsLineSeparatorChar(char c)
{
return (c == ' ');
}
/// return true if the char is a meta-character for hfill
inline
bool IsHfillChar(char c) {
bool IsHfillChar(char c)
{
return (c == Paragraph::META_HFILL);
}
/// return true if the char is a meta-character for an inset
inline
bool IsInsetChar(char c) {
bool IsInsetChar(char c)
{
return (c == Paragraph::META_INSET);
}
/// return true if the char is "punctuation"
inline
bool IsKommaChar(char c) {
bool IsKommaChar(char c)
{
return (c == ','
|| c == '('
|| c == ')'
@ -80,7 +86,8 @@ bool IsKommaChar(char c) {
/// return true if a char is alphabetical (including accented chars)
inline
bool IsLetterChar(unsigned char c) {
bool IsLetterChar(unsigned char c)
{
return ((c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
|| (c >= 192)); // in iso-8859-x these are accented chars
@ -89,21 +96,24 @@ bool IsLetterChar(unsigned char c) {
/// return true if the char is printable (masked to 7-bit ASCII)
inline
bool IsPrintable(unsigned char c) {
bool IsPrintable(unsigned char c)
{
return ((c & 127) >= ' ');
}
/// return true if the char is printable and not a space (masked to 7-bit ASCII)
/// return true if the char is printable and not a space (masked to 7-bit ASCII)
inline
bool IsPrintableNonspace(unsigned char c) {
bool IsPrintableNonspace(unsigned char c)
{
return IsPrintable(c) && (c != ' ');
}
/// return true if the char forms part of a word
inline
bool IsWordChar(unsigned char c) {
bool IsWordChar(unsigned char c)
{
return !(IsSeparatorChar(c)
|| IsKommaChar(c)
|| IsHfillChar(c)
@ -125,5 +135,5 @@ bool IsLetterCharOrDigit(unsigned char ch)
{
return IsLetterChar(ch) || IsDigit(ch);
}
#endif // TEXTUTILS_H