header movement #1 - reduced usage of TextParsers.h

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401412
This commit is contained in:
David Anderson
2007-09-11 15:10:18 +00:00
parent 269c0f2877
commit 017da078ef
13 changed files with 63 additions and 55 deletions
+29
View File
@@ -362,7 +362,36 @@ namespace SourceMod
* @return Number of bytes in current character.
*/
virtual unsigned int GetUTF8CharBytes(const char *stream) =0;
/**
* @brief Returns whether the first multi-byte character in the given stream
* is a whitespace character.
*
* @param stream Pointer to multi-byte character string.
* @return True if first character is whitespace, false otherwise.
*/
virtual bool IsWhitespace(const char *stream) =0;
};
inline unsigned int _GetUTF8CharBytes(const char *stream)
{
unsigned char c = *(unsigned char *)stream;
if (c & (1<<7))
{
if (c & (1<<5))
{
if (c & (1<<4))
{
return 4;
}
return 3;
}
return 2;
}
return 1;
}
}
extern SourceMod::ITextParsers *textparsers;
#endif //_INCLUDE_SOURCEMOD_TEXTPARSERS_INTERFACE_H_