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


C++ JSTestTypedefs类代码示例

本文整理汇总了C++中JSTestTypedefs的典型用法代码示例。如果您正苦于以下问题:C++ JSTestTypedefs类的具体用法?C++ JSTestTypedefs怎么用?C++ JSTestTypedefs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JSTestTypedefs类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: jsTestTypedefsPrototypeFunctionSetShadow

EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(ExecState* exec)
{
    JSValue thisValue = exec->thisValue();
    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
    if (UNLIKELY(!castedThis))
        return throwThisTypeError(*exec, "TestTypedefs", "setShadow");
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
    TestTypedefs& impl = castedThis->impl();
    if (exec->argumentCount() < 3)
        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    float width(exec->argument(0).toFloat(exec));
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());
    float height(exec->argument(1).toFloat(exec));
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());
    float blur(exec->argument(2).toFloat(exec));
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());

    size_t argsCount = exec->argumentCount();
    if (argsCount <= 3) {
        impl.setShadow(width, height, blur);
        return JSValue::encode(jsUndefined());
    }

    const String& color(exec->argument(3).isEmpty() ? String() : exec->argument(3).toString(exec)->value(exec));
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());
    if (argsCount <= 4) {
        impl.setShadow(width, height, blur, color);
        return JSValue::encode(jsUndefined());
    }

    float alpha(exec->argument(4).toFloat(exec));
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());
    impl.setShadow(width, height, blur, color, alpha);
    return JSValue::encode(jsUndefined());
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:40,代码来源:JSTestTypedefs.cpp

示例2: jsTestTypedefsPrototypeFunctionFuncWithClamp

EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(ExecState* exec)
{
    JSValue thisValue = exec->thisValue();
    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
    if (UNLIKELY(!castedThis))
        return throwThisTypeError(*exec, "TestTypedefs", "funcWithClamp");
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
    auto& impl = castedThis->impl();
    if (UNLIKELY(exec->argumentCount() < 1))
        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    unsigned long long arg1 = 0;
    double arg1NativeValue = exec->argument(0).toNumber(exec);
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());

    if (!std::isnan(arg1NativeValue))
        arg1 = clampTo<unsigned long long>(arg1NativeValue);


    size_t argsCount = exec->argumentCount();
    if (argsCount <= 1) {
        impl.funcWithClamp(arg1);
        return JSValue::encode(jsUndefined());
    }

    unsigned long long arg2 = 0;
    double arg2NativeValue = exec->argument(1).toNumber(exec);
    if (UNLIKELY(exec->hadException()))
        return JSValue::encode(jsUndefined());

    if (!std::isnan(arg2NativeValue))
        arg2 = clampTo<unsigned long long>(arg2NativeValue);

    impl.funcWithClamp(arg1, arg2);
    return JSValue::encode(jsUndefined());
}
开发者ID:feel2d,项目名称:webkit,代码行数:36,代码来源:JSTestTypedefs.cpp


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