void FreezeScript::AssignVisitor::visitBoolean(const BooleanDataPtr& dest) { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string v = s->getValue(); if(v == "true") { dest->setValue(true); } else if(v == "false") { dest->setValue(false); } else { conversionError(dest->getType(), _src->getType(), v); } } else { dest->setValue(_src->booleanValue(_convert)); } }
void FreezeScript::TransformVisitor::visitBoolean(const BooleanDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { BooleanDataPtr b = BooleanDataPtr::dynamicCast(_src); if(b) { dest->setValue(b->getValue()); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string v = s->getValue(); if(v == "true") { dest->setValue(true); } else if(v == "false") { dest->setValue(false); } else { conversionError(type, _src->getType(), v); } } else { typeMismatchError(type, _src->getType()); } } } _info->executeCustomTransform(dest, _src); }