本文整理汇总了C++中StringBuffer::GetDataPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::GetDataPointer方法的具体用法?C++ StringBuffer::GetDataPointer怎么用?C++ StringBuffer::GetDataPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::GetDataPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BEGIN_NATIVE_FUNCTION
END_NATIVE_FUNCTION
AVES_API BEGIN_NATIVE_FUNCTION(aves_StringBuffer_set_item)
{
Aves *aves = Aves::Get(thread);
StringBuffer *buf = THISV.Get<StringBuffer>();
CHECKED(IntFromValue(thread, args + 1));
if (args[2].type != aves->aves.Char)
{
VM_PushString(thread, strings::value); // paramName
return VM_ThrowErrorOfType(thread, aves->aves.ArgumentTypeError, 1);
}
if (args[1].v.integer < 0 || args[1].v.integer >= buf->GetLength())
{
VM_PushString(thread, strings::index); // paramName
return VM_ThrowErrorOfType(thread, aves->aves.ArgumentRangeError, 1);
}
if (args[2].v.uinteger > 0xFFFF)
{
VM_PushString(thread, strings::value);
return VM_ThrowErrorOfType(thread, aves->aves.ArgumentRangeError, 1);
}
size_t index = (size_t)args[1].v.integer;
buf->GetDataPointer()[index] = (ovchar_t)args[2].v.uinteger;
}
示例2: NATIVE_FUNCTION
AVES_API NATIVE_FUNCTION(aves_StringBuffer_toStringSubstring)
{
// toStringSubstr(start is Int, count is Int)
// The public-facing method range-checks the values.
StringBuffer *buf = THISV.Get<StringBuffer>();
size_t start = (size_t)args[1].v.integer;
size_t count = (size_t)args[2].v.integer;
String *result = GC_ConstructString(thread, count, buf->GetDataPointer() + start);
if (!result)
return VM_ThrowMemoryError(thread);
VM_PushString(thread, result);
RETURN_SUCCESS;
}