コード例 #1
0
ファイル: JsUAG.cpp プロジェクト: StephaneH/core-Components
void VJSGroup::_getParents( XBOX::VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup)
{
	bool firstlevel = ioParms.GetBoolParam(1, "firstLevel", "allLevels");
	CUAGGroupVector groups;
	inGroup->RetainOwners(groups, firstlevel);
	ioParms.ReturnValue(buildArrFromGroups(ioParms, groups, nil));
}
コード例 #2
0
ファイル: JsUAG.cpp プロジェクト: StephaneH/core-Components
void VJSGroup::_getUsers( XBOX::VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup)
{
	bool firstlevel = ioParms.GetBoolParam(1, "firstLevel", "allLevels");
	CUAGUserVector users;
	inGroup->RetainUsers(users, firstlevel);
	ioParms.ReturnValue(buildArrFromUsers(ioParms, users, nil));
}
コード例 #3
0
void VJSRPCServiceCore::_setPublishGlobalNamespace( XBOX::VJSParms_callStaticFunction& ioParms, VRPCService *inService)
{
	bool publishGlobalNamespace = false;
	if (ioParms.GetBoolParam( 1, &publishGlobalNamespace))
	{
		inService->SetPublishInClientGlobalNamespace( publishGlobalNamespace);
	}
}
コード例 #4
0
ファイル: JsUAG.cpp プロジェクト: StephaneH/core-Components
void VJSGroup::_filterParents( XBOX::VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup)
{
	VString s;
	ioParms.GetStringParam(1,s);
	s.AppendUniChar(ioParms.GetWildChar());
	CUAGGroupVector groups;
	bool firstlevel = ioParms.GetBoolParam(2, "firstLevel", "allLevels");
	inGroup->RetainOwners(groups, firstlevel);
	ioParms.ReturnValue(buildArrFromGroups(ioParms, groups, &s));
}
コード例 #5
0
void VJSXMLHttpRequest::_Open(XBOX::VJSParms_callStaticFunction& ioParms, XMLHttpRequest* inXhr)
{
    XBOX::VString pMethod;
    bool resMethod;
    resMethod=ioParms.GetStringParam(1, pMethod);

    XBOX::VString pUrl;
    bool resUrl;    //jmo - todo : Verifier les longueurs max d'une chaine et d'une URL
    resUrl=ioParms.GetStringParam(2, pUrl);

    bool pAsync;
    bool resAsync;
    resAsync=ioParms.GetBoolParam(3, &pAsync);

    if(resMethod && resUrl && inXhr)
    {
        XBOX::VError res=inXhr->Open(pMethod, pUrl, pAsync);  //ASync is optional, we don't care if it's not set

        if(res!=XBOX::VE_OK)
            XBOX::vThrowError(res);
    }
    else
        XBOX::vThrowError(VE_XHRQ_JS_BINDING_ERROR);
}
コード例 #6
0
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();
	}
}