本文整理汇总了C++中plString::ToUtf16方法的典型用法代码示例。如果您正苦于以下问题:C++ plString::ToUtf16方法的具体用法?C++ plString::ToUtf16怎么用?C++ plString::ToUtf16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plString
的用法示例。
在下文中一共展示了plString::ToUtf16方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteSafeWStringLong
uint32_t hsStream::WriteSafeWStringLong(const plString &string)
{
plStringBuffer<uint16_t> wbuff = string.ToUtf16();
uint32_t len = wbuff.GetSize();
WriteLE32(len);
if (len > 0)
{
const uint16_t *buffp = wbuff.GetData();
for (uint32_t i=0; i<len; i++)
{
WriteLE16(~buffp[i]);
}
WriteLE16(static_cast<uint16_t>(0));
}
return 0;
}
示例2: WriteSafeWString
uint32_t hsStream::WriteSafeWString(const plString &string)
{
plStringBuffer<uint16_t> wbuff = string.ToUtf16();
uint32_t len = wbuff.GetSize();
hsAssert(len<0xf000, plString::Format("string len of %d is too long for WriteSafeWString, use WriteSafeWStringLong",
len).c_str() );
WriteLE16(len | 0xf000);
if (len > 0)
{
const uint16_t *buffp = wbuff.GetData();
for (uint32_t i=0; i<len; i++)
{
WriteLE16(~buffp[i]);
}
WriteLE16(static_cast<uint16_t>(0));
}
return 0;
}