예제 #1
0
/*
 * Check if UTF-8 character 'c' fits one item of the 'intervals'.array.
 */
bool
isXMLCharInInterval(char *c, UTF8Interval * intervals, unsigned short int intCount)
{
	unsigned short int i;
	UTF8Interval *interval = intervals;

	for (i = 0; i < intCount; i++)
	{
		if (utf8cmp(c, interval->first) >= 0 && utf8cmp(c, interval->last) <= 0)
		{
			return true;
		}
		interval++;
	}
	return false;
}
예제 #2
0
파일: String.hpp 프로젝트: angelog/Scratch
bool String::operator!=(const char* szSrc) const
{
	MUTEX_LOCK(str_mutex);

#ifdef SCRATCH_NO_UTF8
	return strcmp(this->str_szBuffer, szSrc) != 0;
#else
	return utf8cmp(this->str_szBuffer, szSrc) != 0;
#endif
}
예제 #3
0
파일: String.hpp 프로젝트: angelog/Scratch
bool String::EndsWith(const String &strNeedle) const
{
	MUTEX_LOCK(str_mutex);
	MUTEX_LOCK_NAMED(wait2, strNeedle.str_mutex);

	// Get the offset
#ifdef SCRATCH_NO_UTF8
	const char* szTemp = this->str_szBuffer + strlen(this->str_szBuffer) - strlen(strNeedle);
#else
	const char* szTemp = this->str_szBuffer + (utf8size(this->str_szBuffer) - 1) - (utf8size(strNeedle) - 1);
#endif

	// Make sure the needle is found
	if (szTemp == nullptr) {
		return false;
	}

	// Then compare the offset with our needle
#ifdef SCRATCH_NO_UTF8
	return !strcmp(strNeedle, szTemp);
#else
	return !utf8cmp(strNeedle, szTemp);
#endif
}