本文整理汇总了C++中ScValue::cleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ ScValue::cleanup方法的具体用法?C++ ScValue::cleanup怎么用?C++ ScValue::cleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScValue
的用法示例。
在下文中一共展示了ScValue::cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setProp
bool ScValue::setProp(const char *name, ScValue *val, bool copyWhole, bool setAsConst) {
if (_type == VAL_VARIABLE_REF) {
return _valRef->setProp(name, val);
}
bool ret = STATUS_FAILED;
if (_type == VAL_NATIVE && _valNative) {
ret = _valNative->scSetProperty(name, val);
}
if (DID_FAIL(ret)) {
ScValue *newVal = nullptr;
_valIter = _valObject.find(name);
if (_valIter != _valObject.end()) {
newVal = _valIter->_value;
}
if (!newVal) {
newVal = new ScValue(_gameRef);
} else {
newVal->cleanup();
}
newVal->copy(val, copyWhole);
newVal->_isConstVar = setAsConst;
_valObject[name] = newVal;
if (_type != VAL_NATIVE) {
_type = VAL_OBJECT;
}
/*
_valIter = _valObject.find(Name);
if (_valIter != _valObject.end()) {
delete _valIter->_value;
_valIter->_value = nullptr;
}
ScValue* val = new ScValue(_gameRef);
val->Copy(Val, CopyWhole);
val->_isConstVar = SetAsConst;
_valObject[Name] = val;
if (_type!=VAL_NATIVE) _type = VAL_OBJECT;
*/
}
return STATUS_OK;
}