本文整理汇总了C++中xbox::VJSParms_callStaticFunction::GetParamFunc方法的典型用法代码示例。如果您正苦于以下问题:C++ VJSParms_callStaticFunction::GetParamFunc方法的具体用法?C++ VJSParms_callStaticFunction::GetParamFunc怎么用?C++ VJSParms_callStaticFunction::GetParamFunc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VJSParms_callStaticFunction
的用法示例。
在下文中一共展示了VJSParms_callStaticFunction::GetParamFunc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _listen
void VJSNetServerClass::_listen (XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
XBOX::VString address;
sLONG port;
if (!ioParms.CountParams()) {
XBOX::vThrowError(XBOX::VE_JVSC_EXPECTING_PARAMETER, "net.Server.listen()");
return;
}
if (!ioParms.IsNumberParam(1) || !ioParms.GetLongParam(1, &port)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
XBOX::VString hostname;
XBOX::VJSObject callback(ioParms.GetContext());
bool hasCallback;
hostname = "";
hasCallback = false;
if (ioParms.CountParams() >= 2) {
if (ioParms.IsStringParam(2)) {
if (!ioParms.GetStringParam(2, hostname)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "2");
return;
}
} else if (ioParms.IsObjectParam(2) && ioParms.GetParamFunc(2, callback)) {
hasCallback = true;
} else {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_FUNCTION, "2");
return;
}
}
if (ioParms.CountParams() == 3 ) {
if ((hasCallback || !ioParms.IsObjectParam(3) || !ioParms.GetParamFunc(3, callback))) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_FUNCTION, "3");
return;
} else
hasCallback = true;
}
// We are already listening, stop previous listener.
if (inServer->fConnectionListener != NULL)
inServer->Close();
// Set up listener.
if ((inServer->fConnectionListener = new XBOX::VTCPConnectionListener())== NULL) {
XBOX::vThrowError(XBOX::VE_MEMORY_FULL);
return;
}
if (inServer->fIsSSL)
inServer->fConnectionListener->SetSSLKeyAndCertificate(inServer->fCertificate, inServer->fKey);
VJSNetSocketObject::sMutex.Lock();
if (VJSNetSocketObject::sSelectIOPool == NULL)
VJSNetSocketObject::sSelectIOPool = new XBOX::VTCPSelectIOPool();
VJSNetSocketObject::sMutex.Unlock();
inServer->fConnectionListener->AddSelectIOPool(VJSNetSocketObject::sSelectIOPool);
VJSWorker *worker;
worker = VJSWorker::RetainWorker(ioParms.GetContext());
VJSConnectionHandlerFactory *connectionHandlerFactory;
if ((connectionHandlerFactory = new VJSConnectionHandlerFactory(worker, inServer, inServer->fIsSSL)) == NULL) {
//.........这里部分代码省略.........