本文整理汇总了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());
}
示例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());
}