本文整理汇总了C++中nsACString::LowerCaseEqualsASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ nsACString::LowerCaseEqualsASCII方法的具体用法?C++ nsACString::LowerCaseEqualsASCII怎么用?C++ nsACString::LowerCaseEqualsASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsACString
的用法示例。
在下文中一共展示了nsACString::LowerCaseEqualsASCII方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: key
//--------------------------------------------------------------
NS_IMETHODIMP nsCharsetAlias2::GetPreferred(const nsACString& aAlias,
nsACString& oResult)
{
if (aAlias.IsEmpty()) return NS_ERROR_NULL_POINTER;
NS_TIMELINE_START_TIMER("nsCharsetAlias2:GetPreferred");
// Delay loading charsetalias.properties by hardcoding the most
// frequent aliases. Note that it's possible to recur in to this
// function *while loading* charsetalias.properties (see bug 190951),
// so we might have an |mDelegate| already that isn't valid yet, but
// the load is guaranteed to be "UTF-8" so things will be OK.
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(kAliases); index++) {
if (aAlias.LowerCaseEqualsASCII(kAliases[index][0])) {
oResult.Assign(nsDependentCString(kAliases[index][1],
NS_PTR_TO_UINT32(kAliases[index][2])));
NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
return NS_OK;
}
}
oResult.Truncate();
if(!mDelegate) {
//load charsetalias.properties string bundle with all remaining aliases
// we may need to protect the following section with a lock so we won't call the
// 'new nsGREResProperties' from two different threads
mDelegate = new nsGREResProperties( NS_LITERAL_CSTRING("charsetalias.properties") );
NS_ASSERTION(mDelegate, "cannot create nsGREResProperties");
if(nsnull == mDelegate)
return NS_ERROR_OUT_OF_MEMORY;
}
NS_TIMELINE_STOP_TIMER("nsCharsetAlias2:GetPreferred");
NS_TIMELINE_MARK_TIMER("nsCharsetAlias2:GetPreferred");
nsCAutoString key(aAlias);
ToLowerCase(key);
// hack for now, have to fix nsGREResProperties, but we can't until
// string bundles use UTF8 keys
nsAutoString result;
nsresult rv = mDelegate->Get(NS_ConvertASCIItoUTF16(key), result);
LossyAppendUTF16toASCII(result, oResult);
return rv;
}