void VLocalizationTransUnitHandler::CheckPlatformTag( const VString& inTags, bool inIncludeIfTag, bool *ioExcluded) { VectorOfVString tags; inTags.GetSubStrings( ' ', tags, false /*inReturnEmptyStrings*/, true /*inTrimSpaces*/); // same tags as in VContextualMenu::_AddDefaultTags bool mac = std::find( tags.begin(), tags.end(), CVSTR("mac")) != tags.end(); bool win = std::find( tags.begin(), tags.end(), CVSTR("win")) != tags.end(); bool lin = std::find( tags.begin(), tags.end(), CVSTR("linux")) != tags.end(); if (mac || win || lin) { bool ok; #if VERSIONMAC ok = mac; #elif VERSIONWIN ok = win; #elif VERSION_LINUX ok = lin; #endif if (inIncludeIfTag && !ok) *ioExcluded = true; else if (!inIncludeIfTag && ok) *ioExcluded = true; } }
VError VJSONArrayReader::ToArrayString(VectorOfVString &outStrings, bool inDoAppend) { if(!inDoAppend) outStrings.clear(); if(fLastParseError == VE_OK) { if(!inDoAppend) { outStrings = fValues; } else if(!fValues.empty()) { outStrings.insert(outStrings.end(), fValues.begin(), fValues.end()); } } return fLastParseError; }
void VJSLanguageSyntaxTester::_Tokenize( XBOX::VJSParms_callStaticFunction &ioParams, void * ) { // We are expecting 2 JavaScript parameters: // - source code to tokenize // - extension of the fake file VString sourceCode, extension; if (ioParams.CountParams() == 2) { if (!ioParams.GetStringParam( 1, sourceCode )) return; if (!ioParams.GetStringParam( 2, extension )) return; } else return; CLanguageSyntaxComponent *languageSyntax = (CLanguageSyntaxComponent *)VComponentManager::RetainComponent( (CType)CLanguageSyntaxComponent::Component_Type ); if (languageSyntax) { ISyntaxInterface *syntaxEngine = languageSyntax->GetSyntaxByExtension( extension ); if (syntaxEngine) { VectorOfVString tokens; syntaxEngine->GetTokensForTesting(sourceCode, tokens); VJSArray result( ioParams.GetContextRef() ); VJSValue jsval(ioParams.GetContextRef()); for (VectorOfVString::const_iterator it = tokens.begin(); it != tokens.end(); ++it) { jsval.SetString(*it); result.PushValue(jsval); } ioParams.ReturnValue(result); } languageSyntax->Release(); } }