本文整理汇总了C++中DataDesc类的典型用法代码示例。如果您正苦于以下问题:C++ DataDesc类的具体用法?C++ DataDesc怎么用?C++ DataDesc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataDesc类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetData
UInt32 String::GetFirstCharAt(UPInt index, const char** offset) const
{
DataDesc* pdata = GetData();
SPInt i = (SPInt) index;
const char* buf = pdata->Data;
const char* end = buf + pdata->GetSize();
UInt32 c;
do
{
c = UTF8Util::DecodeNextChar_Advance0(&buf);
i--;
if (buf >= end)
{
// We've hit the end of the string; don't go further.
OVR_ASSERT(i == 0);
return c;
}
} while (i >= 0);
*offset = buf;
return c;
}
示例2: GetData
void String::operator = (const wchar_t* pwstr)
{
pwstr = pwstr ? pwstr : L"";
DataDesc* poldData = GetData();
size_t size = (size_t)UTF8Util::GetEncodeStringSize(pwstr);
DataDesc* pnewData = AllocData(size, 0);
UTF8Util::EncodeString(pnewData->Data, pwstr);
SetData(pnewData);
poldData->Release();
}
示例3: GetLength
String String::Substring(UPInt start, UPInt end) const
{
UPInt length = GetLength();
if ((start >= length) || (start >= end))
return String();
DataDesc* pdata = GetData();
// If size matches, we know the exact index range.
if (pdata->LengthIsSize())
return String(pdata->Data + start, end - start);
// Get position of starting character.
SPInt byteStart = UTF8Util::GetByteIndex(start, pdata->Data, pdata->GetSize());
SPInt byteSize = UTF8Util::GetByteIndex(end - start, pdata->Data + byteStart, pdata->GetSize()-byteStart);
return String(pdata->Data + byteStart, (UPInt)byteSize);
}