Kaydet (Commit) 37126d76 authored tarafından Eike Rathke's avatar Eike Rathke

cUnder, cHyphen

Change-Id: I6c295f887d90809b63c5b13fee466a584d1f6404
üst d261ddf3
...@@ -291,7 +291,8 @@ static const struct { ...@@ -291,7 +291,8 @@ static const struct {
#endif #endif
static const sal_Unicode under = sal_Unicode('_'); static const sal_Unicode cUnder = sal_Unicode('_');
static const sal_Unicode cHyphen = sal_Unicode('-');
static const sal_Int16 nbOfLocales = SAL_N_ELEMENTS(aLibTable); static const sal_Int16 nbOfLocales = SAL_N_ELEMENTS(aLibTable);
...@@ -445,7 +446,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( ...@@ -445,7 +446,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
LocaleDataLookupTableItem** pOutCachedItem ) LocaleDataLookupTableItem** pOutCachedItem )
{ {
OUString aFallback; OUString aFallback;
bool bFallback = (localeName.indexOf( under) < 0); bool bFallback = (localeName.indexOf( cUnder) < 0);
if (bFallback) if (bFallback)
{ {
Locale aLocale; Locale aLocale;
...@@ -478,7 +479,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( ...@@ -478,7 +479,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
(*pOutCachedItem) = new LocaleDataLookupTableItem( *pCurrent ); (*pOutCachedItem) = new LocaleDataLookupTableItem( *pCurrent );
(*pOutCachedItem)->localeName = aLibTable[i].pLocale; (*pOutCachedItem)->localeName = aLibTable[i].pLocale;
return (*pOutCachedItem)->module->getFunctionSymbol( return (*pOutCachedItem)->module->getFunctionSymbol(
aBuf.appendAscii( pFunction).append( under). aBuf.appendAscii( pFunction).append( cUnder).
appendAscii( (*pOutCachedItem)->localeName).makeStringAndClear()); appendAscii( (*pOutCachedItem)->localeName).makeStringAndClear());
} }
else else
...@@ -505,7 +506,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( ...@@ -505,7 +506,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
{ {
(*pOutCachedItem) = new LocaleDataLookupTableItem( *pNewItem ); (*pOutCachedItem) = new LocaleDataLookupTableItem( *pNewItem );
return module->getFunctionSymbol( return module->getFunctionSymbol(
aBuf.appendAscii(pFunction).append(under). aBuf.appendAscii(pFunction).append(cUnder).
appendAscii((*pOutCachedItem)->localeName).makeStringAndClear()); appendAscii((*pOutCachedItem)->localeName).makeStringAndClear());
} }
else else
...@@ -577,8 +578,8 @@ Sequence< CalendarItem2 > &LocaleData::getCalendarItemByName(const OUString& nam ...@@ -577,8 +578,8 @@ Sequence< CalendarItem2 > &LocaleData::getCalendarItemByName(const OUString& nam
{ {
if (!ref_name.equals(name)) { if (!ref_name.equals(name)) {
sal_Int32 index = 0; sal_Int32 index = 0;
OUString language = name.getToken(0, under, index); OUString language = name.getToken(0, cUnder, index);
OUString country = name.getToken(0, under, index); OUString country = name.getToken(0, cUnder, index);
Locale loc(language, country, OUString()); Locale loc(language, country, OUString());
Sequence < Calendar2 > cals; Sequence < Calendar2 > cals;
if (loc == rLocale) { if (loc == rLocale) {
...@@ -586,7 +587,7 @@ Sequence< CalendarItem2 > &LocaleData::getCalendarItemByName(const OUString& nam ...@@ -586,7 +587,7 @@ Sequence< CalendarItem2 > &LocaleData::getCalendarItemByName(const OUString& nam
} else { } else {
cals = getAllCalendars2(loc); cals = getAllCalendars2(loc);
} }
const OUString& id = name.getToken(0, under, index); const OUString& id = name.getToken(0, cUnder, index);
for (index = 0; index < cals.getLength(); index++) { for (index = 0; index < cals.getLength(); index++) {
if (id.equals(cals[index].Name)) { if (id.equals(cals[index].Name)) {
ref_cal = cals[index]; ref_cal = cals[index];
...@@ -1465,7 +1466,7 @@ oslGenericFunction SAL_CALL LocaleData::getFunctionSymbol( const Locale& rLocale ...@@ -1465,7 +1466,7 @@ oslGenericFunction SAL_CALL LocaleData::getFunctionSymbol( const Locale& rLocale
if (cachedItem.get() && cachedItem->equals(rLocale)) if (cachedItem.get() && cachedItem->equals(rLocale))
{ {
aBuf.ensureCapacity(strlen(pFunction) + 1 + strlen(cachedItem->localeName)); aBuf.ensureCapacity(strlen(pFunction) + 1 + strlen(cachedItem->localeName));
return cachedItem->module->getFunctionSymbol(aBuf.appendAscii(pFunction).append(under). return cachedItem->module->getFunctionSymbol(aBuf.appendAscii(pFunction).append(cUnder).
appendAscii(cachedItem->localeName).makeStringAndClear()); appendAscii(cachedItem->localeName).makeStringAndClear());
} }
...@@ -1520,7 +1521,7 @@ LocaleData::getAllInstalledLocaleNames() throw(RuntimeException) ...@@ -1520,7 +1521,7 @@ LocaleData::getAllInstalledLocaleNames() throw(RuntimeException)
if (lcl_LookupTableStatic::get().getFunctionSymbolByName( name, "getLocaleItem", &pCachedItem )) { if (lcl_LookupTableStatic::get().getFunctionSymbolByName( name, "getLocaleItem", &pCachedItem )) {
if( pCachedItem ) if( pCachedItem )
cachedItem.reset( pCachedItem ); cachedItem.reset( pCachedItem );
seq[nInstalled++] = LanguageTag::convertToLocale( name.replace( under, '-'), false); seq[nInstalled++] = LanguageTag::convertToLocale( name.replace( cUnder, cHyphen), false);
} }
else else
{ {
...@@ -1628,7 +1629,7 @@ LocaleData::getSupportedServiceNames() throw( RuntimeException ) ...@@ -1628,7 +1629,7 @@ LocaleData::getSupportedServiceNames() throw( RuntimeException )
OUString LocaleData::getFirstLocaleServiceName( const com::sun::star::lang::Locale & rLocale ) OUString LocaleData::getFirstLocaleServiceName( const com::sun::star::lang::Locale & rLocale )
{ {
if (rLocale.Language == I18NLANGTAG_QLT) if (rLocale.Language == I18NLANGTAG_QLT)
return rLocale.Variant.replace( '-', under); return rLocale.Variant.replace( cHyphen, cUnder);
else if (!rLocale.Country.isEmpty()) else if (!rLocale.Country.isEmpty())
return rLocale.Language + "_" + rLocale.Country; return rLocale.Language + "_" + rLocale.Country;
else else
...@@ -1645,7 +1646,7 @@ OUString LocaleData::getFirstLocaleServiceName( const com::sun::star::lang::Loca ...@@ -1645,7 +1646,7 @@ OUString LocaleData::getFirstLocaleServiceName( const com::sun::star::lang::Loca
aVec.erase( aVec.begin()); aVec.erase( aVec.begin());
for (::std::vector< OUString >::iterator it(aVec.begin()); it != aVec.end(); ++it) for (::std::vector< OUString >::iterator it(aVec.begin()); it != aVec.end(); ++it)
{ {
*it = (*it).replace( '-', under); *it = (*it).replace( cHyphen, cUnder);
} }
} }
else if (!rLocale.Country.isEmpty()) else if (!rLocale.Country.isEmpty())
......
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