Kaydet (Commit) 2c571050 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

i18npool: Use appropriate OUString functions on string constants

Change-Id: I82fea345a05c0327af3b75ccfd3358f54523c082
üst 7948b273
......@@ -581,9 +581,9 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) throw (
// load service with name <base>_<lang>_<country>
createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).append(
rLocale.Country).makeStringAndClear())) ||
(l > 0 && c > 0 && rLocale.Language.equalsAscii("zh") &&
(rLocale.Country.equalsAscii("HK") ||
rLocale.Country.equalsAscii("MO") ) &&
(l > 0 && c > 0 && rLocale.Language == "zh" &&
(rLocale.Country == "HK" ||
rLocale.Country == "MO" ) &&
// if the country code is HK or MO, one more step to try TW.
createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).appendAscii(
"TW").makeStringAndClear())) ||
......
......@@ -110,7 +110,7 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak(
return lbr;
}
#define LOCALE(language, country) lang::Locale(OUString::createFromAscii(language), OUString::createFromAscii(country), OUString())
#define LOCALE(language, country) lang::Locale(language, country, OUString())
// ----------------------------------------------------
// class BreakIterator_zh
// ----------------------------------------------------;
......
......@@ -139,7 +139,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
collator = new RuleBasedCollator(reinterpret_cast<const UChar *>(rule.getStr()), status); // UChar != sal_Unicode in MinGW
if (! U_SUCCESS(status)) throw RuntimeException();
}
if (!collator && OUString::createFromAscii(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) {
if (!collator && OUString(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) {
const sal_uInt8* (*func)() = NULL;
size_t (*funclen)() = NULL;
......
......@@ -178,7 +178,7 @@ OUString SAL_CALL IndexEntrySupplier::getIndexFollowPageWord( sal_Bool bMorePage
OUString SAL_CALL
IndexEntrySupplier::getImplementationName() throw( RuntimeException, std::exception )
{
return OUString::createFromAscii( implementationName );
return OUString( implementationName );
}
sal_Bool SAL_CALL
......@@ -191,7 +191,7 @@ Sequence< OUString > SAL_CALL
IndexEntrySupplier::getSupportedServiceNames() throw( RuntimeException, std::exception )
{
Sequence< OUString > aRet(1);
aRet[0] = OUString::createFromAscii( implementationName );
aRet[0] = implementationName;
return aRet;
}
......
......@@ -68,13 +68,13 @@ sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable:
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(first), rLocale, collatorOptions) == 0;
return collator->loadCollatorAlgorithm(first, rLocale, collatorOptions) == 0;
}
sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant::loadAlgorithm(
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(first), rLocale, collatorOptions) == 0;
return collator->loadCollatorAlgorithm(first, rLocale, collatorOptions) == 0;
}
static const sal_Char last[] = "ja_phonetic (alphanumeric last)";
......@@ -82,13 +82,13 @@ sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable::
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(last), rLocale, collatorOptions) == 0;
return collator->loadCollatorAlgorithm(last, rLocale, collatorOptions) == 0;
}
sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant::loadAlgorithm(
const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
{
return collator->loadCollatorAlgorithm(OUString::createFromAscii(last), rLocale, collatorOptions) == 0;
return collator->loadCollatorAlgorithm(last, rLocale, collatorOptions) == 0;
}
} } } }
......
......@@ -770,7 +770,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
{
sal_Int32 nStart;
if (sTheCompatibleCurrency.isEmpty() &&
((nStart = n->getValue().indexOfAsciiL( "[$", 2)) >= 0))
((nStart = n->getValue().indexOf("[$")) >= 0))
{
OUString aCode( n->getValue());
sal_Int32 nHyphen = aCode.indexOf( '-', nStart);
......@@ -1294,7 +1294,7 @@ void LCCollationNode::generateCode (const OFileWriter &of) const
for ( j = 0; j < getNumberOfChildren(); j++ ) {
LocaleNode * currNode = getChildAt (j);
if( currNode->getName().equalsAscii("Collator") )
if( currNode->getName() == "Collator" )
{
OUString str;
str = currNode->getAttr().getValueByName("unoid");
......@@ -1307,7 +1307,7 @@ void LCCollationNode::generateCode (const OFileWriter &of) const
nbOfCollations++;
}
if( currNode->getName().equalsAscii("CollationOptions") )
if( currNode->getName() == "CollationOptions" )
{
LocaleNode* pCollationOptions = currNode;
nbOfCollationOptions = sal::static_int_cast<sal_Int16>( pCollationOptions->getNumberOfChildren() );
......@@ -1408,7 +1408,7 @@ void LCIndexNode::generateCode (const OFileWriter &of) const
sal_Int16 i;
for (i = 0; i< getNumberOfChildren();i++) {
LocaleNode * currNode = getChildAt (i);
if( currNode->getName().equalsAscii("IndexKey") )
if( currNode->getName() == "IndexKey" )
{
OUString str;
str = currNode->getAttr().getValueByName("unoid");
......@@ -1425,13 +1425,13 @@ void LCIndexNode::generateCode (const OFileWriter &of) const
nbOfIndexs++;
}
if( currNode->getName().equalsAscii("UnicodeScript") )
if( currNode->getName() == "UnicodeScript" )
{
of.writeParameter("unicodeScript", currNode->getValue(), nbOfUnicodeScripts );
nbOfUnicodeScripts++;
}
if( currNode->getName().equalsAscii("FollowPageWord") )
if( currNode->getName() == "FollowPageWord" )
{
of.writeParameter("followPageWord", currNode->getValue(), nbOfPageWords);
nbOfPageWords++;
......
......@@ -503,15 +503,13 @@ static const sal_Int16 natnum2[] = {
};
static const sal_Int16 sizeof_natnum2 = SAL_N_ELEMENTS(natnum2);
#define isLang(lang) rLocale.Language.equalsAsciiL(lang, 2)
static sal_Int16 SAL_CALL getLanguageNumber( const Locale& rLocale)
{
// return zh_TW for TW, HK and MO, return zh_CN for other zh locales.
if (isLang("zh")) return MsLangId::isTraditionalChinese(rLocale) ? 1 : 0;
if (rLocale.Language == "zh") return MsLangId::isTraditionalChinese(rLocale) ? 1 : 0;
for (sal_Int16 i = 2; i < nbOfLocale; i++)
if (isLang(natnum1Locales[i]))
if (rLocale.Language.equalsAsciiL(natnum1Locales[i], 2))
return i;
return -1;
......
......@@ -137,7 +137,7 @@ const sal_Char cOrdinalSuffix[] = "com.sun.star.i18n.OrdinalSuffix";
OUString SAL_CALL OrdinalSuffixService::getImplementationName(void) throw( RuntimeException, std::exception )
{
return OUString::createFromAscii(cOrdinalSuffix);
return OUString(cOrdinalSuffix);
}
sal_Bool SAL_CALL OrdinalSuffixService::supportsService( const OUString& rServiceName) throw( RuntimeException, std::exception )
......@@ -148,7 +148,7 @@ sal_Bool SAL_CALL OrdinalSuffixService::supportsService( const OUString& rServic
Sequence< OUString > SAL_CALL OrdinalSuffixService::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
{
Sequence< OUString > aRet(1);
aRet[0] = OUString::createFromAscii(cOrdinalSuffix);
aRet[0] = cOrdinalSuffix;
return aRet;
}
......
......@@ -1026,17 +1026,16 @@ SearchResult TextSearch::ApproxSrchBkwrd( const OUString& searchStr,
}
static const sal_Char cSearchName[] = "com.sun.star.util.TextSearch";
static const sal_Char cSearchImpl[] = "com.sun.star.util.TextSearch_i18n";
static OUString getServiceName_Static()
{
return OUString::createFromAscii( cSearchName );
return OUString( "com.sun.star.util.TextSearch" );
}
static OUString getImplementationName_Static()
{
return OUString::createFromAscii( cSearchImpl );
return OUString( cSearchImpl );
}
OUString SAL_CALL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment