本文整理汇总了C++中TiValue::asCell方法的典型用法代码示例。如果您正苦于以下问题:C++ TiValue::asCell方法的具体用法?C++ TiValue::asCell怎么用?C++ TiValue::asCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiValue
的用法示例。
在下文中一共展示了TiValue::asCell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operationGetByVal
EncodedTiValue operationGetByVal(TiExcState* exec, EncodedTiValue encodedBase, EncodedTiValue encodedProperty)
{
TiValue baseValue = TiValue::decode(encodedBase);
TiValue property = TiValue::decode(encodedProperty);
if (LIKELY(baseValue.isCell())) {
TiCell* base = baseValue.asCell();
if (property.isUInt32()) {
TiGlobalData* globalData = &exec->globalData();
uint32_t i = property.asUInt32();
// FIXME: the JIT used to handle these in compiled code!
if (isTiArray(globalData, base) && asArray(base)->canGetIndex(i))
return TiValue::encode(asArray(base)->getIndex(i));
// FIXME: the JITstub used to relink this to an optimized form!
if (isTiString(globalData, base) && asString(base)->canGetIndex(i))
return TiValue::encode(asString(base)->getIndex(exec, i));
// FIXME: the JITstub used to relink this to an optimized form!
if (isTiArrayArray(globalData, base) && asByteArray(base)->canAccessIndex(i))
return TiValue::encode(asByteArray(base)->getIndex(exec, i));
return TiValue::encode(baseValue.get(exec, i));
}
if (property.isString()) {
Identifier propertyName(exec, asString(property)->value(exec));
PropertySlot slot(base);
if (base->fastGetOwnPropertySlot(exec, propertyName, slot))
return TiValue::encode(slot.getValue(exec, propertyName));
}
}
Identifier ident(exec, property.toString(exec));
return TiValue::encode(baseValue.get(exec, ident));
}