当前位置: 首页>>代码示例>>C++>>正文


C++ VJSParms_callStaticFunction::GetLongParam方法代码示例

本文整理汇总了C++中xbox::VJSParms_callStaticFunction::GetLongParam方法的典型用法代码示例。如果您正苦于以下问题:C++ VJSParms_callStaticFunction::GetLongParam方法的具体用法?C++ VJSParms_callStaticFunction::GetLongParam怎么用?C++ VJSParms_callStaticFunction::GetLongParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbox::VJSParms_callStaticFunction的用法示例。


在下文中一共展示了VJSParms_callStaticFunction::GetLongParam方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:55,代码来源:VJSRuntime_Image.cpp

示例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()");
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:21,代码来源:VJSNetServer.cpp

示例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);

		}

	}
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:77,代码来源:VJSNetServer.cpp

示例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;	

	}
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:94,代码来源:VJSNetServer.cpp

示例5: _GotoDefinition

void VJSLanguageSyntaxTester::_GotoDefinition( XBOX::VJSParms_callStaticFunction &ioParams, void * )
{
	VString filePathStr, symTablePathStr, selectionStr;
	sLONG	line = 0;

	if (ioParams.CountParams() == 4)
	{
		if (!ioParams.GetStringParam( 1, symTablePathStr )) return;
		if (!ioParams.GetStringParam( 2, filePathStr ))		return;
		if (!ioParams.GetLongParam( 3, &line ))				return;
		if (!ioParams.GetStringParam( 4, selectionStr ))	return;
	}
	else
		return;

	VFilePath symbolTablePath( symTablePathStr, FPS_POSIX);
	VFilePath filePath( filePathStr, FPS_POSIX);

	if ( ! symbolTablePath.IsValid() || ! filePath.IsValid() )
		return;

	if ( line < 1 )
		return;

	CLanguageSyntaxComponent *languageSyntax = (CLanguageSyntaxComponent *)VComponentManager::RetainComponent( (CType)CLanguageSyntaxComponent::Component_Type );
	if (languageSyntax)
	{
		// First, load up the symbol table as an actual table instead of just a path string
		ISymbolTable *symTable = NULL;
		if (!symTablePathStr.IsEmpty())
		{
			symTable = languageSyntax->CreateSymbolTable();
			if (symTable)
			{
				VFile file(symbolTablePath);

				if (symTable->OpenSymbolDatabase( file ))
				{
					// Now that we have all of the parameters grabbed, we can figure out which language syntax engine
					// we want to load up (based on the test file), and ask it to give us completions.  We can then take
					// those completions and turn them into an array of values to pass back to the caller.
					VString extension;
					filePath.GetExtension( extension );
					ISyntaxInterface *syntaxEngine = languageSyntax->GetSyntaxByExtension( extension );
					if (syntaxEngine)
					{
						// Now that we've got the syntax engine, we can ask it for the completions we need
						std::vector< IDefinition > definitions;
						syntaxEngine->GetDefinitionsForTesting( selectionStr, symTable, filePath.GetPath(), line, definitions );

						JSDefinitionResult *results = new JSDefinitionResult( definitions );
						ioParams.ReturnValue( VJSLanguageSyntaxTesterDefinitionResults::CreateInstance( ioParams.GetContextRef(), results ) );
						results->Release();
					}
				}
				symTable->Release();
			}
		}
		languageSyntax->Release();
	}
}
开发者ID:sanyaade-mobiledev,项目名称:core-Components,代码行数:61,代码来源:LanguageSyntax.cpp

示例6: _GetSymbol

void VJSLanguageSyntaxTester::_GetSymbol( XBOX::VJSParms_callStaticFunction &ioParams, void * )
{
	// We are expecting 4 JavaScript parameters:
	// - path to the symbol table
	// - symbol name
	// - symbol definition file
	// - symbol definition line number
	
	VString	symTablePathStr, symbolName, symbolDefPath;
	sLONG	symbolDefLineNumber;

	if (ioParams.CountParams() == 4) {
		if (!ioParams.GetStringParam( 1, symTablePathStr )) return;
		if (!ioParams.GetStringParam( 2, symbolName ))		return;
		if (!ioParams.GetStringParam( 3, symbolDefPath )) return;
		if (!ioParams.GetLongParam( 4, &symbolDefLineNumber ))		return;
	}
	else
		return;
	
	VFilePath symbolTablePath( symTablePathStr, FPS_POSIX);
	VFilePath symbolDefFilePath( symbolDefPath, FPS_POSIX);

	if ( ! symbolTablePath.IsValid() || ! symbolDefFilePath.IsValid() )
		return;

	CLanguageSyntaxComponent *languageSyntax = (CLanguageSyntaxComponent *)VComponentManager::RetainComponent( (CType)CLanguageSyntaxComponent::Component_Type );
	if (languageSyntax)
	{
		// First, load up the symbol table as an actual table instead of just a path string
		ISymbolTable *symTable = NULL;
		if (!symTablePathStr.IsEmpty())
		{
			symTable = languageSyntax->CreateSymbolTable();
			if (symTable)
			{
				VFile file(symbolTablePath);

				if (symTable->OpenSymbolDatabase( file ))
				{
					// Get symbol file
					std::vector< Symbols::IFile * > files = symTable->GetFilesByPathAndBaseFolder( symbolDefFilePath, eSymbolFileBaseFolderProject );	
					if ( ! files.empty() )
					{
						Symbols::IFile *file = files.front();
						file->Retain();
						for (std::vector< Symbols::IFile * >::iterator iter = files.begin(); iter != files.end(); ++iter)
							(*iter)->Release();

						// Gets symbol corresponding to given parameters
						Symbols::ISymbol* owner = symTable->GetSymbolOwnerByLine(file, symbolDefLineNumber);
						Symbols::ISymbol* sym = NULL;

						if (NULL != owner && owner->GetName() == symbolName)
						{
							sym = owner;
							sym->Retain();
						}
						
						if (NULL == sym)
						{
							std::vector< Symbols::ISymbol * >	syms = symTable->GetSymbolsByName(owner, symbolName,file);
							for (std::vector< Symbols::ISymbol * >::iterator iter = syms.begin(); iter != syms.end(); ++iter)
							{
								if ( ( (*iter)->GetLineNumber() + 1 ) == symbolDefLineNumber )
								{
									sym = *iter;
									(*iter)->Retain();
								}
								(*iter)->Release();
							}	
						}

						if (NULL != sym)
						{
							VJSObject	result(ioParams.GetContextRef());
							VJSValue	jsval(ioParams.GetContextRef());
							VString		signature;

							symTable->GetSymbolSignature( sym, signature );

							result.MakeEmpty();

							jsval.SetString( sym->GetName() );
							result.SetProperty(L"name", jsval, JS4D::PropertyAttributeNone);

							jsval.SetString( sym->GetTypeName() );
							result.SetProperty(L"type", jsval, JS4D::PropertyAttributeNone);

							jsval.SetNumber( sym->GetLineNumber() + 1 );
							result.SetProperty(L"line", jsval, JS4D::PropertyAttributeNone);

							jsval.SetString( signature );
							result.SetProperty(L"signature", jsval, JS4D::PropertyAttributeNone);

							jsval.SetString( sym->GetKindString() );
							result.SetProperty(L"kind", jsval, JS4D::PropertyAttributeNone);

							ioParams.ReturnValue(result);
							sym->Release();
//.........这里部分代码省略.........
开发者ID:sanyaade-mobiledev,项目名称:core-Components,代码行数:101,代码来源:LanguageSyntax.cpp

示例7: _GetCompletions

void VJSLanguageSyntaxTester::_GetCompletions( XBOX::VJSParms_callStaticFunction &ioParams, void * )
{
	// We are expecting 5 parameters for JavaScript.  One for the path to the symbol table, one for the path to the test file (which
	// must already be a part of the symbol table), one for the line number within the file, one for the string that
	// we are going to be completing at that point and one for the completion mode.  If we get only three parameters, then it's a CSS completion test, which is
	// fine -- we just modify the parameters we pass into GetSuggestionsForTesting.
	
	VString symTablePathStr, testFilePathStr, completionString, completionModeStr;
	sLONG completionLocation;
	if (ioParams.CountParams() == 5) {
		if (!ioParams.GetStringParam( 1, symTablePathStr ))		return;
		if (!ioParams.GetStringParam( 2, completionString ))	return;
		if (!ioParams.GetStringParam( 3, testFilePathStr ))		return;
		if (!ioParams.GetLongParam( 4, &completionLocation ))	return;
		if (!ioParams.GetStringParam( 5, completionModeStr ))	return;
	} else if (ioParams.CountParams() == 3) {
		bool curlyBraces;
		if (!ioParams.GetStringParam( 1, completionString ))	return;
		if (!ioParams.GetBoolParam( 2, &curlyBraces ))			return;
		if (!ioParams.GetStringParam( 3, testFilePathStr ))		return;

		// We fudge the completion location information when working with CSS files so that it
		// denotes whether we're inside of curly braces or not.
		completionLocation = curlyBraces ? 1 : 0;
	} else {
		return;
	}
	
	VFilePath symbolTablePath( symTablePathStr, FPS_POSIX);
	VFilePath testFilePath( testFilePathStr, FPS_POSIX);

	if ( ! symbolTablePath.IsValid() || ! testFilePath.IsValid() )
		return;

	EJSCompletionTestingMode completionMode;
	if (completionModeStr == "text")
		completionMode = eText;
	else if (completionModeStr == "displayText")
		completionMode = eDisplayText;
	else
		return;

	CLanguageSyntaxComponent *languageSyntax = (CLanguageSyntaxComponent *)VComponentManager::RetainComponent( (CType)CLanguageSyntaxComponent::Component_Type );
	if (languageSyntax)
	{
		// First, load up the symbol table as an actual table instead of just a path string
		ISymbolTable *symTable = NULL;
		if (!symTablePathStr.IsEmpty())
		{
			symTable = languageSyntax->CreateSymbolTable();
			if ( symTable )
			{
				VFile file(symbolTablePath);
				if (symTable->OpenSymbolDatabase( file ))
				{
					// Now that we have all of the parameters grabbed, we can figure out which language syntax engine
					// we want to load up (based on the test file), and ask it to give us completions.  We can then take
					// those completions and turn them into an array of values to pass back to the caller.
					VString extension;
					testFilePath.GetExtension( extension );
					ISyntaxInterface *syntaxEngine = languageSyntax->GetSyntaxByExtension( extension );
					if (syntaxEngine)
					{
						// Now that we've got the syntax engine, we can ask it for the completions we need
						std::vector< VString > suggestions;
						syntaxEngine->GetSuggestionsForTesting( completionString, symTable, testFilePath.GetPath() , completionLocation, completionMode, suggestions );

						JSResult *results = new JSResult( suggestions );
						ioParams.ReturnValue( VJSLanguageSyntaxTesterResults::CreateInstance( ioParams.GetContextRef(), results ) );
						results->Release();
					}
				}
				symTable->Release();
			}
		}
		languageSyntax->Release();
	}
}
开发者ID:sanyaade-mobiledev,项目名称:core-Components,代码行数:78,代码来源:LanguageSyntax.cpp


注:本文中的xbox::VJSParms_callStaticFunction::GetLongParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。