本文整理汇总了C++中xbox::VJSParms_callStaticFunction::IsNumberParam方法的典型用法代码示例。如果您正苦于以下问题:C++ VJSParms_callStaticFunction::IsNumberParam方法的具体用法?C++ VJSParms_callStaticFunction::IsNumberParam怎么用?C++ VJSParms_callStaticFunction::IsNumberParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VJSParms_callStaticFunction
的用法示例。
在下文中一共展示了VJSParms_callStaticFunction::IsNumberParam方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _thumbnail
void VJSImage::_thumbnail(XBOX::VJSParms_callStaticFunction& ioParms, VJSPictureContainer* inPict)
{
bool ok = true;
if (!ioParms.IsNumberParam(1))
{
ok = false;
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
}
if (!ioParms.IsNumberParam(2))
{
ok = false;
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "2");
}
VPicture* pic = inPict->GetPict();
if (pic != nil && ok)
{
sLONG w = 0, h = 0, mode = 0;
ioParms.GetLongParam(1, &w);
ioParms.GetLongParam(2, &h);
ioParms.GetLongParam(3, &mode);
if (w == 0)
w = 300;
if (h == 0)
h = 300;
if (mode == 0)
mode = 4;
VPicture* thumb = pic->BuildThumbnail(w, h, (PictureMosaic)mode);
if (thumb != nil)
{
VPictureCodecFactoryRef fact;
VPicture* thumb2 = new VPicture();
VError err = fact->Encode(*thumb, L".jpg", *thumb2, nil);
if (err == VE_OK)
{
/*
VJSPictureContainer* pictContains = new VJSPictureContainer(thumb2, true, ioParms.GetContextRef());
ioParms.ReturnValue(VJSImage::CreateInstance(ioParms.GetContextRef(), pictContains));
pictContains->Release();
*/
ioParms.ReturnVValue(*thumb2);
delete thumb2;
}
else
{
delete thumb2;
ioParms.ReturnNullValue();
}
delete thumb;
}
else
ioParms.ReturnNullValue();
}
else
ioParms.ReturnNullValue();
}
示例2: _pause
void VJSNetServerClass::_pause (XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
sLONG waitingTime; // In milliseconds.
if (!ioParms.CountParams())
waitingTime = 1;
else if (ioParms.CountParams() != 1 || !ioParms.IsNumberParam(1) || !ioParms.GetLongParam(1, &waitingTime)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
// Need support from VTCPConnectionListener.
XBOX::vThrowError(XBOX::VE_JVSC_UNSUPPORTED_FUNCTION, "net.Server.pause()");
}
示例3: _accept
void VJSNetServerSyncClass::_accept (XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
sLONG timeOut;
if (ioParms.CountParams() >= 1) {
if (!ioParms.IsNumberParam(1) || !ioParms.GetLongParam(1, &timeOut)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
if (timeOut < 0) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
} else
timeOut = 0;
XBOX::XTCPSock *socket;
// If socket returned is NULL, accept() has timed out or an error has occured.
// An exception is thrown by GetNewConnectedSocket() if erroneous.
if ((socket = inServer->fSockListener->GetNewConnectedSocket(timeOut)) == NULL)
ioParms.ReturnNullValue();
else {
XBOX::VTCPEndPoint *endPoint = NULL;
VJSNetSocketObject *socketObject = NULL;
if ((endPoint = new XBOX::VTCPEndPoint(socket)) == NULL
|| (socketObject = new VJSNetSocketObject(true, VJSNetSocketObject::eTYPE_TCP4, false)) == NULL) {
if (endPoint != NULL)
endPoint->Release();
if (socketObject != NULL)
socketObject->Release();
socket->Close();
delete socket;
XBOX::vThrowError(XBOX::VE_MEMORY_FULL);
} else {
socketObject->fEndPoint = endPoint;
socketObject->fEndPoint->SetNoDelay(false);
XBOX::VJSObject newSocketSync = VJSNetSocketSyncClass::CreateInstance(ioParms.GetContext(), socketObject);
XBOX::VString address;
socketObject->fObjectRef = newSocketSync.GetObjectRef();
socketObject->fWorker = VJSWorker::RetainWorker(ioParms.GetContext());
socketObject->fEndPoint->GetIP(address);
newSocketSync.SetProperty("remoteAddress", address);
newSocketSync.SetProperty("remotePort", (sLONG) socketObject->fEndPoint->GetPort() & 0xffff);
ioParms.ReturnValue(newSocketSync);
}
}
}
示例4: _listen
void VJSNetServerSyncClass::_listen (XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
sLONG port;
if (ioParms.CountParams() >= 1) {
if (!ioParms.IsNumberParam(1) || !ioParms.GetLongParam(1, &port)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
} else
port = 0; // Will use a random port (useful?).
// Re-use code of async listen().
#if WITH_DEPRECATED_IPV4_API
uLONG address;
if (ioParms.CountParams() >= 2) {
XBOX::VString hostname;
if (!ioParms.IsStringParam(2) || !ioParms.GetStringParam(2, hostname)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "2");
return;
}
address = XBOX::ServerNetTools::ResolveAddress(hostname);
} else
address = 0; // Same as "localhost".
#else
//jmo - je ne comprends pas bien la logique du resolve sur le hostname...
// On veut une IP 'publique' ? J'ai simplifié.
VString address=VNetAddress::GetAnyIP();
#endif
// We are already listening, stop previous listener.
if (inServer->fConnectionListener != NULL)
inServer->Close();
// Setup new listener.
if ((inServer->fSockListener = new XBOX::VSockListener()) == NULL) {
XBOX::vThrowError(XBOX::VE_MEMORY_FULL);
return;
}
XBOX::VError error;
error = XBOX::VE_OK;
if (inServer->fIsSSL)
error = inServer->fSockListener->SetKeyAndCertificate(inServer->fKey, inServer->fCertificate);
if (error != XBOX::VE_OK) {
inServer->Close();
XBOX::vThrowError(error);
}
else if (!inServer->fSockListener->SetBlocking(true)
|| !inServer->fSockListener->AddListeningPort(address, port, inServer->fIsSSL)
|| !inServer->fSockListener->StartListening()) {
inServer->Close();
XBOX::vThrowError(XBOX::VE_SRVR_FAILED_TO_CREATE_LISTENING_SOCKET);
}
else {
inServer->fAddress = address;
inServer->fPort = port;
}
}