本文整理汇总了C++中OSArray::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ OSArray::serialize方法的具体用法?C++ OSArray::serialize怎么用?C++ OSArray::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSArray
的用法示例。
在下文中一共展示了OSArray::serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kmod_start
volatile int kmod_start(void)
{
libkern_init0();
OSString* one = OSString::withCString("Anal sex");
OSString* two = OSString::withCString("Cunnilingus");
OSArray* sexthings = OSArray::withCapacity(2);
sexthings->setObject(one);
sexthings->setObject(two);
printk("Hello from IOKit!\n");
printk("Put: %p %p\n", one, two);
printk("OSArray: %p\n", sexthings);
printk("Get: %p %p\n", sexthings->getObject(0), sexthings->getObject(1));
OSSerialize* ser = OSSerialize::withCapacity(1024);
sexthings->serialize(ser);
printk("Serialized: %s \n", ser->text());
return 0;
}
示例2: serialize
bool IORangeAllocator::serialize(OSSerialize *s) const
{
OSArray * array = OSArray::withCapacity( numElements * 2 );
OSNumber * num;
UInt32 index;
bool ret;
if( !array)
return( false );
LOCK();
for( index = 0; index < numElements; index++) {
if( (num = OSNumber::withNumber( elements[index].start,
8 * sizeof(IORangeScalar) ))) {
array->setObject(num);
num->release();
}
if( (num = OSNumber::withNumber( elements[index].end,
8 * sizeof(IORangeScalar) ))) {
array->setObject(num);
num->release();
}
}
UNLOCK();
ret = array->serialize(s);
array->release();
return( ret );
}