本文整理汇总了C++中JSValue::toFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ JSValue::toFloat方法的具体用法?C++ JSValue::toFloat怎么用?C++ JSValue::toFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSValue
的用法示例。
在下文中一共展示了JSValue::toFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setJSSVGPathSegMovetoRelY
void setJSSVGPathSegMovetoRelY(ExecState* exec, JSObject* thisObject, JSValue value)
{
SVGPathSegMovetoRel* imp = static_cast<SVGPathSegMovetoRel*>(static_cast<JSSVGPathSegMovetoRel*>(thisObject)->impl());
imp->setY(value.toFloat(exec));
if (static_cast<JSSVGPathSegMovetoRel*>(thisObject)->context())
static_cast<JSSVGPathSegMovetoRel*>(thisObject)->context()->svgAttributeChanged(static_cast<JSSVGPathSegMovetoRel*>(thisObject)->impl()->associatedAttributeName());
}
示例2: setJSSVGAnimatedNumberBaseVal
void setJSSVGAnimatedNumberBaseVal(ExecState* exec, JSObject* thisObject, JSValue value)
{
SVGAnimatedNumber* imp = static_cast<SVGAnimatedNumber*>(static_cast<JSSVGAnimatedNumber*>(thisObject)->impl());
imp->setBaseVal(value.toFloat(exec));
if (static_cast<JSSVGAnimatedNumber*>(thisObject)->context())
static_cast<JSSVGAnimatedNumber*>(thisObject)->context()->svgAttributeChanged(static_cast<JSSVGAnimatedNumber*>(thisObject)->impl()->associatedAttributeName());
}
示例3: setJSSVGLengthValueInSpecifiedUnits
void setJSSVGLengthValueInSpecifiedUnits(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSSVGLength* castedThisObj = static_cast<JSSVGLength*>(thisObject);
JSSVGPODTypeWrapper<SVGLength> * imp = static_cast<JSSVGPODTypeWrapper<SVGLength> *>(castedThisObj->impl());
SVGLength podImp(*imp);
podImp.setValueInSpecifiedUnits(value.toFloat(exec));
imp->commitChange(podImp, castedThisObj);
}
示例4: setJSHTMLMediaElementVolume
void setJSHTMLMediaElementVolume(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSHTMLMediaElement* castedThis = static_cast<JSHTMLMediaElement*>(thisObject);
HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(castedThis->impl());
ExceptionCode ec = 0;
imp->setVolume(value.toFloat(exec), ec);
setDOMException(exec, ec);
}
示例5: setJSSVGRectHeight
void setJSSVGRectHeight(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSSVGRect* castedThis = static_cast<JSSVGRect*>(thisObject);
SVGPropertyTearOff<FloatRect> * imp = static_cast<SVGPropertyTearOff<FloatRect> *>(castedThis->impl());
if (imp->role() == AnimValRole) {
setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
return;
}
FloatRect& podImp = imp->propertyReference();
podImp.setHeight(value.toFloat(exec));
imp->commitChange();
}
示例6: setJSAudioParamValue
void setJSAudioParamValue(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(exec);
JSAudioParam* castedThis = jsDynamicCast<JSAudioParam*>(JSValue::decode(thisValue));
if (!castedThis) {
throwVMTypeError(exec);
return;
}
AudioParam& impl = castedThis->impl();
float nativeValue(value.toFloat(exec));
if (exec->hadException())
return;
impl.setValue(nativeValue);
}
示例7: setJSSVGPathSegLinetoVerticalAbsY
void setJSSVGPathSegLinetoVerticalAbsY(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(exec);
JSSVGPathSegLinetoVerticalAbs* castedThis = jsDynamicCast<JSSVGPathSegLinetoVerticalAbs*>(JSValue::decode(thisValue));
if (!castedThis) {
throwVMTypeError(exec);
return;
}
SVGPathSegLinetoVerticalAbs& impl = castedThis->impl();
float nativeValue(value.toFloat(exec));
if (exec->hadException())
return;
impl.setY(nativeValue);
}
示例8: setJSSVGPointY
void setJSSVGPointY(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
UNUSED_PARAM(exec);
JSSVGPoint* castedThis = jsDynamicCast<JSSVGPoint*>(JSValue::decode(thisValue));
if (!castedThis) {
throwVMTypeError(exec);
return;
}
SVGPropertyTearOff<SVGPoint> & impl = castedThis->impl();
float nativeValue(value.toFloat(exec));
if (exec->hadException())
return;
if (impl.isReadOnly()) {
setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
return;
}
SVGPoint& podImpl = impl.propertyReference();
podImpl.setY(nativeValue);
impl.commitChange();
}
示例9: setValue
void JSSVGLength::setValue(ExecState* exec, JSValue value)
{
if (impl()->role() == AnimValRole) {
setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
return;
}
if (!value.isUndefinedOrNull() && !value.isNumber() && !value.isBoolean()) {
throwVMTypeError(exec);
return;
}
SVGLength& podImp = impl()->propertyReference();
ExceptionCode ec = 0;
SVGLengthContext lengthContext(impl()->contextElement());
podImp.setValue(value.toFloat(exec), lengthContext, ec);
if (ec) {
setDOMException(exec, ec);
return;
}
impl()->commitChange();
}
示例10: setJSSVGPathSegCurvetoCubicSmoothRelY2
void setJSSVGPathSegCurvetoCubicSmoothRelY2(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSSVGPathSegCurvetoCubicSmoothRel* castedThis = static_cast<JSSVGPathSegCurvetoCubicSmoothRel*>(thisObject);
SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(castedThis->impl());
imp->setY2(value.toFloat(exec));
}
示例11: setJSAudioPannerNodeConeOuterGain
void setJSAudioPannerNodeConeOuterGain(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSAudioPannerNode* castedThis = static_cast<JSAudioPannerNode*>(thisObject);
AudioPannerNode* imp = static_cast<AudioPannerNode*>(castedThis->impl());
imp->setConeOuterGain(value.toFloat(exec));
}
示例12: setJSAudioPannerNodeRolloffFactor
void setJSAudioPannerNodeRolloffFactor(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSAudioPannerNode* castedThis = static_cast<JSAudioPannerNode*>(thisObject);
AudioPannerNode* imp = static_cast<AudioPannerNode*>(castedThis->impl());
imp->setRolloffFactor(value.toFloat(exec));
}
示例13: encode
//.........这里部分代码省略.........
if (actualInitial < expectedInitial)
return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import provided an 'initial' that is too small"))));
if (Wasm::PageCount expectedMaximum = moduleInformation.memory.maximum()) {
Wasm::PageCount actualMaximum = memory->memory()->maximum();
if (!actualMaximum) {
return JSValue::encode(
throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory import did not have a 'maximum' but the module requires that it does"))));
}
if (actualMaximum > expectedMaximum) {
return JSValue::encode(
throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Memory imports 'maximum' is larger than the module's expected 'maximum'"))));
}
}
// ii. Append v to memories.
// iii. Append v.[[Memory]] to imports.
instance->setMemory(vm, memory);
break;
}
case Wasm::ExternalKind::Global: {
// 5. If i is a global import:
// i. If i is not an immutable global, throw a TypeError.
ASSERT(moduleInformation.globals[import.kindIndex].mutability == Wasm::Global::Immutable);
// ii. If Type(v) is not Number, throw a TypeError.
if (!value.isNumber())
return JSValue::encode(throwException(exec, throwScope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("imported global must be a number"))));
// iii. Append ToWebAssemblyValue(v) to imports.
switch (moduleInformation.globals[import.kindIndex].type) {
case Wasm::I32:
instance->setGlobal(numImportGlobals++, value.toInt32(exec));
break;
case Wasm::F32:
instance->setGlobal(numImportGlobals++, bitwise_cast<uint32_t>(value.toFloat(exec)));
break;
case Wasm::F64:
instance->setGlobal(numImportGlobals++, bitwise_cast<uint64_t>(value.asNumber()));
break;
default:
RELEASE_ASSERT_NOT_REACHED();
}
ASSERT(!throwScope.exception());
break;
}
}
}
{
if (!!moduleInformation.memory && moduleInformation.memory.isImport()) {
// We should either have a Memory import or we should have thrown an exception.
RELEASE_ASSERT(hasMemoryImport);
}
if (moduleInformation.memory && !hasMemoryImport) {
RELEASE_ASSERT(!moduleInformation.memory.isImport());
// We create a memory when it's a memory definition.
bool failed;
Wasm::Memory memory(moduleInformation.memory.initial(), moduleInformation.memory.maximum(), failed);
if (failed)
return JSValue::encode(throwException(exec, throwScope, createOutOfMemoryError(exec)));
instance->setMemory(vm,
JSWebAssemblyMemory::create(vm, exec->lexicalGlobalObject()->WebAssemblyMemoryStructure(), WTFMove(memory)));
}
}
{
示例14: setJSSVGPathSegArcAbsAngle
void setJSSVGPathSegArcAbsAngle(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSSVGPathSegArcAbs* castedThis = static_cast<JSSVGPathSegArcAbs*>(thisObject);
SVGPathSegArcAbs* imp = static_cast<SVGPathSegArcAbs*>(castedThis->impl());
imp->setAngle(value.toFloat(exec));
}
示例15: setJSSVGPathSegCurvetoQuadraticSmoothAbsY
void setJSSVGPathSegCurvetoQuadraticSmoothAbsY(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSSVGPathSegCurvetoQuadraticSmoothAbs* castedThis = static_cast<JSSVGPathSegCurvetoQuadraticSmoothAbs*>(thisObject);
SVGPathSegCurvetoQuadraticSmoothAbs* imp = static_cast<SVGPathSegCurvetoQuadraticSmoothAbs*>(castedThis->impl());
imp->setY(value.toFloat(exec));
}