Пример #1
0
	void ExtractNextCodePoint()
	{
		next_it = it;

		if (end - next_it <= 0)
		{
			next_code_point = ::unicode_iterator::CP_END_OF_STREAM;
			return;
		}
		char16_t high = FromEndianness(endianness, *(next_it++));

		if (!IsSurrogate(high))
		{
			next_code_point = high;
			return;
		}

		if (!IsLead(high))
		{
			next_code_point = ::unicode_iterator::CP_CORRUPT;
			return;
		}

		if (end - next_it <= 0)
		{
			next_code_point = ::unicode_iterator::CP_END_OF_STREAM;
			return;
		}
		char16_t low = FromEndianness(endianness, *(next_it++));

		if (!IsTrail(low))
		{
			next_code_point = ::unicode_iterator::CP_CORRUPT;
			return;
		}

		next_code_point = (char32_t(high - 0xd800) << 10) + (low - 0xdc00);
	}
Пример #2
0
//---------------------------------------------------------------------------
BOOL __fastcall CMBCS::IsLead(const unsigned char *p)
{
	return IsLead(*p);
}