本文整理汇总了C++中VJSParms_callStaticFunction::GetContextRef方法的典型用法代码示例。如果您正苦于以下问题:C++ VJSParms_callStaticFunction::GetContextRef方法的具体用法?C++ VJSParms_callStaticFunction::GetContextRef怎么用?C++ VJSParms_callStaticFunction::GetContextRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VJSParms_callStaticFunction
的用法示例。
在下文中一共展示了VJSParms_callStaticFunction::GetContextRef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _GetResult
void VJSLanguageSyntaxTesterDefinitionResults::_GetResult( VJSParms_callStaticFunction &ioParams, IJSLanguageSyntaxTesterDefinitionResults *inResults )
{
if (inResults) {
sLONG index;
if (ioParams.GetLongParam( 1, &index ))
{
IDefinition definition = inResults->GetResult( index );
VJSObject result(ioParams.GetContextRef());
VJSValue jsval(ioParams.GetContextRef());
result.MakeEmpty();
jsval.SetString( definition.GetName() );
result.SetProperty(L"name", jsval, JS4D::PropertyAttributeNone);
jsval.SetString( definition.GetFilePath() );
result.SetProperty(L"file", jsval, JS4D::PropertyAttributeNone);
jsval.SetNumber( definition.GetLineNumber() + 1 );
result.SetProperty(L"line", jsval, JS4D::PropertyAttributeNone);
ioParams.ReturnValue(result);
}
}
}
示例2: do_BinaryStream
void VJSStream::do_BinaryStream(VJSParms_callStaticFunction& ioParms)
{
VFile* file = ioParms.RetainFileParam( 1);
bool forwrite = ioParms.GetBoolParam( 2, L"Write", L"Read");
if (file != NULL)
{
VError err = VE_OK;
if (forwrite)
{
if (!file->Exists())
err = file->Create();
}
VFileStream* stream = new VFileStream(file);
if (err == VE_OK)
{
if (forwrite)
err = stream->OpenWriting();
else
err = stream->OpenReading();
}
if (err == VE_OK)
{
ioParms.ReturnValue(VJSStream::CreateInstance(ioParms.GetContextRef(), stream));
}
else
{
delete stream;
}
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
ReleaseRefCountable( &file);
}
示例3: 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();
}
示例4: buildArrFromGroups
VJSArray buildArrFromGroups(VJSParms_callStaticFunction& ioParms, CUAGGroupVector groups, const VString* filter)
{
VJSArray groupArr(ioParms.GetContextRef());
for (CUAGGroupVector::iterator cur = groups.begin(), end = groups.end(); cur != end; ++cur)
{
if (filter == nil)
{
groupArr.PushValue((*cur)->CreateJSGroupObject(ioParms.GetContextRef()));
}
else
{
VString s;
(*cur)->GetName(s);
if (s.CompareToSameKind_Like(filter) == CR_EQUAL)
groupArr.PushValue((*cur)->CreateJSGroupObject(ioParms.GetContextRef()));
}
}
return groupArr;
}
示例5: buildArrFromUsers
VJSArray buildArrFromUsers(VJSParms_callStaticFunction& ioParms, CUAGUserVector& users, const VString* filter)
{
VJSArray userArr(ioParms.GetContextRef());
for (CUAGUserVector::iterator cur = users.begin(), end = users.end(); cur != end; ++cur)
{
if (filter == nil)
{
userArr.PushValue((*cur)->CreateJSUserObject(ioParms.GetContextRef()));
}
else
{
VString s;
(*cur)->GetName(s);
if (s.CompareToSameKind_Like(filter) == CR_EQUAL)
userArr.PushValue((*cur)->CreateJSUserObject(ioParms.GetContextRef()));
}
}
return userArr;
}
示例6: do_GetProgressIndicator
void VJSGlobalClass::do_GetProgressIndicator(VJSParms_callStaticFunction& ioParms, VJSGlobalObject *inContext)
{
if (ioParms.IsStringParam(1))
{
VString userinfo;
ioParms.GetStringParam(1, userinfo);
VProgressIndicator* progress = VProgressManager::RetainProgressIndicator(userinfo);
if (progress != nil)
ioParms.ReturnValue(VJSProgressIndicator::CreateInstance(ioParms.GetContextRef(), progress));
QuickReleaseRefCountable(progress);
}
}
示例7: do_dateToIso
void VJSGlobalClass::do_dateToIso(VJSParms_callStaticFunction& ioParms, VJSGlobalObject*)
{
VString s;
VJSValue jsval(ioParms.GetContextRef());
if (ioParms.CountParams() > 0)
{
VTime dd;
jsval = ioParms.GetParamValue(1);
jsval.GetTime(dd);
dd.GetJSONString(s);
}
ioParms.ReturnString(s);
}
示例8: do_GetURLPath
void VJSGlobalClass::do_GetURLPath(VJSParms_callStaticFunction& ioParms, VJSGlobalObject*)
{
VString s;
if (ioParms.IsStringParam(1))
{
if (ioParms.GetStringParam(1, s))
{
VFullURL url(s);
VJSArray result(ioParms.GetContextRef());
const VString* next = url.NextPart();
while (next != NULL)
{
VJSValue elem(ioParms.GetContextRef());
elem.SetString(*next);
result.PushValue(elem);
next = url.NextPart();
}
ioParms.ReturnValue(result);
}
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "1");
}
示例9: _addGroup
void VJSDirectory::_addGroup(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
VError err;
VString groupname, fullname;
ioParms.GetStringParam(1, groupname);
ioParms.GetStringParam(2, fullname);
CUAGGroup* group = inDirectory->AddOneGroup(groupname, fullname, err);
if (group == nil)
ioParms.ReturnNullValue();
else
{
ioParms.ReturnValue(VJSGroup::CreateInstance(ioParms.GetContextRef(), group));
group->Release();
}
}
示例10: do_testMe
void VJSGlobalClass::do_testMe( VJSParms_callStaticFunction& inParms, VJSGlobalObject*)
{
VJSObject globalObject( inParms.GetContext().GetGlobalObject());
VString functionName;
inParms.GetStringParam( 1, functionName);
std::vector<VJSValue> values;
size_t count = inParms.CountParams();
for( size_t i = 2 ; i <= count ; ++i)
values.push_back( inParms.GetParamValue( i));
VJSValue result( inParms.GetContextRef());
bool ok = globalObject.CallMemberFunction( functionName, &values, &result, inParms.GetExceptionRefPointer());
inParms.ReturnValue( result);
}
示例11: _addUser
void VJSDirectory::_addUser(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
VError err;
VString username, password, fullname;
ioParms.GetStringParam(1, username);
ioParms.GetStringParam(2, password);
ioParms.GetStringParam(3, fullname);
CUAGUser* user = inDirectory->AddOneUser(username, password, fullname, err);
if (user == nil)
ioParms.ReturnNullValue();
else
{
ioParms.ReturnValue(VJSUser::CreateInstance(ioParms.GetContextRef(), user));
user->Release();
}
}
示例12: _getGroup
void VJSDirectory::_getGroup(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
StErrorContextInstaller errs(false, true);
VString s;
ioParms.GetStringParam(1, s);
CUAGGroup* group = inDirectory->RetainGroup(s);
if (group == nil)
{
VUUID id;
id.FromString(s);
group = inDirectory->RetainGroup(id);
}
if (group == nil)
ioParms.ReturnNullValue();
else
{
ioParms.ReturnValue(VJSGroup::CreateInstance(ioParms.GetContextRef(), group));
group->Release();
}
}
示例13: _getUser
void VJSDirectory::_getUser(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
StErrorContextInstaller errs(false, true);
VString s;
ioParms.GetStringParam(1, s);
CUAGUser* user = inDirectory->RetainUser(s);
if (user == nil)
{
VUUID id;
id.FromString(s);
user = inDirectory->RetainUser(id);
}
if (user == nil)
ioParms.ReturnNullValue();
else
{
ioParms.ReturnValue(VJSUser::CreateInstance(ioParms.GetContextRef(), user));
user->Release();
}
}
示例14: _removeFrom
void VJSGroup::_removeFrom(VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup)
{
VError err = VE_OK;
sLONG nbparam = ioParms.CountParams();
for (sLONG i = 1; i <= nbparam /*&& err == VE_OK*/; i++)
{
if (ioParms.IsArrayParam(i))
{
VJSArray arr(ioParms.GetContextRef(), nil, false);
ioParms.GetParamArray(i, arr);
sLONG nbelem = arr.GetLength();
for (sLONG j = 0; j < nbelem; ++j)
{
VJSValue val(arr.GetValueAt(j));
if (val.IsString())
{
VString s;
val.GetString(s);
err = removeGroupFromGroup(ioParms, inGroup, s);
}
else if (val.IsInstanceOf("Group"))
{
CUAGGroup* group = val.GetObjectPrivateData<VJSGroup>();
err = inGroup->RemoveFromGroup(group);
}
}
}
else if (ioParms.IsStringParam(i))
{
VString s;
ioParms.GetStringParam(i, s);
err = removeGroupFromGroup(ioParms, inGroup, s);
}
else
{
CUAGGroup* group = ioParms.GetParamObjectPrivateData<VJSGroup>(i);
err = inGroup->RemoveFromGroup(group);
}
}
}
示例15: do_SyncEvent
void VJSGlobalClass::do_SyncEvent(VJSParms_callStaticFunction& ioParms, VJSGlobalObject*)
{
VString s;
bool okresult = false;
if (ioParms.IsStringParam(1))
{ ioParms.GetStringParam(1, s);
if (!s.IsEmpty())
{
jsSyncEvent* sync = jsSyncEvent::RetainSyncEvent(s);
if (sync != nil)
{
okresult = true;
ioParms.ReturnValue(VJSSyncEvent::CreateInstance(ioParms.GetContextRef(), sync));
sync->Release();
}
}
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "1");
if (!okresult)
ioParms.ReturnNullValue();
}