本文整理汇总了C++中ObjectData::o_toArray方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectData::o_toArray方法的具体用法?C++ ObjectData::o_toArray怎么用?C++ ObjectData::o_toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectData
的用法示例。
在下文中一共展示了ObjectData::o_toArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasInternalReference
bool ArrayData::hasInternalReference(PointerSet &vars) const {
if (supportValueRef()) {
for (ArrayIter iter(this); iter; ++iter) {
CVarRef var = iter.secondRef();
if (var.isReferenced()) {
Variant *pvar = var.getVariantData();
if (vars.find(pvar) != vars.end()) {
return true;
}
vars.insert(pvar);
}
if (var.isObject()) {
ObjectData *pobj = var.getObjectData();
if (vars.find(pobj) != vars.end()) {
return true;
}
vars.insert(pobj);
if (pobj->o_toArray().get()->hasInternalReference(vars)) {
return true;
}
} else if (var.isArray() &&
var.getArrayData()->hasInternalReference(vars)) {
return true;
}
}
}
return false;
}
示例2: convertObj
SharedVariant* SharedVariant::convertObj(CVarRef var) {
if (!var.is(KindOfObject) || getObjAttempted()) {
return NULL;
}
setObjAttempted();
PointerSet seen;
ObjectData *obj = var.getObjectData();
CArrRef arr = obj->o_toArray();
if (arr->hasInternalReference(seen, true)) {
return NULL;
}
SharedVariant *tmp = new SharedVariant(var, false, true, true);
tmp->setObjAttempted();
return tmp;
}
示例3: convertObj
SharedVariant* SharedVariant::convertObj(CVarRef var) {
if (!var.is(KindOfObject) || getObjAttempted()) {
return NULL;
}
setObjAttempted();
PointerSet seen;
ObjectData *obj = var.getObjectData();
if (obj->o_instanceof("Serializable")) {
// should also check the object itself
return NULL;
}
CArrRef arr = obj->o_toArray();
if (arr->hasInternalReference(seen, true)) {
return NULL;
}
SharedVariant *tmp = new SharedVariant(var, false, true, true);
tmp->setObjAttempted();
return tmp;
}
示例4: hasInternalReference
bool ArrayData::hasInternalReference(PointerSet &vars,
bool ds /* = false */) const {
if (isSharedMap()) return false;
for (ArrayIter iter(this); iter; ++iter) {
CVarRef var = iter.secondRef();
if (var.isReferenced()) {
Variant *pvar = var.getVariantData();
if (vars.find(pvar) != vars.end()) {
return true;
}
vars.insert(pvar);
}
if (var.isObject()) {
ObjectData *pobj = var.getObjectData();
if (vars.find(pobj) != vars.end()) {
return true;
}
vars.insert(pobj);
if (pobj->o_instanceof("Serializable")) {
if (ds) {
// We want to detect Serializable object as well
return true;
} else {
// Serializable object does not have internal reference issue
return false;
}
}
if (pobj->o_toArray().get()->hasInternalReference(vars, ds)) {
return true;
}
} else if (var.isArray() &&
var.getArrayData()->hasInternalReference(vars, ds)) {
return true;
}
}
return false;
}