本文整理汇总了C++中VJSParms_callStaticFunction::GetRealParam方法的典型用法代码示例。如果您正苦于以下问题:C++ VJSParms_callStaticFunction::GetRealParam方法的具体用法?C++ VJSParms_callStaticFunction::GetRealParam怎么用?C++ VJSParms_callStaticFunction::GetRealParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VJSParms_callStaticFunction
的用法示例。
在下文中一共展示了VJSParms_callStaticFunction::GetRealParam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_ProgressIndicator
void VJSGlobalClass::do_ProgressIndicator(VJSParms_callStaticFunction& ioParms, VJSGlobalObject *inContext)
{
VString sessiontile;
VString windowtile, userinfo;
bool caninterrupt = false;
Real maxvalue = -1;
VError err = VE_OK;
if (ioParms.IsNumberParam(1))
ioParms.GetRealParam(1, &maxvalue);
else
err = vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
if (err == VE_OK )
{
if (ioParms.IsStringParam(2))
ioParms.GetStringParam(2, sessiontile);
else
err = vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "2");
}
caninterrupt = ioParms.GetBoolParam( 3, L"Can Interrupt", "Cannot Interrupt");
//VProgressIndicator* progress = inContext->GetRuntimeDelegate()->CreateProgressIndicator( windowtile);
if (err == VE_OK)
{
VProgressIndicator* progress = new VProgressIndicator();
if (progress != NULL)
{
if (ioParms.CountParams() >= 4)
{
if (ioParms.IsStringParam(4))
{
ioParms.GetStringParam(4, windowtile);
progress->SetTitle(windowtile);
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "4");
}
if (ioParms.CountParams() >= 5)
{
if (ioParms.IsStringParam(5))
{
ioParms.GetStringParam(5, userinfo);
progress->SetUserInfo(userinfo);
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "5");
}
progress->BeginSession((sLONG8)maxvalue, sessiontile, caninterrupt);
}
ioParms.ReturnValue(VJSProgressIndicator::CreateInstance(ioParms.GetContextRef(), progress));
ReleaseRefCountable( &progress);
}
else
ioParms.ReturnNullValue();
}
示例2: _PutReal
void VJSStream::_PutReal(VJSParms_callStaticFunction& ioParms, VStream* inStream)
{
Real r = 0;
if (ioParms.IsNumberParam(1))
{
ioParms.GetRealParam(1, &r);
VError err = inStream->PutReal(r);
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
}
示例3: _SetTimer
void VJSTimer::_SetTimer (VJSParms_callStaticFunction &ioParms, VJSWorker *inWorker, bool inIsInterval)
{
xbox_assert(inWorker != NULL);
if (!ioParms.CountParams())
return;
XBOX::VJSContext context(ioParms.GetContext());
XBOX::VJSObject functionObject(context);
ioParms.GetParamObject(1, functionObject);
if (!functionObject.IsFunction())
return;
functionObject.Protect();
Real duration;
duration = 0.0;
if (ioParms.CountParams() >= 2) {
if (ioParms.IsNumberParam(2)) {
if (!ioParms.GetRealParam(2, &duration))
duration = 0.0;
} else {
// According to specification, if timeout is an object, call its toString() method if any.
// Then apply ToNumber() on the string to obtain duration.
XBOX::VJSObject timeOutObject(context);
if (ioParms.GetParamObject(2, timeOutObject)) {
timeOutObject.SetContext(context);
if (timeOutObject.HasProperty("toString")) {
XBOX::VJSObject toStringObject = timeOutObject.GetPropertyAsObject("toString");
if (toStringObject.IsFunction()) {
std::vector<XBOX::VJSValue> values;
XBOX::VJSValue string(context);
toStringObject.SetContext(context);
timeOutObject.CallFunction(toStringObject, &values, &string, NULL);
if (string.IsString()) {
// If Number() is called as a function (and not as a constructor), it acts as ToNumber().
// See section 15.7.1 of ECMA-262 specification.
XBOX::VJSObject toNumberObject = context.GetGlobalObject().GetPropertyAsObject("Number");
if (toNumberObject.IsFunction()) {
XBOX::VJSValue number(context);
values.clear();
values.push_back(string);
toNumberObject.SetContext(context);
context.GetGlobalObject().CallFunction(toNumberObject, &values, &number, NULL);
if (number.IsNumber() && !number.GetReal(&duration))
duration = 0.0;
}
}
}
}
}
}
// (value != value) is true if value is a NaN.
if (duration < 0.0 || duration > XBOX::kMAX_Real || duration != duration)
duration = 0.0;
}
std::vector<XBOX::VJSValue> *arguments;
arguments = new std::vector<XBOX::VJSValue>;
for (sLONG i = 3; i <= ioParms.CountParams(); i++)
arguments->push_back(ioParms.GetParamValue(i));
sLONG period, id;
VJSTimer *timer;
//.........这里部分代码省略.........