mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 20:10:56 +00:00
24 lines
512 B
C
24 lines
512 B
C
|
|
#if !defined( INCLUDED_CHARACTER_H )
|
|
#define INCLUDED_CHARACTER_H
|
|
|
|
/// \file
|
|
/// \brief Character encoding.
|
|
|
|
/// \brief Returns true if \p c is an ASCII character that can be represented with 7 bits.
|
|
inline bool char_is_ascii( char c ){
|
|
return ( c & 0x80 ) == 0;
|
|
}
|
|
|
|
/// \brief Returns true if \p string consists entirely of ASCII characters.
|
|
inline bool string_is_ascii( const char* string ){
|
|
while ( *string != '\0' )
|
|
{
|
|
if ( !char_is_ascii( *string++ ) ) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
#endif
|