void FreezeScript::TransformVisitor::visitDouble(const DoubleDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { DoubleDataPtr d = DoubleDataPtr::dynamicCast(_src); if(d) { dest->setValue(d->doubleValue()); } else { StringDataPtr s = StringDataPtr::dynamicCast(_src); if(s) { string str = s->stringValue(); const char* start = str.c_str(); char* end; double v = strtod(start, &end); if(errno == ERANGE) { rangeError(str, type); } else { while(*end) { if(!isspace(*end)) { conversionError(type, _src->getType(), str); return; } end++; } if(!*end) { dest->setValue(v); } } } else { typeMismatchError(type, _src->getType()); } } } _info->executeCustomTransform(dest, _src); }
void FreezeScript::AssignVisitor::visitDouble(const DoubleDataPtr& dest) { dest->setValue(_src->doubleValue(_convert)); }