本文整理汇总了C++中xbox::VString::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::Find方法的具体用法?C++ VString::Find怎么用?C++ VString::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VString
的用法示例。
在下文中一共展示了VString::Find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
static
*/
DialectCode VComponentManager::GetLocalizationLanguage(VFolder * inLocalizationResourcesFolder,bool inGotoResourceFolder)
{
DialectCode sResult = XBOX::DC_NONE; // sc 19/05/2008 was XBOX::DC_ENGLISH_US
VFolder * localizationResourcesFolder = NULL;
if(testAssert(inLocalizationResourcesFolder != NULL && inLocalizationResourcesFolder->Exists()))
{
if (inGotoResourceFolder)
{
XBOX::VFilePath componentOrPluginFolderPath = inLocalizationResourcesFolder->GetPath();
componentOrPluginFolderPath.ToSubFolder(CVSTR("Contents")).ToSubFolder(CVSTR("Resources"));
localizationResourcesFolder = new XBOX::VFolder(componentOrPluginFolderPath);
}
else
{
localizationResourcesFolder = inLocalizationResourcesFolder;
localizationResourcesFolder->Retain();
}
bool englishFolderDetected = false;
XBOX::DialectCode dialectCode = XBOX::DC_NONE;
//Detect what is the favorite language of the OS/App
#if VERSIONWIN
LCID lcid = ::GetUserDefaultLCID();
XBOX::DialectCode currentDialectCode = (XBOX::DialectCode)LANGIDFROMLCID(lcid);
#elif VERSION_LINUX
//jmo - Be coherent with code in VIntlMgr.cpp
XBOX::DialectCode currentDialectCode=XBOX::DC_ENGLISH_US; // Postponed Linux Implementation !
#else
CFBundleRef bundle = ::CFBundleGetMainBundle();
XBOX::DialectCode currentDialectCode = XBOX::DC_ENGLISH_US;
if ( bundle != nil ){
CFArrayRef array_ref = ::CFBundleCopyBundleLocalizations(bundle);
if (array_ref != nil){
CFArrayRef usedLanguages = ::CFBundleCopyPreferredLocalizationsFromArray(array_ref);
CFStringRef cfPrimaryLanguage = (CFStringRef)CFArrayGetValueAtIndex(usedLanguages, 0);
XBOX::VString xboxPrimaryLanguage;
xboxPrimaryLanguage.MAC_FromCFString(cfPrimaryLanguage);
::CFRelease(usedLanguages);
if(!XBOX::VIntlMgr::GetDialectCodeWithISOLanguageName(xboxPrimaryLanguage, currentDialectCode))
if(!XBOX::VIntlMgr::GetDialectCodeWithRFC3066BisLanguageCode(xboxPrimaryLanguage, currentDialectCode))
currentDialectCode = XBOX::DC_ENGLISH_US;
CFRelease(array_ref);
}
}
#endif
//Try to see if we have this language. If not, take english
for ( XBOX::VFolderIterator folderIter( localizationResourcesFolder ); folderIter.IsValid() && currentDialectCode != dialectCode ; ++folderIter )
{
XBOX::VString folderName;
folderIter->GetName(folderName);
uLONG posStr = folderName.Find(CVSTR(".lproj"), 1, false);
if ( posStr > 0 )
{
folderName.Remove(posStr, folderName.GetLength() - posStr + 1);
if( XBOX::VIntlMgr::GetDialectCodeWithRFC3066BisLanguageCode(folderName, dialectCode ) || XBOX::VIntlMgr::GetDialectCodeWithISOLanguageName(folderName, dialectCode)){
if(dialectCode == XBOX::DC_ENGLISH_US)
englishFolderDetected = true;
if(currentDialectCode == dialectCode)
sResult = dialectCode;
}
}
}
if ( sResult == XBOX::DC_NONE ){
if ( englishFolderDetected )
sResult = XBOX::DC_ENGLISH_US;
else
sResult = dialectCode;
}
ReleaseRefCountable(&localizationResourcesFolder);
}
return sResult;
}