Make ASCII test more explicit.

I will need isASCII() in tex2lyx as well.
This commit is contained in:
Georg Baum 2012-12-29 14:30:18 +01:00
parent c51449cac6
commit 6c54a081fa
2 changed files with 11 additions and 2 deletions

View File

@ -170,6 +170,12 @@ bool isAlnumASCII(char_type c)
} }
bool isASCII(char_type c)
{
return c < 0x80;
}
namespace support { namespace support {
int compare_no_case(docstring const & s, docstring const & s2) int compare_no_case(docstring const & s, docstring const & s2)
@ -403,14 +409,14 @@ bool isAscii(string const & str)
char lowercase(char c) char lowercase(char c)
{ {
LASSERT(static_cast<unsigned char>(c) < 0x80, /**/); LASSERT(isASCII(c), /**/);
return char(tolower(c)); return char(tolower(c));
} }
char uppercase(char c) char uppercase(char c)
{ {
LASSERT(static_cast<unsigned char>(c) < 0x80, /**/); LASSERT(isASCII(c), /**/);
return char(toupper(c)); return char(toupper(c));
} }

View File

@ -50,6 +50,9 @@ bool isDigitASCII(char_type c);
/// return whether \p c is alpha or a digit in the ASCII range /// return whether \p c is alpha or a digit in the ASCII range
bool isAlnumASCII(char_type c); bool isAlnumASCII(char_type c);
/// return whether \p c is in the ASCII range
bool isASCII(char_type c);
} // namespace lyx } // namespace lyx
#endif // TEXTUTILS_H #endif // TEXTUTILS_H