当前位置: 首页>>代码示例>>C++>>正文


C++ JSValue::toFloat方法代码示例

本文整理汇总了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());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:JSSVGPathSegMovetoRel.cpp

示例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());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:JSSVGAnimatedNumber.cpp

示例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);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:8,代码来源:JSSVGLength.cpp

示例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);
}
开发者ID:13W,项目名称:phantomjs,代码行数:8,代码来源:JSHTMLMediaElement.cpp

示例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();
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:12,代码来源:JSSVGRect.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例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);
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:15,代码来源:JSSVGPathSegLinetoVerticalAbs.cpp

示例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();
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:21,代码来源:JSSVGPoint.cpp

示例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();
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:24,代码来源:JSSVGLengthCustom.cpp

示例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));
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:6,代码来源:JSSVGPathSegCurvetoCubicSmoothRel.cpp

示例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));
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:6,代码来源:JSAudioPannerNode.cpp

示例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));
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:6,代码来源:JSAudioPannerNode.cpp

示例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)));
        }
    }

    {
开发者ID:caiolima,项目名称:webkit,代码行数:67,代码来源:WebAssemblyInstanceConstructor.cpp

示例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));
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:6,代码来源:JSSVGPathSegArcAbs.cpp

示例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));
}
开发者ID:13W,项目名称:phantomjs,代码行数:6,代码来源:JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp


注:本文中的JSValue::toFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。