Page MenuHomePhabricator

Scott's Secret Sauce #1
ActivePublic

Authored by jcmcdonald on Mar 10 2018, 7:28 PM.
void OneString::append(const char* ostr)
{
// Can tell how many bytes by masking the first character
switch(ostr[index] & 0xF0)
{
case 0xF0 :
{
// Insert a 4 byte Unicode Char into the OneString
parseChar(ostr, index, 4);
index+=4;
break;
}
case 0xE0 :
{
// Insert a 3 byte Unicode Char into the OneString
parseChar(ostr, index, 3);
index+=3;
break;
}
case 0xC0:
{
// Insert a 2 byte Unicode Char into the OneString
parseChar(ostr, index, 2);
index+=2;
break;
}
case 0x80:
{
ioc << cat_error << ta_bold << fg_red <<
"OneString Error: Invalid Character In String At Position: " << index << io_end;
return;
}
default :
{
// Insert a standard char
parseChar(ostr, index, 1);
++index;
}
}