Exemplo n.º 1
0
U16 * EditText::MBCSToWide(char *buffer, int index, int count)
{
	U16 *result = new U16[count + 1];

	U16 *dst = result;
	U8 *src = (U8*)buffer + index;

	while ( count )
	{
		if ( IsLeadByte(*src) && count > 1 )
		{
			*dst++ = ((U16)*src<<8) | *(src+1);
			src += 2;
			count -= 2;
		}
		else
		{
			*dst++ = *src++;
			count--;
		}
	}
	*dst = 0;

	return result;
}
Exemplo n.º 2
0
void XXVar::StringLength(XBOOL doMultiByte)
{
	ToString(XFALSE);
	
	int count=0;
	XPTSTR string=strTxt;
	if (!doMultiByte || !IsMultiByte()) {
		count=strlen(string);
	} else {
		int count = 0;
		while (*string) {
			count++;
			if (IsLeadByte(*string)) {
				string++;
				if (!*string) { break; }
			}
			string++;
		}
		//return count;
	}
	Release();
	//delete strData;
	nType=XODT_INT;
	iData32=count;
	//XString8 str(strData,STRING_ATTACH);
	//nType=XODT_INT;
	//iData32=str.GetLength();
}
Exemplo n.º 3
0
XPTSTR XXVar::StringIndex(XPTSTR string, int index)
{
	while (index--) {
		if (IsLeadByte(*string)) {
			string++;
			if (!*string) { break; }
		}
		string++;
	}
	return string;
}
Exemplo n.º 4
0
ucs4_t WXMEncodingDoubleByte::MultiBytetoUCS4(const wxByte* buf)
{
	wxWord dbtmp = (buf[0] << 8) | buf[1];
	ucs4_t uinfo = m_dbfix->MB2UInfo(dbtmp);
	if (uinfo != (ucs4_t)svtUCS4NotCached)
		return uinfo;

	if( IsLeadByte(buf[0]))
		return m_db2u_tab[buf[0]][buf[1]];

	return (buf[1] == '\0')? m_b2u_tab[buf[0]]: (ucs4_t)svtInvaliad;
}
Exemplo n.º 5
0
// perform AnsiNext on all platforms
extern char * XStrInc(char * pch)
{
    return IsLeadByte(*pch) ? pch + 2 : pch + 1;
}