[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/localedata.hxx |4 +- i18npool/source/localedata/LocaleNode.cxx | 59 +- i18npool/source/localedata/localedata.cxx | 41 +--- 3 files changed, 55 insertions(+), 49 deletions(-) New commits: commit 88304309b57abe1e50395c5f71862fabcd1c752e Author: Noel Grandin AuthorDate: Wed Jun 14 13:22:24 2023 +0200 Commit: Noel Grandin CommitDate: Thu Jun 15 13:05:29 2023 +0200 speed up startup time by avoid conversion of static locale data from sal_Unicode to OUString data - we can declare the data as OUStringConstExpr arrays and then no conversion is necessary. Change-Id: Iae879408d6761098d0e73526a65863d8f3cdb9ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153059 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx index 063637ca67f9..f4cd15a30254 100644 --- a/i18npool/inc/localedata.hxx +++ b/i18npool/inc/localedata.hxx @@ -149,8 +149,8 @@ private: /// @throws css::uno::RuntimeException oslGenericFunction getFunctionSymbol( const css::lang::Locale& rLocale, const char* pFunction ); -sal_Unicode ** getIndexArray(const css::lang::Locale& rLocale, sal_Int16& indexCount); -sal_Unicode ** getIndexArrayForAlgorithm(const css::lang::Locale& rLocale, std::u16string_view rAlgorithm); +OUString const * getIndexArray(const css::lang::Locale& rLocale, sal_Int16& indexCount); +OUString const * getIndexArrayForAlgorithm(const css::lang::Locale& rLocale, std::u16string_view rAlgorithm); /// @throws css::uno::RuntimeException css::uno::Sequence< css::i18n::CalendarItem2 > & getCalendarItemByName(const OUString& name, diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index b70cae2c713f..49024a6bc97f 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -1430,9 +1430,9 @@ void LCIndexNode::generateCode (const OFileWriter ) const OUString useLocale = getAttr().getValueByName("ref"); if (!useLocale.isEmpty()) { useLocale = useLocale.replace( '-', '_'); -of.writeRefFunction("getIndexAlgorithm_", useLocale); -of.writeRefFunction("getUnicodeScripts_", useLocale); -of.writeRefFunction("getFollowPageWords_", useLocale); +of.writeOUStringRefFunction("getIndexAlgorithm_", useLocale); +of.writeOUStringRefFunction("getUnicodeScripts_", useLocale); +of.writeOUStringRefFunction("getFollowPageWords_", useLocale); return; } sal_Int16 nbOfIndexs = 0; @@ -1444,28 +1444,28 @@ void LCIndexNode::generateCode (const OFileWriter ) const { OUString str; str = currNode->getAttr().getValueByName("unoid"); -of.writeParameter("IndexID", str, nbOfIndexs); +of.writeOUStringLiteralParameter("IndexID", str, nbOfIndexs); str = currNode->getAttr().getValueByName("module"); -of.writeParameter("IndexModule", str, nbOfIndexs); +of.writeOUStringLiteralParameter("IndexModule", str, nbOfIndexs); str = currNode->getValue(); -of.writeParameter("IndexKey", str, nbOfIndexs); +of.writeOUStringLiteralParameter("IndexKey", str, nbOfIndexs); str = currNode -> getAttr().getValueByName("default"); -of.writeDefaultParameter("Index", str, nbOfIndexs); +of.writeOUStringLiteralDefaultParameter("Index", str, nbOfIndexs); str = currNode -> getAttr().getValueByName("phonetic"); -of.writeDefaultParameter("Phonetic", str, nbOfIndexs); +of.writeOUStringLiteralDefaultParameter("Phonetic", str, nbOfIndexs); of.writeAsciiString("\n"); nbOfIndexs++; } if( currNode->getName() == "UnicodeScript" ) { -of.writeParameter("unicodeScript", currNode->getValue(), nbOfUnicodeScripts ); +of.writeOUStringLiteralParameter("unicodeScript", currNode->getValue(), nbOfUnicodeScripts ); nbOfUnicodeScripts++; } if( currNode->getName() == "FollowPageWord" ) { -of.writeParameter("followPageWord", currNode->getValue(), nbOfPageWords); +of.writeOUStringLiteralParameter("followPageWord", currNode->getValue(), nbOfPageWords); nbOfPageWords++; } } @@ -1473,7 +1473,7 @@ void LCIndexNode::generateCode (const OFileWriter ) const of.writeInt(nbOfIndexs); of.writeAsciiString(";\n\n"); -of.writeAsciiString("\nstatic const sal_Unicode* IndexArray[] = {\n"); +of.writeAsciiString("\nstatic constexpr rtl::OUStringConstExpr IndexArray[] = {\n"); for(sal_Int16 i = 0; i < nbOfIndexs; i++) { of.writeAsciiString("\tIndexID"); of.writeInt(i); @@ -1501,30 +1501,41 @@ void
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/localedata.hxx |2 i18npool/source/localedata/LocaleNode.cxx | 109 ++ i18npool/source/localedata/LocaleNode.hxx |4 + i18npool/source/localedata/filewriter.cxx | 26 +++ i18npool/source/localedata/localedata.cxx | 21 +++-- 5 files changed, 94 insertions(+), 68 deletions(-) New commits: commit ee76ed70e97448082f4c00c5c4207a44e1a91617 Author: Noel Grandin AuthorDate: Tue Jun 13 21:39:31 2023 +0200 Commit: Noel Grandin CommitDate: Wed Jun 14 08:47:00 2023 +0200 speed up startup time by avoid conversion of static locale data from sal_Unicode to OUString data - we can declare the data as OUStringConstExpr arrays and then no conversion is necessary. Change-Id: Iecc822169a2fcd2f4678e4d6c303083c54a54456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153005 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx index f86954791f99..063637ca67f9 100644 --- a/i18npool/inc/localedata.hxx +++ b/i18npool/inc/localedata.hxx @@ -162,7 +162,7 @@ private: /// /// @throws css::uno::RuntimeException css::uno::Sequence< css::i18n::CalendarItem2 > getCalendarItems( -sal_Unicode const * const * const allCalendars, +OUString const * allCalendars, sal_Int16 & rnOffset, const sal_Int16 nWhichItem, const sal_Int16 nCalendar, diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 0d24bc22e89a..08bf772321ad 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -1485,9 +1485,9 @@ static void lcl_writeAbbrFullNarrNames( const OFileWriter & of, const LocaleNode sal_uInt32 nChar = aFullName.iterateCodePoints( ::temporary(sal_Int32(0))); aNarrName = OUString( , 1); } -of.writeParameter( elementTag, "DefaultAbbrvName", aAbbrName, i, j); -of.writeParameter( elementTag, "DefaultFullName", aFullName, i, j); -of.writeParameter( elementTag, "DefaultNarrowName", aNarrName, i, j); +of.writeOUStringLiteralParameter( elementTag, "DefaultAbbrvName", aAbbrName, i, j); +of.writeOUStringLiteralParameter( elementTag, "DefaultFullName", aFullName, i, j); +of.writeOUStringLiteralParameter( elementTag, "DefaultNarrowName", aNarrName, i, j); } static void lcl_writeTabTagString( const OFileWriter & of, const char* pTag, const char* pStr ) @@ -1550,7 +1550,7 @@ void LCCalendarNode::generateCode (const OFileWriter ) const OUString useLocale = getAttr().getValueByName("ref"); if (!useLocale.isEmpty()) { useLocale = useLocale.replace( '-', '_'); -of.writeRefFunction("getAllCalendars_", useLocale); +of.writeOUStringRefFunction("getAllCalendars_", useLocale); return; } sal_Int16 nbOfCalendars = sal::static_int_cast( getNumberOfChildren() ); @@ -1585,7 +1585,7 @@ void LCCalendarNode::generateCode (const OFileWriter ) const for ( i = 0; i < nbOfCalendars; i++) { LocaleNode * calNode = getChildAt (i); OUString calendarID = calNode -> getAttr().getValueByName("unoid"); -of.writeParameter( "calendarID", calendarID, i); +of.writeOUStringLiteralParameter( "calendarID", calendarID, i); bool bGregorian = calendarID == "gregorian"; if (!bHasGregorian) bHasGregorian = bGregorian; @@ -1597,7 +1597,7 @@ void LCCalendarNode::generateCode (const OFileWriter ) const else calIt->second = true; str = calNode -> getAttr().getValueByName("default"); -of.writeDefaultParameter("Calendar", str, i); +of.writeOUStringLiteralDefaultParameter("Calendar", str, i); sal_Int16 nChild = 0; @@ -1614,8 +1614,8 @@ void LCCalendarNode::generateCode (const OFileWriter ) const } } if (!ref_name.isEmpty() && daysNode == nullptr) { -of.writeParameter("dayRef", u"ref", i); -of.writeParameter("dayRefName", ref_name, i); +of.writeOUStringLiteralParameter("dayRef", u"ref", i); +of.writeOUStringLiteralParameter("dayRefName", ref_name, i); nbOfDays[i] = 0; } else { if (daysNode == nullptr) @@ -1627,7 +1627,7 @@ void LCCalendarNode::generateCode (const OFileWriter ) const for (j = 0; j < nbOfDays[i]; j++) { LocaleNode *currNode = daysNode -> getChildAt(j); OUString dayID( currNode->getChildAt(0)->getValue()); -of.writeParameter("dayID", dayID, i, j); +of.writeOUStringLiteralParameter("dayID", dayID, i, j); if ( j == 0 && bGregorian && dayID != "sun" ) incError( "First day of a week of a Gregorian calendar must be sun");
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiterator_cjk.hxx |4 ++-- i18npool/source/breakiterator/breakiterator_cjk.cxx | 20 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) New commits: commit 35dca0ad624586c490bad612de0010c3bb228565 Author: Noel Grandin AuthorDate: Sat May 13 10:12:16 2023 +0200 Commit: Noel Grandin CommitDate: Sun May 14 08:58:57 2023 +0200 use more optional in i18npool Change-Id: If813a8bc339013c58f1b2d1f45f05b58d57f0abe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151724 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/breakiterator_cjk.hxx b/i18npool/inc/breakiterator_cjk.hxx index fce0d295ca68..0f8b0c6c0a7d 100644 --- a/i18npool/inc/breakiterator_cjk.hxx +++ b/i18npool/inc/breakiterator_cjk.hxx @@ -20,7 +20,7 @@ #include "breakiterator_unicode.hxx" #include "xdictionary.hxx" - +#include #include namespace i18npool { @@ -43,7 +43,7 @@ public: const css::i18n::LineBreakUserOptions& bOptions ) override; protected: -std::unique_ptr m_xDict; +std::optional m_oDict; OUString hangingCharacters; }; diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index baf302e6ef0c..f657daab0e2f 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -42,8 +42,8 @@ Boundary SAL_CALL BreakIterator_CJK::previousWord(const OUString& text, sal_Int32 anyPos, const css::lang::Locale& nLocale, sal_Int16 wordType) { -if (m_xDict) { -result = m_xDict->previousWord(text, anyPos, wordType); +if (m_oDict) { +result = m_oDict->previousWord(text, anyPos, wordType); // #109813# for non-CJK, single character word, fallback to ICU breakiterator. if (result.endPos - result.startPos != 1 || getScriptType(text, result.startPos) == ScriptType::ASIAN) @@ -59,8 +59,8 @@ Boundary SAL_CALL BreakIterator_CJK::nextWord(const OUString& text, sal_Int32 anyPos, const css::lang::Locale& nLocale, sal_Int16 wordType) { -if (m_xDict) { -result = m_xDict->nextWord(text, anyPos, wordType); +if (m_oDict) { +result = m_oDict->nextWord(text, anyPos, wordType); // #109813# for non-CJK, single character word, fallback to ICU breakiterator. if (result.endPos - result.startPos != 1 || getScriptType(text, result.startPos) == ScriptType::ASIAN) @@ -76,8 +76,8 @@ Boundary SAL_CALL BreakIterator_CJK::getWordBoundary( const OUString& text, sal_Int32 anyPos, const css::lang::Locale& nLocale, sal_Int16 wordType, sal_Bool bDirection ) { -if (m_xDict) { -result = m_xDict->getWordBoundary(text, anyPos, wordType, bDirection); +if (m_oDict) { +result = m_oDict->getWordBoundary(text, anyPos, wordType, bDirection); // #109813# for non-CJK, single character word, fallback to ICU breakiterator. if (result.endPos - result.startPos != 1 || getScriptType(text, result.startPos) == ScriptType::ASIAN) @@ -144,7 +144,7 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( // ; BreakIterator_zh::BreakIterator_zh() { -m_xDict = std::make_unique("zh"); +m_oDict.emplace("zh"); assert(hangingCharacters.pData); hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("zh", "CN")); cBreakIterator = "com.sun.star.i18n.BreakIterator_zh"; @@ -155,7 +155,7 @@ BreakIterator_zh::BreakIterator_zh() // ; BreakIterator_zh_TW::BreakIterator_zh_TW() { -m_xDict = std::make_unique("zh"); +m_oDict.emplace("zh"); assert(hangingCharacters.pData); hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("zh", "TW")); cBreakIterator = "com.sun.star.i18n.BreakIterator_zh_TW"; @@ -166,8 +166,8 @@ BreakIterator_zh_TW::BreakIterator_zh_TW() // ; BreakIterator_ja::BreakIterator_ja() { -m_xDict = std::make_unique("ja"); -m_xDict->setJapaneseWordBreak(); +m_oDict.emplace("ja"); +m_oDict->setJapaneseWordBreak(); assert(hangingCharacters.pData); hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("ja", "JP")); cBreakIterator = "com.sun.star.i18n.BreakIterator_ja";
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendar_gregorian.hxx |7 ++- i18npool/source/calendar/calendarImpl.cxx |3 ++- i18npool/source/calendar/calendar_gregorian.cxx | 10 ++ 3 files changed, 18 insertions(+), 2 deletions(-) New commits: commit ba76f0ba7e8de4d2953739c952004b7d9af47197 Author: Stephan Bergmann AuthorDate: Thu Dec 8 10:19:26 2022 +0100 Commit: Stephan Bergmann CommitDate: Wed Dec 14 12:00:21 2022 + loplugin:unocast (i18npool::Calendar_gregorian) (See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I1b0e544145c364cb9ee669b913132f41c1a8a66a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144147 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 1ee7cabaab1e..1f29d63f9f02 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -21,7 +21,9 @@ #include "calendarImpl.hxx" #include +#include +#include #include #include @@ -44,7 +46,7 @@ struct Era { const sal_Int16 FIELD_INDEX_COUNT = css::i18n::CalendarFieldIndex::FIELD_COUNT2; -class Calendar_gregorian : public CalendarImpl +class Calendar_gregorian : public cppu::ImplInheritanceHelper { public: @@ -98,6 +100,9 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() override; +sal_Int64 SAL_CALL getSomething(css::uno::Sequence const & aIdentifier) override; +static css::uno::Sequence const & getUnoTunnelId(); + protected: const Era *eraArray; std::unique_ptr body; diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 4e364696cf20..60391473f944 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -90,7 +91,7 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale& /* XXX NOTE: currently (2019-06-19) calendar implementations derive * from Calendar_gregorian, even Hijri and Jewish. If that should * change in future this should be adapted. */ -Calendar_gregorian* pCal = dynamic_cast(xCalendar.get()); +Calendar_gregorian* pCal = comphelper::getFromUnoTunnel(xCalendar); bTimeZone = (pCal && pCal->setTimeZone(rTimeZone)); } diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index e586470a0c31..9e9b248a5b28 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1077,6 +1078,15 @@ Calendar_gregorian::getSupportedServiceNames() return aRet; } +sal_Int64 Calendar_gregorian::getSomething(css::uno::Sequence const & aIdentifier) { +return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence const & Calendar_gregorian::getUnoTunnelId() { +static comphelper::UnoIdInit const id; +return id.getSeq(); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiteratorImpl.hxx |3 ++- i18npool/inc/calendarImpl.hxx |5 +++-- i18npool/inc/cclass_unicode.hxx|2 +- i18npool/inc/characterclassificationImpl.hxx |7 --- i18npool/inc/collatorImpl.hxx |5 +++-- i18npool/inc/inputsequencechecker.hxx |5 +++-- i18npool/inc/textconversionImpl.hxx|3 ++- i18npool/source/characterclassification/cclass_unicode.cxx |5 +++-- i18npool/source/localedata/LocaleNode.cxx |5 +++-- i18npool/source/localedata/LocaleNode.hxx |2 +- 10 files changed, 25 insertions(+), 17 deletions(-) New commits: commit 3cde7345199b535763bb7d83a87096e9157b7317 Author: Noel Grandin AuthorDate: Thu May 26 10:46:16 2022 +0200 Commit: Noel Grandin CommitDate: Thu May 26 18:30:04 2022 +0200 clang-tidy modernize-pass-by-value in i18npool Change-Id: I96d99fbdce2b0432676acec8b327cece7c39bcb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134983 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/breakiteratorImpl.hxx b/i18npool/inc/breakiteratorImpl.hxx index c27645a60ef2..a2700b7a9bf9 100644 --- a/i18npool/inc/breakiteratorImpl.hxx +++ b/i18npool/inc/breakiteratorImpl.hxx @@ -22,6 +22,7 @@ #include #include +#include #include namespace com::sun::star::uno { class XComponentContext; } @@ -103,7 +104,7 @@ protected: private: struct lookupTableItem { -lookupTableItem(const css::lang::Locale& _aLocale, css::uno::Reference < XBreakIterator > const & _xBI) : aLocale(_aLocale), xBI(_xBI) {}; +lookupTableItem(css::lang::Locale _aLocale, css::uno::Reference < XBreakIterator > _xBI) : aLocale(std::move(_aLocale)), xBI(std::move(_xBI)) {}; css::lang::Locale aLocale; css::uno::Reference < XBreakIterator > xBI; }; diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx index 4d90ed0ef2be..0580a878535e 100644 --- a/i18npool/inc/calendarImpl.hxx +++ b/i18npool/inc/calendarImpl.hxx @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace com::sun::star::uno { class XComponentContext; } @@ -92,8 +93,8 @@ public: private: struct lookupTableItem { -lookupTableItem(const OUString& rCacheID, css::uno::Reference < css::i18n::XCalendar4 > const & _xCalendar) -: m_aCacheID(rCacheID), xCalendar(_xCalendar) {} +lookupTableItem(OUString aCacheID, css::uno::Reference < css::i18n::XCalendar4 > _xCalendar) +: m_aCacheID(std::move(aCacheID)), xCalendar(std::move(_xCalendar)) {} OUString m_aCacheID; css::uno::Reference < css::i18n::XCalendar4 > xCalendar; }; diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index a10fe84eb8d9..03c03d5bbc97 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -64,7 +64,7 @@ namespace i18npool { class cclass_Unicode final : public cppu::WeakImplHelper < css::i18n::XCharacterClassification, css::lang::XServiceInfo > { public: -cclass_Unicode(const css::uno::Reference < css::uno::XComponentContext >& rxContext ); +cclass_Unicode(css::uno::Reference < css::uno::XComponentContext > xContext ); virtual ~cclass_Unicode() override; virtual OUString SAL_CALL toUpper( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, diff --git a/i18npool/inc/characterclassificationImpl.hxx b/i18npool/inc/characterclassificationImpl.hxx index 6ae8dee6c572..bcfc7836a92f 100644 --- a/i18npool/inc/characterclassificationImpl.hxx +++ b/i18npool/inc/characterclassificationImpl.hxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -68,9 +69,9 @@ public: private: struct lookupTableItem { -lookupTableItem(const css::lang::Locale& rLocale, const OUString& rName, -css::uno::Reference < XCharacterClassification > const & rxCI) : -aLocale(rLocale), aName(rName), xCI(rxCI) {}; +lookupTableItem(css::lang::Locale _aLocale, OUString _aName, +css::uno::Reference < XCharacterClassification > _xCI) : +aLocale(std::move(_aLocale)), aName(std::move(_aName)), xCI(std::move(_xCI)) {}; css::lang::Locale aLocale; OUString aName; css::uno::Reference < XCharacterClassification > xCI; diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx index 061333d84df9..4d2eee6b7fa9 100644 --- a/i18npool/inc/collatorImpl.hxx +++ b/i18npool/inc/collatorImpl.hxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -79,8 +80,8 @@ private: OUString algorithm; OUString service; css::uno::Reference < XCollator
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/xdictionary.hxx |6 i18npool/source/breakiterator/xdictionary.cxx | 34 -- 2 files changed, 28 insertions(+), 12 deletions(-) New commits: commit d4370761421508522a29c5206aea6e538d71b342 Author: Michael Weghorn AuthorDate: Fri Apr 29 15:23:41 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Apr 29 21:10:25 2022 +0200 tdf#148851 Unmap + close file again in xdictionary dtor The file opened and mapped to memory in the `xdictionary` ctor was never unmapped and closed again, resulting in a memory leak. For Android Viewer, this resulted in the app running out of memory after a while when scrolling up and down in the Chinese sample doc from tdf#148851. On Android, closing the file is actually the relevant part, because the content of files from `/assets` is automatically loaded into memory when the files are opened (s. the call to `openMemoryAsFile` in `openFilePath` in `sal/osl/unx/file.cxx`) and that memory is only freed when the file is closed again (s. `osl_closeFile`). When using the sample doc, the file in question was "file:///assets/share/dict_zh.data", which has a size of 2.2 MB and is therefore actually loaded into memory anew every time, since only files below 50 KiB are handled by the file cache introduced in commit 26a46c1143e34e361d76d6459535c2056c59de77 Date: Fri Dec 20 14:46:36 2019 + android: file-cache to improve performance. Fix the memory leak by unmapping and closing the file again in the dtor. Change-Id: I3388964877080d1f2b3cf2682a41549e0bfb850c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133581 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index cc7364bd14fc..f0861408bbd6 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -18,6 +18,7 @@ */ #pragma once +#include #include #include @@ -63,6 +64,11 @@ private: css::i18n::Boundary boundary; bool japaneseWordBreak; +#ifdef DICT_JA_ZH_IN_DATAFILE +oslFileHandle m_aFileHandle; +sal_uInt64 m_nFileSize; +char* m_pMapping; +#endif public: xdictionary(const char *lang); diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index dd1f83f8baa7..6c326f69e48f 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -62,6 +62,11 @@ sal_Unicode* getDataArea_zh(); xdictionary::xdictionary(const char *lang) : japaneseWordBreak( false ) +#ifdef DICT_JA_ZH_IN_DATAFILE +, m_aFileHandle(nullptr), +m_nFileSize(-1), +m_pMapping(nullptr) +#endif { #ifdef DICT_JA_ZH_IN_DATAFILE @@ -76,21 +81,18 @@ xdictionary::xdictionary(const char *lang) : else if( strcmp( lang, "zh" ) == 0 ) sUrl += "zh.data"; -oslFileHandle aFileHandle; -sal_uInt64 nFileSize; -char *pMapping; -if( osl_openFile( sUrl.pData, , osl_File_OpenFlag_Read ) == osl_File_E_None && -osl_getFileSize( aFileHandle, ) == osl_File_E_None && -osl_mapFile( aFileHandle, (void **) , nFileSize, 0, osl_File_MapFlag_RandomAccess ) == osl_File_E_None ) +if( osl_openFile( sUrl.pData, _aFileHandle, osl_File_OpenFlag_Read ) == osl_File_E_None && +osl_getFileSize( m_aFileHandle, _nFileSize) == osl_File_E_None && +osl_mapFile( m_aFileHandle, (void **) _pMapping, m_nFileSize, 0, osl_File_MapFlag_RandomAccess ) == osl_File_E_None ) { // We have the offsets to the parts of the file at its end, see gendict.cxx -sal_Int64 *pEOF = (sal_Int64*)(pMapping + nFileSize); +sal_Int64 *pEOF = (sal_Int64*)(m_pMapping + m_nFileSize); -data.existMark = (sal_uInt8*) (pMapping + pEOF[-1]); -data.index2 = (sal_Int32*) (pMapping + pEOF[-2]); -data.index1 = (sal_Int16*) (pMapping + pEOF[-3]); -data.lenArray = (sal_Int32*) (pMapping + pEOF[-4]); -data.dataArea = (sal_Unicode*) (pMapping + pEOF[-5]); +data.existMark = (sal_uInt8*) (m_pMapping + pEOF[-1]); +data.index2 = (sal_Int32*) (m_pMapping + pEOF[-2]); +data.index1 = (sal_Int16*) (m_pMapping + pEOF[-3]); +data.lenArray = (sal_Int32*) (m_pMapping + pEOF[-4]); +data.dataArea = (sal_Unicode*) (m_pMapping + pEOF[-5]); } } @@ -131,6 +133,14 @@ xdictionary::~xdictionary() delete [] i.wordboundary; } } +#ifdef DICT_JA_ZH_IN_DATAFILE +if (m_aFileHandle) { +if (m_pMapping) { +osl_unmapMappedFile(m_aFileHandle, m_pMapping, m_nFileSize); +} +osl_closeFile(m_aFileHandle); +} +#endif } namespace
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/cclass_unicode.hxx|6 +++- i18npool/inc/transliteration_body.hxx | 11 ++- i18npool/source/characterclassification/cclass_unicode.cxx | 19 - i18npool/source/transliteration/transliteration_body.cxx |9 -- 4 files changed, 27 insertions(+), 18 deletions(-) New commits: commit 0a790ba991daa9c84f836fd18290f621ea372460 Author: Noel Grandin AuthorDate: Sat Mar 12 14:50:28 2022 +0200 Commit: Noel Grandin CommitDate: Sat Mar 12 21:16:48 2022 +0100 tdf#147905 calc PROPER function doesn't like mulithreading regression from commit dac29c278531d5474289eb54aa03987c4958ac83 Author: Noel Grandin Date: Thu Sep 16 11:03:04 2021 +0200 if you hit Transliteration_casemapping hard enough, like in this test case, the state changes become a problem, so remove that by having multiple copies. Change-Id: I1d795af4370d6f79468387997202ba11c6a9d7b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131441 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index 3cfa1475a063..a10fe84eb8d9 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -94,7 +94,11 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; private: -rtl::Reference trans; +// These are performance sensitive, so we don't want to use locking and switch their state, so just +// have multiple copies. +rtl::Reference transToUpper; +rtl::Reference transToLower; +rtl::Reference transToTitle; // --- parser specific (implemented in cclass_unicode_parser.cxx) --- diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index a53aa77d15d2..6c3418fd7994 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -70,7 +70,16 @@ class Transliteration_casemapping final : public Transliteration_body { public: Transliteration_casemapping(); -void setMappingType(const MappingType rMappingType, const css::lang::Locale& rLocale ); +void setMappingType( const MappingType rMappingType ) +{ +if (nMappingType != rMappingType) +nMappingType = rMappingType; +} +void setLocale( const css::lang::Locale& rLocale ) +{ +if (aLocale != rLocale) +aLocale = rLocale; +} }; class Transliteration_togglecase final : public Transliteration_body diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx index 45f222c60f6f..6c44d0f517fe 100644 --- a/i18npool/source/characterclassification/cclass_unicode.cxx +++ b/i18npool/source/characterclassification/cclass_unicode.cxx @@ -39,7 +39,9 @@ namespace i18npool { // ; cclass_Unicode::cclass_Unicode( const uno::Reference < XComponentContext >& rxContext ) : -trans( new Transliteration_casemapping() ), +transToUpper( new Transliteration_casemapping() ), +transToLower( new Transliteration_casemapping() ), +transToTitle( new Transliteration_casemapping() ), m_xContext( rxContext ), nStartTypes( 0 ), nContTypes( 0 ), @@ -47,6 +49,9 @@ cclass_Unicode::cclass_Unicode( const uno::Reference < XComponentContext >& rxCo cDecimalSep( '.' ), cDecimalSepAlt( 0 ) { +transToUpper->setMappingType(MappingType::ToUpper); +transToLower->setMappingType(MappingType::ToLower); +transToTitle->setMappingType(MappingType::ToTitle); } cclass_Unicode::~cclass_Unicode() { @@ -62,8 +67,8 @@ cclass_Unicode::toUpper( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, if (nCount + nPos > len) nCount = len - nPos; -trans->setMappingType(MappingType::ToUpper, rLocale); -return trans->transliterateString2String(Text, nPos, nCount); +transToUpper->setLocale(rLocale); +return transToUpper->transliterateString2String(Text, nPos, nCount); } OUString SAL_CALL @@ -74,8 +79,8 @@ cclass_Unicode::toLower( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, if (nCount + nPos > len) nCount = len - nPos; -trans->setMappingType(MappingType::ToLower, rLocale); -return trans->transliterateString2String(Text, nPos, nCount); +transToLower->setLocale(rLocale); +return transToLower->transliterateString2String(Text, nPos, nCount); } OUString SAL_CALL @@ -88,7 +93,7 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, if (nCount + nPos > len) nCount = len - nPos; -trans->setMappingType(MappingType::ToTitle, rLocale); +transToTitle->setLocale(rLocale); rtl_uString* pStr = rtl_uString_alloc(nCount);
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/cclass_unicode.hxx |5 +-- i18npool/source/characterclassification/cclass_unicode.cxx|1 i18npool/source/characterclassification/cclass_unicode_parser.cxx | 16 +- i18npool/source/transliteration/transliteration_body.cxx |3 + 4 files changed, 12 insertions(+), 13 deletions(-) New commits: commit 35f1e9c7f97ed08dcb87e90cb663ae2d333739e5 Author: Noel Grandin AuthorDate: Tue Mar 1 13:46:32 2022 +0200 Commit: Noel Grandin CommitDate: Tue Mar 1 17:55:52 2022 +0100 fix data races in cclass_Unicode WARNING: ThreadSanitizer: data race (pid=1220516) Write of size 4 at 0x7b1c00035510 by thread T19 (mutexes: write M0): i18npool::Transliteration_casemapping::setMappingType(MappingType, com::sun::star::lang::Locale const&) :? (libi18npoollo.so+0xe5685) i18npool::cclass_Unicode::toUpper(rtl::OUString const&, int, int, com::sun::star::lang::Locale const&) :? (libi18npoollo.so+0x792fa) i18npool::CharacterClassificationImpl::toUpper(rtl::OUString const&, int, int, com::sun::star::lang::Locale const&) :? (libi18npoollo.so+0x83855) (libutllo.so+0xc6f42) (libsvllo.so+0xc5823) const&) ??:? (libsclo.so+0x4978f3) const&, std::shared_ptr const&) :? (libscfiltlo.so+0x46b354) const&, int) :? (libscfiltlo.so+0x46b44a) (libscfiltlo.so+0x4764a0) :? (libscfiltlo.so+0x4764e9) oox::core::ContextHandler2::endFastElement(int) ??:? (libooxlo.so+0x1a10eb) (libexpwraplo.so+0x2fbdf) (libexpwraplo.so+0x2fb21) char const*, unsigned char const*, unsigned char const*) fastparser.cxx:? (libexpwraplo.so+0x2c255) /build/libxml2-vTtzwD/libxml2-2.9.12+dfsg/builddir/main/../../parser.c:9736 (libxml2.so.2+0x5751a) (BuildId: baaa02c136f3351b1c499e94450b9b9c0d4e) /build/libxml2-vTtzwD/libxml2-2.9.12+dfsg/builddir/main/../../parser.c:9691 (libxml2.so.2+0x5751a) sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) :? (libexpwraplo.so+0x2972d) sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) ??:? (libexpwraplo.so+0x30e88) oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) ??:? (libooxlo.so+0x1a3220) oox::core::FastParser::parseStream(com::sun::star::uno::Reference const&, rtl::OUString const&) ??:? (libooxlo.so+0x1a3467) oox::core::XmlFilterBase::importFragment(rtl::Reference const&, oox::core::FastParser&) ??:? (libooxlo.so+0x1c46c1) oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference const&, oox::core::FastParser&) :? (libscfiltlo.so+0x4be642) workbookfragment.cxx:? (libscfiltlo.so+0x4b618d) (libcomphelper.so+0x15e63b) (libuno_salhelpergcc3.so.3+0x5257) #25 threadFunc :? (libuno_salhelpergcc3.so.3+0x550e) (libuno_sal.so.3+0x67e25) Previous write of size 4 at 0x7b1c00035510 by thread T18 (mutexes: write M1): i18npool::Transliteration_casemapping::setMappingType(MappingType, com::sun::star::lang::Locale const&) :? (libi18npoollo.so+0xe5685) i18npool::cclass_Unicode::toUpper(rtl::OUString const&, int, int, com::sun::star::lang::Locale const&) :? (libi18npoollo.so+0x792fa) i18npool::CharacterClassificationImpl::toUpper(rtl::OUString const&, int, int, com::sun::star::lang::Locale const&) :? (libi18npoollo.so+0x83855) (libutllo.so+0xc6f42) (libsvllo.so+0xc5823) const&) ??:? (libsclo.so+0x4978f3) const&, std::shared_ptr const&) :? (libscfiltlo.so+0x46b354) const&, int) :? (libscfiltlo.so+0x46b44a) (libscfiltlo.so+0x4764a0) :? (libscfiltlo.so+0x4764e9) oox::core::ContextHandler2::endFastElement(int) ??:? (libooxlo.so+0x1a10eb) (libexpwraplo.so+0x2fbdf) (libexpwraplo.so+0x2fb21) char const*, unsigned char const*, unsigned char const*) fastparser.cxx:? (libexpwraplo.so+0x2c255) /build/libxml2-vTtzwD/libxml2-2.9.12+dfsg/builddir/main/../../parser.c:9736 (libxml2.so.2+0x5751a) (BuildId: baaa02c136f3351b1c499e94450b9b9c0d4e) /build/libxml2-vTtzwD/libxml2-2.9.12+dfsg/builddir/main/../../parser.c:9691 (libxml2.so.2+0x5751a) sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) :? (libexpwraplo.so+0x2972d) sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) ??:? (libexpwraplo.so+0x30e88) oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) ??:? (libooxlo.so+0x1a3220) oox::core::FastParser::parseStream(com::sun::star::uno::Reference const&, rtl::OUString const&) ??:? (libooxlo.so+0x1a3467) oox::core::XmlFilterBase::importFragment(rtl::Reference const&, oox::core::FastParser&) ??:? (libooxlo.so+0x1c46c1) oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference const&,
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendar_hijri.hxx | 18 -- i18npool/source/calendar/calendar_hijri.cxx | 19 ++- 2 files changed, 6 insertions(+), 31 deletions(-) New commits: commit 9cad66da644e1721f9a49c2b5fffd86da08f78c5 Author: Hossein AuthorDate: Fri Nov 19 09:12:18 2021 +0100 Commit: Hossein CommitDate: Fri Nov 19 11:26:09 2021 +0100 Cleanup locally used variables in Calendar_hijri * Some variables that were only used in the calendar_hijri.cxx are now moved out of the header file, and they are no loner member variables of the the class Calendar_hijri. They are now placed in the the i18npool namespace. * Removed unused variables SynMonth, EveningPeriod and LeapYear * Moved a global variable definition to the member function that was the only place it was used. It is now a local variable. Change-Id: I8a8b25765bd8ed5640b1a0cfa46ec9903b460a53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125433 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx index c11a507bb420..707c877710a0 100644 --- a/i18npool/inc/calendar_hijri.hxx +++ b/i18npool/inc/calendar_hijri.hxx @@ -37,24 +37,6 @@ private: void mapToGregorian() override; void mapFromGregorian() override; -// Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec -static const double SynPeriod; - -static const double SynMonth; // Solar days in a year/SynPeriod - -// Julian day on Jan 1, 1900 -static const double jd1900; - -// Reference point: September 1984 25d 3h 10m UT. == 1405 Hijri == 1048 Synodial month from 1900 -static const sal_Int32 SynRef; -static const sal_Int32 GregRef; - -// Period between 1.30pm - 6:30pm -static const double EveningPeriod; - -// "Leap" years -static const sal_Int32 LeapYear[]; - private: static double NewMoon(sal_Int32 n); static void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year); diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 2944f455bb37..3d24150f8bf8 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -30,26 +30,17 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::i18n; -#define GREGORIAN_CROSSOVER 2299161 - namespace i18npool { // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec -const double Calendar_hijri::SynPeriod = 29.53058868; -const double Calendar_hijri::SynMonth = 365.25/29.53058868; // Solar days in a year/SynPeriod +constexpr double SynPeriod = 29.53058868; // Julian day on Jan 1, 1900 -const double Calendar_hijri::jd1900 = 2415020.75933; +constexpr double jd1900 = 2415020.75933; // Reference point: March 26, 2001 == 1422 Hijri == 1252 Synodial month from 1900 -const sal_Int32 Calendar_hijri::SynRef = 1252; -const sal_Int32 Calendar_hijri::GregRef = 1422; - -const double Calendar_hijri::EveningPeriod = 6.0; - -const sal_Int32 Calendar_hijri::LeapYear[] = { -2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 -}; +constexpr sal_Int32 SynRef = 1252; +constexpr sal_Int32 GregRef = 1422; Calendar_hijri::Calendar_hijri() { @@ -249,6 +240,8 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3 /* working variables */ tools::Long lFactorA, lFactorB, lFactorC, lFactorD, lFactorE; +constexpr sal_Int32 GREGORIAN_CROSSOVER = 2299161; + /* test whether to adjust for the Gregorian calendar crossover */ if (lJulianDay >= GREGORIAN_CROSSOVER) { /* calculate a small adjustment */
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendar_hijri.hxx |3 --- i18npool/source/calendar/calendar_hijri.cxx |9 - 2 files changed, 12 deletions(-) New commits: commit dd8b064af0b4cb44575eb4f3482db18485bfc8d3 Author: Hossein AuthorDate: Thu Nov 18 02:25:20 2021 +0100 Commit: Hossein CommitDate: Thu Nov 18 10:03:35 2021 +0100 Cleanup Calendar_hijri * Removed the static member variable SA_TimeZone, which is not used elsewhere * It is write-only according to the clang compilerplugins output: compilerplugins/clang/unusedvarsglobal.writeonly.results * Time zone should not be allocated as a constant * Removed unused local variables commented out 15 years ago to avoid warnings in: 4170cbdbdfc9ceb282d25e1e19cd7b4d178436bf Change-Id: Ifc24651ae0aee33dd6a01c77c919ce0cb0426366 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125432 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx index 9732ca373155..c11a507bb420 100644 --- a/i18npool/inc/calendar_hijri.hxx +++ b/i18npool/inc/calendar_hijri.hxx @@ -49,9 +49,6 @@ private: static const sal_Int32 SynRef; static const sal_Int32 GregRef; -// Local time (Saudi Arabia) -static const double SA_TimeZone;// Time Zone - // Period between 1.30pm - 6:30pm static const double EveningPeriod; diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 3bc6ccfa841d..2944f455bb37 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -34,9 +34,6 @@ using namespace ::com::sun::star::i18n; namespace i18npool { -// not used -//static UErrorCode status; // status is shared in all calls to Calendar, it has to be reset for each call. - // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec const double Calendar_hijri::SynPeriod = 29.53058868; const double Calendar_hijri::SynMonth = 365.25/29.53058868; // Solar days in a year/SynPeriod @@ -48,9 +45,6 @@ const double Calendar_hijri::jd1900 = 2415020.75933; const sal_Int32 Calendar_hijri::SynRef = 1252; const sal_Int32 Calendar_hijri::GregRef = 1422; -// Local time specific to Saudi Arabia -const double Calendar_hijri::SA_TimeZone= 3.0; - const double Calendar_hijri::EveningPeriod = 6.0; const sal_Int32 Calendar_hijri::LeapYear[] = { @@ -173,7 +167,6 @@ void Calendar_hijri::getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) { double prevday; -// double dayfraction; sal_Int32 syndiff; sal_Int32 newsyn; double newjd; @@ -221,9 +214,7 @@ void Calendar_hijri::ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) { sal_Int32 nmonth; -//double dayfraction; double jday; -//sal_Int32 dayint; if ( *year < 0 ) (*year)++;
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/nativenumbersupplier.hxx |8 +--- i18npool/source/nativenumber/nativenumbersupplier.cxx |6 +++--- i18npool/source/transliteration/transliteration_Numeric.cxx |4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) New commits: commit 270c04bd68cdb154ea1e74a307a5cbb6e81fb1a6 Author: Noel Grandin AuthorDate: Sat Sep 18 13:51:28 2021 +0200 Commit: Noel Grandin CommitDate: Sat Sep 18 18:25:59 2021 +0200 remove some allocations where we could be calling static methods Change-Id: I9efef083e6ff307441fb36c19eac9134d960edec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122300 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx index e1ea81627b3a..1f3e613caa62 100644 --- a/i18npool/inc/nativenumbersupplier.hxx +++ b/i18npool/inc/nativenumbersupplier.hxx @@ -44,8 +44,8 @@ public: virtual OUString SAL_CALL getNativeNumberString( const OUString& aNumberString, const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) override; -virtual sal_Bool SAL_CALL isValidNatNum( const css::lang::Locale& aLocale, -sal_Int16 nNativeNumberMode ) override; +virtual sal_Bool SAL_CALL isValidNatNum( const css::lang::Locale& rLocale, +sal_Int16 nNativeNumberMode ) override { return isValidNatNumImpl(rLocale, nNativeNumberMode); } virtual css::i18n::NativeNumberXmlAttributes SAL_CALL convertToXmlAttributes( const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) override; @@ -71,10 +71,12 @@ public: css::uno::Sequence* pOffset, const OUString& rNativeNumberParams = OUString()); /// @throws css::uno::RuntimeException -sal_Unicode getNativeNumberChar( const sal_Unicode inChar, +static sal_Unicode getNativeNumberChar( const sal_Unicode inChar, const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) ; private: +static bool isValidNatNumImpl( const css::lang::Locale& aLocale, +sal_Int16 nNativeNumberMode ); css::lang::Locale aLocale; mutable css::uno::Reference< css::i18n::XCharacterClassification > xCharClass; }; diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index 1055512ce944..13d6698ae203 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -634,7 +634,7 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum Sequence* pOffset, const OUString& rNativeNumberParams) { -if (!isValidNatNum(rLocale, nNativeNumberMode)) +if (!isValidNatNumImpl(rLocale, nNativeNumberMode)) return aNumberString; if (nNativeNumberMode == NativeNumberMode::NATNUM12) @@ -806,7 +806,7 @@ sal_Unicode NativeNumberSupplierService::getNativeNumberChar( const sal_Unicode if (!isNumber(inChar)) return inChar; -if (!isValidNatNum(rLocale, nNativeNumberMode)) +if (!isValidNatNumImpl(rLocale, nNativeNumberMode)) return inChar; sal_Int16 langnum = getLanguageNumber(rLocale); @@ -837,7 +837,7 @@ sal_Unicode NativeNumberSupplierService::getNativeNumberChar( const sal_Unicode return inChar; } -sal_Bool SAL_CALL NativeNumberSupplierService::isValidNatNum( const Locale& rLocale, sal_Int16 nNativeNumberMode ) +bool NativeNumberSupplierService::isValidNatNumImpl( const Locale& rLocale, sal_Int16 nNativeNumberMode ) { sal_Int16 langnum = getLanguageNumber(rLocale); diff --git a/i18npool/source/transliteration/transliteration_Numeric.cxx b/i18npool/source/transliteration/transliteration_Numeric.cxx index 4a24ebe4139f..35b2b2549b34 100644 --- a/i18npool/source/transliteration/transliteration_Numeric.cxx +++ b/i18npool/source/transliteration/transliteration_Numeric.cxx @@ -119,7 +119,7 @@ transliteration_Numeric::transliterateImpl( const OUString& inStr, sal_Int32 sta if (tableSize) return transliterateBullet( inStr, startPos, nCount, pOffset); else -return rtl::Reference(new NativeNumberSupplierService())->getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, pOffset ); +return rtl::Reference(new NativeNumberSupplierService())->getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, pOffset ); } sal_Unicode SAL_CALL @@ -134,7 +134,7 @@ transliteration_Numeric::transliterateChar2Char( sal_Unicode inChar ) return inChar; } else -return rtl::Reference(new
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/nativenumbersupplier.hxx |5 i18npool/source/nativenumber/nativenumbersupplier.cxx | 116 +--- i18npool/source/transliteration/textToPronounce_zh.cxx |3 i18npool/source/transliteration/transliteration_Numeric.cxx |2 4 files changed, 62 insertions(+), 64 deletions(-) New commits: commit 63fc008870c7c070c8e30b022aeb314e882ca8d2 Author: Noel Grandin AuthorDate: Sat Sep 18 12:03:45 2021 +0200 Commit: Caolán McNamara CommitDate: Sat Sep 18 13:01:19 2021 +0200 cid#1491946 and cid#1491949 deference before null check after commit c7551e8a46e2f9f8142aa7921a0494221ae096e8 Author: Noel Grandin Date: Thu Sep 16 10:36:48 2021 +0200 speedup CharacterClassificationImpl::toUpper Change-Id: If09857f89a4fa7de56831ea16d0b3ec8c50cfaf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122295 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx index c452cb4306df..e1ea81627b3a 100644 --- a/i18npool/inc/nativenumbersupplier.hxx +++ b/i18npool/inc/nativenumbersupplier.hxx @@ -38,7 +38,7 @@ class NativeNumberSupplierService final : public cppu::WeakImplHelper > { public: -NativeNumberSupplierService(bool _useOffset = false) : useOffset(_useOffset) {} +NativeNumberSupplierService() {} // Methods virtual OUString SAL_CALL getNativeNumberString( const OUString& aNumberString, @@ -68,7 +68,7 @@ public: OUString getNativeNumberString(const OUString& rNumberString, const css::lang::Locale& rLocale, sal_Int16 nNativeNumberMode, - css::uno::Sequence& offset, + css::uno::Sequence* pOffset, const OUString& rNativeNumberParams = OUString()); /// @throws css::uno::RuntimeException sal_Unicode getNativeNumberChar( const sal_Unicode inChar, @@ -76,7 +76,6 @@ public: private: css::lang::Locale aLocale; -bool useOffset; mutable css::uno::Reference< css::i18n::XCharacterClassification > xCharClass; }; diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index 8e2f9128a685..1055512ce944 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -81,12 +81,12 @@ static OUString getCyrillicNativeNumberString(const OUString& aNumberString); /// @throws RuntimeException static OUString AsciiToNativeChar( const OUString& inStr, sal_Int32 nCount, -Sequence< sal_Int32 >& offset, bool useOffset, sal_Int16 number ) +Sequence< sal_Int32 >* pOffset, sal_Int16 number ) { const sal_Unicode *src = inStr.getStr(); rtl_uString *newStr = rtl_uString_alloc(nCount); -if (useOffset) -offset.realloc(nCount); +if (pOffset) +pOffset->realloc(nCount); for (sal_Int32 i = 0; i < nCount; i++) { @@ -102,14 +102,14 @@ static OUString AsciiToNativeChar( const OUString& inStr, sal_Int32 nCount, } else newStr->buffer[i] = ch; -if (useOffset) -offset[i] = i; +if (pOffset) +(*pOffset)[i] = i; } return OUString(newStr, SAL_NO_ACQUIRE); // take ownership } static bool AsciiToNative_numberMaker(const sal_Unicode *str, sal_Int32 begin, sal_Int32 len, -sal_Unicode *dst, sal_Int32& count, sal_Int16 multiChar_index, Sequence< sal_Int32 >& offset, bool useOffset, sal_Int32 startPos, +sal_Unicode *dst, sal_Int32& count, sal_Int16 multiChar_index, Sequence< sal_Int32 >* pOffset, sal_Int32 startPos, const Number *number, const sal_Unicode* numberChar) { sal_Unicode multiChar = (multiChar_index == -1 ? 0 : number->multiplierChar[multiChar_index]); @@ -119,36 +119,36 @@ static bool AsciiToNative_numberMaker(const sal_Unicode *str, sal_Int32 begin, s for (const sal_Int32 end = begin+len; begin < end; begin++) { if (bNotZero || str[begin] != NUMBER_ZERO) { dst[count] = numberChar[str[begin] - NUMBER_ZERO]; -if (useOffset) -offset[count] = begin + startPos; +if (pOffset) +(*pOffset)[count] = begin + startPos; count++; bNotZero = true; } } if (bNotZero && multiChar > 0) { dst[count] = multiChar; -if (useOffset) -offset[count] = begin + startPos; +if (pOffset) +(*pOffset)[count] = begin + startPos; count++; }
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18nutil/source include/i18nutil
i18npool/inc/textToPronounce_zh.hxx|2 i18npool/inc/transliteration_Ignore.hxx| 10 +- i18npool/inc/transliteration_Numeric.hxx |6 - i18npool/inc/transliteration_OneToOne.hxx | 12 +-- i18npool/inc/transliteration_body.hxx |8 +- i18npool/inc/transliteration_commonclass.hxx |8 +- i18npool/source/transliteration/fullwidthToHalfwidth.cxx | 18 ++--- i18npool/source/transliteration/halfwidthToFullwidth.cxx | 18 ++--- i18npool/source/transliteration/ignoreDiacritics_CTL.cxx |6 - i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx | 12 +-- i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx | 12 +-- i18npool/source/transliteration/ignoreKana.cxx |4 - i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx | 12 +-- i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx | 12 +-- i18npool/source/transliteration/ignoreSize_ja_JP.cxx |4 - i18npool/source/transliteration/ignoreWidth.cxx|4 - i18npool/source/transliteration/textToPronounce_zh.cxx |8 +- i18npool/source/transliteration/transliteration_Ignore.cxx | 24 +++ i18npool/source/transliteration/transliteration_Numeric.cxx| 34 +- i18npool/source/transliteration/transliteration_OneToOne.cxx | 10 +- i18npool/source/transliteration/transliteration_body.cxx | 29 i18npool/source/transliteration/transliteration_commonclass.cxx|3 i18nutil/source/utility/widthfolding.cxx | 34 +- include/i18nutil/widthfolding.hxx |4 - 24 files changed, 147 insertions(+), 147 deletions(-) New commits: commit c7551e8a46e2f9f8142aa7921a0494221ae096e8 Author: Noel Grandin AuthorDate: Thu Sep 16 10:36:48 2021 +0200 Commit: Noel Grandin CommitDate: Thu Sep 16 12:05:00 2021 +0200 speedup CharacterClassificationImpl::toUpper remove empty sequence creation in CharacterClassificationImpl::toUpper, rather pass a pointer, so it can be nullptr. Which results in a fair degree of cascading change. Change-Id: Ie56d49dc71480195c1807764b0d5124f0019f30b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122183 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx index ff01d6624ca3..2ac854abddbd 100644 --- a/i18npool/inc/textToPronounce_zh.hxx +++ b/i18npool/inc/textToPronounce_zh.hxx @@ -42,7 +42,7 @@ public: virtual ~TextToPronounce_zh() override; OUString -foldingImpl(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > & offset, bool useOffset) override; +foldingImpl(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset) override; sal_Int16 SAL_CALL getType() override; diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index 854dbfeb5cac..eaf9d602179a 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -33,7 +33,7 @@ class transliteration_Ignore : public transliteration_commonclass { public: virtual OUString -foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; +foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; // This method is shared. sal_Bool SAL_CALL @@ -49,7 +49,7 @@ public: sal_Int16 SAL_CALL getType( ) override; OUString -transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; +transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar) override; @@ -98,7 +98,7 @@ public: ignoreDiacritics_CTL(); OUString -foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence& rOffset, bool useOffset) override; +foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence* pOffset) override; sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode nInChar) override; @@ -117,7 +117,7 @@ public:\ implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\ };\ OUString
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/characterclassificationImpl.hxx|5 +-- i18npool/inc/collatorImpl.hxx |5 +-- i18npool/inc/inputsequencechecker.hxx |5 +-- i18npool/source/characterclassification/characterclassificationImpl.cxx | 16 +- i18npool/source/collator/collatorImpl.cxx | 15 - i18npool/source/inputchecker/inputsequencechecker.cxx |8 + 6 files changed, 27 insertions(+), 27 deletions(-) New commits: commit 5ef182586ae2019fa6f6a59dae1b41b2225665bf Author: Noel Grandin AuthorDate: Tue Aug 10 20:53:07 2021 +0200 Commit: Noel Grandin CommitDate: Wed Aug 11 10:54:22 2021 +0200 no need to allocate the lookupTableItem separately Change-Id: I43919a002df01c6329ee483bf69f04669cdce1f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120293 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/characterclassificationImpl.hxx b/i18npool/inc/characterclassificationImpl.hxx index 34723ef74123..4e03a54fd3be 100644 --- a/i18npool/inc/characterclassificationImpl.hxx +++ b/i18npool/inc/characterclassificationImpl.hxx @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace com::sun::star::uno { class XComponentContext; } @@ -81,8 +82,8 @@ private: aLocale.Variant == rLocale.Variant; }; }; -std::vector> lookupTable; -lookupTableItem *cachedItem; +std::vector lookupTable; +std::optional cachedItem; css::uno::Reference < css::uno::XComponentContext > m_xContext; css::uno::Reference < XCharacterClassification > xUCI; diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx index 14a4489a256a..c1068638d8bc 100644 --- a/i18npool/inc/collatorImpl.hxx +++ b/i18npool/inc/collatorImpl.hxx @@ -27,6 +27,7 @@ #include #include +#include namespace com::sun::star::i18n { class XLocaleData5; } namespace com::sun::star::uno { class XComponentContext; } @@ -89,8 +90,8 @@ private: algorithm == _algorithm; } }; -std::vector> lookupTable; -lookupTableItem * cachedItem; +std::vector lookupTable; +std::optional cachedItem; // Service Factory css::uno::Reference < css::uno::XComponentContext > m_xContext; diff --git a/i18npool/inc/inputsequencechecker.hxx b/i18npool/inc/inputsequencechecker.hxx index 52963b3be171..eff426f5caa3 100644 --- a/i18npool/inc/inputsequencechecker.hxx +++ b/i18npool/inc/inputsequencechecker.hxx @@ -25,6 +25,7 @@ #include #include +#include namespace com::sun::star::uno { class XComponentContext; } @@ -63,8 +64,8 @@ private: const char* aLanguage; css::uno::Reference < css::i18n::XExtendedInputSequenceChecker > xISC; }; -std::vector> lookupTable; -lookupTableItem *cachedItem; +std::vector lookupTable; +std::optional cachedItem; css::uno::Reference < css::uno::XComponentContext > m_xContext; diff --git a/i18npool/source/characterclassification/characterclassificationImpl.cxx b/i18npool/source/characterclassification/characterclassificationImpl.cxx index 721c82bf9304..8146612a87fc 100644 --- a/i18npool/source/characterclassification/characterclassificationImpl.cxx +++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx @@ -125,10 +125,10 @@ bool CharacterClassificationImpl::createLocaleSpecificCharacterClassification(co { // to share service between same Language but different Country code, like zh_CN and zh_SG for (size_t l = 0; l < lookupTable.size(); l++) { -cachedItem = lookupTable[l].get(); +cachedItem = lookupTable[l]; if (serviceName == cachedItem->aName) { -lookupTable.emplace_back( new lookupTableItem(rLocale, serviceName, cachedItem->xCI) ); -cachedItem = lookupTable.back().get(); +lookupTable.emplace_back( rLocale, serviceName, cachedItem->xCI ); +cachedItem = lookupTable.back(); return true; } } @@ -140,8 +140,8 @@ bool CharacterClassificationImpl::createLocaleSpecificCharacterClassification(co if ( xI.is() ) { xCI.set( xI, UNO_QUERY ); if (xCI.is()) { -lookupTable.emplace_back( new lookupTableItem(rLocale, serviceName, xCI) ); -cachedItem = lookupTable.back().get(); +lookupTable.emplace_back( rLocale, serviceName, xCI ); +cachedItem = lookupTable.back(); return true; } } @@ -156,7 +156,7 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca return cachedItem->xCI; else { for (const auto & i : lookupTable) { -cachedItem = i.get(); +cachedItem = i; if
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/numberformatcode.hxx |3 ++- i18npool/source/numberformatcode/numberformatcode.cxx |8 2 files changed, 6 insertions(+), 5 deletions(-) New commits: commit 4799ee69d7193fcb1e8c105ef6c8b4ddc5e6721b Author: Noel Grandin AuthorDate: Sun Jul 18 11:41:45 2021 +0200 Commit: Noel Grandin CommitDate: Sun Jul 18 20:47:42 2021 +0200 osl::Mutex->std::mutex in NumberFormatCodeMapper Change-Id: I79d95ca1e5aa29d0a416d8870430062fd2b9936a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119130 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx index 2b1a5006653d..d51abd7de74b 100644 --- a/i18npool/inc/numberformatcode.hxx +++ b/i18npool/inc/numberformatcode.hxx @@ -27,6 +27,7 @@ #include #include +#include #include namespace com::sun::star::i18n { class XLocaleData5; } @@ -55,7 +56,7 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; private: -osl::Mutex maMutex; +std::mutex maMutex; css::uno::Reference < css::i18n::XLocaleData5 > m_xLocaleData; typedef std::pair< css::lang::Locale, css::uno::Sequence< css::i18n::FormatElement > > FormatElementCacheItem; std::deque < FormatElementCacheItem > m_aFormatElementCache; diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx index 90d6904b85a1..0e76f087b02f 100644 --- a/i18npool/source/numberformatcode/numberformatcode.cxx +++ b/i18npool/source/numberformatcode/numberformatcode.cxx @@ -43,7 +43,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, OUString elementType = mapElementTypeShortToString(formatType); OUString elementUsage = mapElementUsageShortToString(formatUsage); -osl::MutexGuard g(maMutex); +std::lock_guard g(maMutex); const css::uno::Sequence< css::i18n::FormatElement > = getFormats( rLocale ); auto pFormat = std::find_if(aFormatSeq.begin(), aFormatSeq.end(), @@ -67,7 +67,7 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, css::i18n::NumberFormatCode SAL_CALL NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::Locale& rLocale ) { -osl::MutexGuard g(maMutex); +std::lock_guard g(maMutex); const css::uno::Sequence< css::i18n::FormatElement > = getFormats( rLocale ); auto pFormat = std::find_if(aFormatSeq.begin(), aFormatSeq.end(), @@ -88,7 +88,7 @@ NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::L css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang::Locale& rLocale ) { -osl::MutexGuard g(maMutex); +std::lock_guard g(maMutex); const css::uno::Sequence< css::i18n::FormatElement > = getFormats( rLocale ); std::vector aVec; @@ -113,7 +113,7 @@ NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const css::lang css::uno::Sequence< css::i18n::NumberFormatCode > SAL_CALL NumberFormatCodeMapper::getAllFormatCodes( const css::lang::Locale& rLocale ) { -osl::MutexGuard g(maMutex); +std::lock_guard g(maMutex); const css::uno::Sequence< css::i18n::FormatElement > = getFormats( rLocale ); std::vector aVec; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source solenv/clang-format
i18npool/inc/servicename.hxx|3 i18npool/source/transliteration/hiraganaToKatakana.cxx | 11 i18npool/source/transliteration/ignoreKashida_CTL.cxx | 10 i18npool/source/transliteration/ignoreMiddleDot_ja_JP.cxx | 15 i18npool/source/transliteration/ignoreMinusSign_ja_JP.cxx | 13 i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx|5 i18npool/source/transliteration/ignoreSeparator_ja_JP.cxx | 151 -- i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx|5 i18npool/source/transliteration/ignoreTraditionalKana_ja_JP.cxx | 20 - i18npool/source/transliteration/ignoreZiZu_ja_JP.cxx| 20 - i18npool/source/transliteration/katakanaToHiragana.cxx | 10 i18npool/source/transliteration/largeToSmall_ja_JP.cxx | 67 ++-- i18npool/source/transliteration/smallToLarge_ja_JP.cxx | 67 ++-- solenv/clang-format/excludelist | 13 14 files changed, 192 insertions(+), 218 deletions(-) New commits: commit 10b23330a9655658e6d7ef1d008a3302a15e9629 Author: Philipp Hofer AuthorDate: Thu Nov 12 13:00:14 2020 +0100 Commit: Christian Lohmaier CommitDate: Sun Nov 22 01:58:10 2020 +0100 tdf#123936 Formatting files in module i18npool with clang-format Change-Id: I95fe065f4dcbe9d7bab105944ba4f835e80718ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105678 Tested-by: Jenkins Reviewed-by: Christian Lohmaier diff --git a/i18npool/inc/servicename.hxx b/i18npool/inc/servicename.hxx index cbe187729078..a988d31d031d 100644 --- a/i18npool/inc/servicename.hxx +++ b/i18npool/inc/servicename.hxx @@ -53,12 +53,11 @@ Implementation Name */ - #ifndef INCLUDED_I18NPOOL_INC_SERVICENAME_HXX #define INCLUDED_I18NPOOL_INC_SERVICENAME_HXX #define TRLT_SERVICELNAME "com.sun.star.i18n.Transliteration" -#define TRLT_SERVICELNAME_L10N TRLT_SERVICELNAME ".l10n" +#define TRLT_SERVICELNAME_L10N TRLT_SERVICELNAME ".l10n" #define TRLT_IMPLNAME_PREFIX "com.sun.star.i18n.Transliteration." //1...5...901...5...901...5...901..4 --> 34 diff --git a/i18npool/source/transliteration/hiraganaToKatakana.cxx b/i18npool/source/transliteration/hiraganaToKatakana.cxx index 439ec58365e2..80b6f14d82f8 100644 --- a/i18npool/source/transliteration/hiraganaToKatakana.cxx +++ b/i18npool/source/transliteration/hiraganaToKatakana.cxx @@ -22,12 +22,14 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; -namespace i18npool { - +namespace i18npool +{ // see http://charts.unicode.org/Web/U3040.html Hiragana (U+3040..U+309F) // see http://charts.unicode.org/Web/U30A0.html Katakana (U+30A0..U+30FF) -static sal_Unicode toKatakana (const sal_Unicode c) { -if ( (0x3041 <= c && c <= 0x3096) || (0x309d <= c && c <= 0x309f) ) { // 3040 - 309F HIRAGANA LETTER +static sal_Unicode toKatakana(const sal_Unicode c) +{ +if ((0x3041 <= c && c <= 0x3096) || (0x309d <= c && c <= 0x309f)) +{ // 3040 - 309F HIRAGANA LETTER // shift code point by 0x0060 return c + (0x30a0 - 0x3040); } @@ -41,7 +43,6 @@ hiraganaToKatakana::hiraganaToKatakana() transliterationName = "hiraganaToKatakana"; implementationName = "com.sun.star.i18n.Transliteration.HIRAGANA_KATAKANA"; } - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/transliteration/ignoreKashida_CTL.cxx b/i18npool/source/transliteration/ignoreKashida_CTL.cxx index 4dfb54da2e7d..e93ffd849481 100644 --- a/i18npool/source/transliteration/ignoreKashida_CTL.cxx +++ b/i18npool/source/transliteration/ignoreKashida_CTL.cxx @@ -9,12 +9,11 @@ #include -namespace i18npool { - -static sal_Unicode -ignoreKashida_CTL_translator (const sal_Unicode c) +namespace i18npool +{ +static sal_Unicode ignoreKashida_CTL_translator(const sal_Unicode c) { -if( c == 0x0640 ) // Check if it's Kashida +if (c == 0x0640) // Check if it's Kashida return 0x; // Then skip this character return c; @@ -28,7 +27,6 @@ ignoreKashida_CTL::ignoreKashida_CTL() transliterationName = "ignoreKashida_CTL"; implementationName = "com.sun.star.i18n.Transliteration.ignoreKashida_CTL"; } - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/transliteration/ignoreMiddleDot_ja_JP.cxx b/i18npool/source/transliteration/ignoreMiddleDot_ja_JP.cxx index b95a46910ae2..8b03275695bf 100644 --- a/i18npool/source/transliteration/ignoreMiddleDot_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreMiddleDot_ja_JP.cxx @@ -19,16 +19,16 @@ #include -namespace i18npool { - -static sal_Unicode -ignoreMiddleDot_ja_JP_translator (const sal_Unicode c) +namespace i18npool +{ +static sal_Unicode ignoreMiddleDot_ja_JP_translator(const sal_Unicode c) { -switch (c) { +switch (c) +{ case 0x30FB: // KATAKANA MIDDLE DOT
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18npool/util
i18npool/inc/transliteration_OneToOne.hxx| 12 - i18npool/source/registerservices/registerservices.cxx| 95 +-- i18npool/source/transliteration/fullwidthToHalfwidth.cxx | 12 - i18npool/source/transliteration/halfwidthToFullwidth.cxx |8 - i18npool/util/i18npool.component | 57 ++--- 5 files changed, 87 insertions(+), 97 deletions(-) New commits: commit d2140a6320cd1cf4dea29b174cdb3bcb5261056b Author: Noel Grandin AuthorDate: Tue Aug 4 20:18:17 2020 +0200 Commit: Noel Grandin CommitDate: Sun Aug 9 09:01:11 2020 +0200 i18npool: create instances with uno constructors and rename some classes to match their UNO implementation name. See tdf#74608 for motivation. Change-Id: I16aa64781d30a500f234029da6f6b00a645c46bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100133 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/transliteration_OneToOne.hxx b/i18npool/inc/transliteration_OneToOne.hxx index 45a3f61a9a37..9c2f79f8072d 100644 --- a/i18npool/inc/transliteration_OneToOne.hxx +++ b/i18npool/inc/transliteration_OneToOne.hxx @@ -68,8 +68,8 @@ public: \ }; TRANSLITERATION_ONETOONE( fullwidthToHalfwidth ) -TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana ) -TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC ) +TRANSLITERATION_ONETOONE( FULLWIDTHKATAKANA_HALFWIDTHKATAKANA ) +TRANSLITERATION_ONETOONE( FULLWIDTH_HALFWIDTH_LIKE_ASC ) class halfwidthToFullwidth final : public transliteration_OneToOne { @@ -78,17 +78,17 @@ public: OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; }; -class halfwidthKatakanaToFullwidthKatakana final : public transliteration_OneToOne +class HALFWIDTHKATAKANA_FULLWIDTHKATAKANA final : public transliteration_OneToOne { public: -halfwidthKatakanaToFullwidthKatakana(); +HALFWIDTHKATAKANA_FULLWIDTHKATAKANA(); OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; }; -class halfwidthToFullwidthLikeJIS final : public transliteration_OneToOne +class HALFWIDTH_FULLWIDTH_LIKE_JIS final : public transliteration_OneToOne { public: -halfwidthToFullwidthLikeJIS(); +HALFWIDTH_FULLWIDTH_LIKE_JIS(); OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; }; diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 8a5dc3c52e3c..878fc3c3de50 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -202,10 +202,12 @@ IMPL_UNO_CONSTRUCTOR( NumToCharEastIndic_ar ) IMPL_CREATEINSTANCE( NumToCharIndic_hi ) IMPL_CREATEINSTANCE( NumToChar_th ) -IMPL_CREATEINSTANCE( CharToNumLower_zh_CN ) -IMPL_CREATEINSTANCE( CharToNumUpper_zh_CN ) -IMPL_CREATEINSTANCE( CharToNumLower_zh_TW ) -IMPL_CREATEINSTANCE( CharToNumUpper_zh_TW ) +#if WITH_LOCALE_ALL || WITH_LOCALE_zh +IMPL_UNO_CONSTRUCTOR (CharToNumUpper_zh_CN) +IMPL_UNO_CONSTRUCTOR (CharToNumLower_zh_CN) +IMPL_UNO_CONSTRUCTOR (CharToNumUpper_zh_TW) +IMPL_UNO_CONSTRUCTOR (CharToNumLower_zh_TW) +#endif #if WITH_LOCALE_ALL || WITH_LOCALE_ja IMPL_UNO_CONSTRUCTOR( CharToNumFullwidth ) IMPL_UNO_CONSTRUCTOR( CharToNumKanjiShort_ja_JP ) @@ -239,12 +241,14 @@ IMPL_CREATEINSTANCE( NumToTextKanjiLongModern_ja_JP ) IMPL_CREATEINSTANCE( NumToTextKanjiLongTraditional_ja_JP ) IMPL_CREATEINSTANCE( NumToTextKanjiShortModern_ja_JP ) IMPL_CREATEINSTANCE( NumToTextKanjiShortTraditional_ja_JP ) -IMPL_CREATEINSTANCE( NumToTextFormalHangul_ko ) -IMPL_CREATEINSTANCE( NumToTextFormalLower_ko ) -IMPL_CREATEINSTANCE( NumToTextFormalUpper_ko ) -IMPL_CREATEINSTANCE( NumToTextInformalHangul_ko ) -IMPL_CREATEINSTANCE( NumToTextInformalUpper_ko ) -IMPL_CREATEINSTANCE( NumToTextInformalLower_ko ) +#if WITH_LOCALE_ALL || WITH_LOCALE_ko +IMPL_UNO_CONSTRUCTOR (NumToTextInformalHangul_ko) +IMPL_UNO_CONSTRUCTOR (NumToTextInformalLower_ko) +IMPL_UNO_CONSTRUCTOR (NumToTextInformalUpper_ko) +IMPL_UNO_CONSTRUCTOR (NumToTextFormalHangul_ko) +IMPL_UNO_CONSTRUCTOR (NumToTextFormalLower_ko) +IMPL_UNO_CONSTRUCTOR (NumToTextFormalUpper_ko) +#endif IMPL_CREATEINSTANCE( TextToNumLower_zh_CN ) IMPL_CREATEINSTANCE( TextToNumUpper_zh_CN ) @@ -260,22 +264,28 @@ IMPL_CREATEINSTANCE( TextToNumInformalUpper_ko ) IMPL_CREATEINSTANCE( TextToNumInformalLower_ko ) IMPL_CREATEINSTANCE( NumToTextDate_zh ) -IMPL_CREATEINSTANCE( NumToTextAIUFullWidth_ja_JP ) -IMPL_CREATEINSTANCE( NumToTextAIUHalfWidth_ja_JP ) -IMPL_CREATEINSTANCE( NumToTextIROHAFullWidth_ja_JP ) -IMPL_CREATEINSTANCE( NumToTextIROHAHalfWidth_ja_JP ) +#if WITH_LOCALE_ALL
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18npool/util
i18npool/inc/calendar_gregorian.hxx |8 i18npool/inc/indexentrysupplier_ja_phonetic.hxx | 13 i18npool/source/calendar/calendar_gregorian.cxx | 23 + i18npool/source/registerservices/registerservices.cxx | 297 +- i18npool/util/i18npool.component | 138 +--- 5 files changed, 220 insertions(+), 259 deletions(-) New commits: commit 155c056b1d4674d5ff73bbb5e1ad1dcd1e6aae36 Author: Noel Grandin AuthorDate: Wed Jul 29 20:04:44 2020 +0200 Commit: Noel Grandin CommitDate: Wed Jul 29 22:16:50 2020 +0200 i18npool: create instances with uno constructors See tdf#74608 for motivation. Change-Id: I814512ccc546bd015558a8122f0d2e3803437e38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99722 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 10bde05b2027..f66300d42e0a 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -151,10 +151,16 @@ class Calendar_hanja final : public Calendar_gregorian public: // Constructors Calendar_hanja(); -virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const css::lang::Locale& rLocale) override; virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override; }; +class Calendar_hanja_yoil final : public Calendar_gregorian +{ +public: +// Constructors +Calendar_hanja_yoil(); +virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override; +}; class Calendar_gengou final : public Calendar_gregorian diff --git a/i18npool/inc/indexentrysupplier_ja_phonetic.hxx b/i18npool/inc/indexentrysupplier_ja_phonetic.hxx index cced5597c22d..e376796ad0d1 100644 --- a/i18npool/inc/indexentrysupplier_ja_phonetic.hxx +++ b/i18npool/inc/indexentrysupplier_ja_phonetic.hxx @@ -42,21 +42,22 @@ public: const css::lang::Locale& rLocale2 ) override; }; -#define INDEXENTRYSUPPLIER_JA_PHONETIC( algorithm ) \ +#define INDEXENTRYSUPPLIER_JA_PHONETIC( algorithm, algo_descr ) \ class IndexEntrySupplier_##algorithm final : public IndexEntrySupplier_ja_phonetic {\ public:\ IndexEntrySupplier_##algorithm (const css::uno::Reference < css::uno::XComponentContext >& rxContext) : IndexEntrySupplier_ja_phonetic (rxContext) {\ -implementationName = "com.sun.star.i18n.IndexEntrySupplier_"#algorithm;\ +implementationName = "com.sun.star.i18n.IndexEntrySupplier_"#algo_descr;\ };\ virtual sal_Bool SAL_CALL loadAlgorithm(\ const css::lang::Locale& rLocale,\ const OUString& SortAlgorithm, sal_Int32 collatorOptions ) override;\ }; -INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_first_by_syllable ) -INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_first_by_consonant ) -INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_last_by_syllable ) -INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_last_by_consonant ) +/** descriptions formed by concatenating strings here must match names in .component file */ +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_first_by_syllable, " (alphanumeric first) (grouped by syllable)" ) +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_first_by_consonant, " (alphanumeric first) (grouped by consonant)" ) +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_last_by_syllable, " (alphanumeric last) (grouped by consonant)" ) +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_last_by_consonant, " (alphanumeric last) (grouped by consonant)" ) } #endif diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 3aa516814538..69fb08797ab3 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -201,14 +201,27 @@ Calendar_hanja::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 return Calendar_gregorian::getDisplayName( displayIndex, idx, nameType ); } -void SAL_CALL -Calendar_hanja::loadCalendar( const OUString& /*uniqueID*/, const css::lang::Locale& rLocale ) + +Calendar_hanja_yoil::Calendar_hanja_yoil() +{ +cCalendar = "com.sun.star.i18n.Calendar_Calendar_hanja_yoil"; +} + +OUString SAL_CALL +Calendar_hanja_yoil::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType ) { -// Since this class could be called by service name 'hanja_yoil', we have to -// rename uniqueID to get right calendar defined in locale data. -Calendar_gregorian::loadCalendar("hanja", rLocale); +if ( displayIndex == CalendarDisplayIndex::AM_PM ) { +// Am/Pm string for Korean Hanja calendar will refer to Japanese locale +css::lang::Locale jaLocale("ja", OUString(), OUString());
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendarImpl.hxx |2 +- i18npool/source/calendar/calendarImpl.cxx |7 +++ 2 files changed, 8 insertions(+), 1 deletion(-) New commits: commit ff508f6d8a3e58d29e9e7622006a7103fb0a2849 Author: Julien Nabet AuthorDate: Thu Jun 11 19:04:18 2020 +0200 Commit: Julien Nabet CommitDate: Fri Jun 12 09:39:00 2020 +0200 tdf#133898: get a context in default ctr (i18npool/calendarImpl) See bt here: https://bugs.documentfoundation.org/attachment.cgi?id=161882 Change-Id: If5a6c5e2b52af9ef97af9522296aaa58352cfa69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96161 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Julien Nabet diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx index f8c9333ed153..97135505146c 100644 --- a/i18npool/inc/calendarImpl.hxx +++ b/i18npool/inc/calendarImpl.hxx @@ -39,7 +39,7 @@ class CalendarImpl : public cppu::WeakImplHelper public: // Constructors -CalendarImpl() {}; +CalendarImpl(); CalendarImpl(const css::uno::Reference < css::uno::XComponentContext >& rxContext); /** diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 2cb659560489..8a288bcb6c31 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,8 +33,14 @@ namespace i18npool { #define ERROR RuntimeException() +CalendarImpl::CalendarImpl() : m_xContext(comphelper::getProcessComponentContext()) +{ +} + CalendarImpl::CalendarImpl(const Reference< XComponentContext > ) : m_xContext(rxContext) { +if (!m_xContext.is()) +throw ERROR; } CalendarImpl::~CalendarImpl() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/defaultnumberingprovider.hxx |4 +++ i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 12 ++ 2 files changed, 16 insertions(+) New commits: commit b0b1dbfb1d6b28339c2cdd79b765ec3eb5ce5aaf Author: Noel Grandin AuthorDate: Wed Jun 26 15:31:06 2019 +0200 Commit: Noel Grandin CommitDate: Fri Jun 28 14:04:30 2019 +0200 tdf#125706 Fields slow down down load, part3 Cache the supported numbering types in DefaultNumberingProvider. Takes the load time from 4.5s to 3.9s Change-Id: I6495f37faec7dba60ff30bd13e90790e70f8e704 Reviewed-on: https://gerrit.libreoffice.org/74742 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx index f01378ab075e..eb309b83c358 100644 --- a/i18npool/inc/defaultnumberingprovider.hxx +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -25,12 +25,14 @@ #include #include #include +#include namespace com::sun::star::container { class XHierarchicalNameAccess; } namespace com::sun::star::uno { class XComponentContext; } namespace i18npool { class TransliterationImpl; class NativeNumberSupplierService; +struct Supported_NumberingType; } namespace i18npool { @@ -78,6 +80,8 @@ private: css::uno::Reference < css::container::XHierarchicalNameAccess > xHierarchicalNameAccess; rtl::Reference translit; rtl::Reference mxNatNum; +std::map maSupportedTypesCache; + /// @throws css::uno::RuntimeException OUString makeNumberingIdentifier( sal_Int16 index ); /// @throws css::uno::RuntimeException diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 5e21a5a4dc5d..6f45022486a0 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -1072,17 +1072,29 @@ Sequence< sal_Int16 > DefaultNumberingProvider::getSupportedNumberingTypes( ) sal_Int16 DefaultNumberingProvider::getNumberingType( const OUString& rNumberingIdentifier ) { +auto it = maSupportedTypesCache.find(rNumberingIdentifier); +if (it != maSupportedTypesCache.end()) +return it->second->nType; for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) if(rNumberingIdentifier == makeNumberingIdentifier(i)) +{ +maSupportedTypesCache.emplace(rNumberingIdentifier, [i]); return aSupportedTypes[i].nType; +} throw RuntimeException(); } sal_Bool DefaultNumberingProvider::hasNumberingType( const OUString& rNumberingIdentifier ) { +auto it = maSupportedTypesCache.find(rNumberingIdentifier); +if (it != maSupportedTypesCache.end()) +return true; for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) if(rNumberingIdentifier == makeNumberingIdentifier(i)) +{ +maSupportedTypesCache.emplace(rNumberingIdentifier, [i]); return true; +} return false; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/defaultnumberingprovider.hxx |6 +- i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) New commits: commit 1ec6de1cff6a5f2c15aa85c12c6e327282ca8703 Author: Noel Grandin AuthorDate: Wed Jun 26 15:20:32 2019 +0200 Commit: Noel Grandin CommitDate: Fri Jun 28 12:48:40 2019 +0200 tdf#125706 Fields slow down down load, cache NativeNumberSupplierService Cache the NativeNumberSupplierService in DefaultNumberingProvider. Takes the load time from 5s to 4.5s. Change-Id: I13de1cd4db8785a1c94d40fb163bcc9b80a5c7f5 Reviewed-on: https://gerrit.libreoffice.org/74741 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx index eb9446c7098b..f01378ab075e 100644 --- a/i18npool/inc/defaultnumberingprovider.hxx +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -28,7 +28,10 @@ namespace com::sun::star::container { class XHierarchicalNameAccess; } namespace com::sun::star::uno { class XComponentContext; } -namespace i18npool { class TransliterationImpl; } +namespace i18npool { +class TransliterationImpl; +class NativeNumberSupplierService; +} namespace i18npool { @@ -74,6 +77,7 @@ private: css::uno::Reference < css::uno::XComponentContext > m_xContext; css::uno::Reference < css::container::XHierarchicalNameAccess > xHierarchicalNameAccess; rtl::Reference translit; +rtl::Reference mxNatNum; /// @throws css::uno::RuntimeException OUString makeNumberingIdentifier( sal_Int16 index ); /// @throws css::uno::RuntimeException diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index ce6eb1dde781..5e21a5a4dc5d 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -905,8 +905,9 @@ DefaultNumberingProvider::makeNumberingString( const Sequence xNatNum(new NativeNumberSupplierService); -result += xNatNum->getNativeNumberStringParams(OUString::number(number), locale, +if (!mxNatNum) +mxNatNum.set(new NativeNumberSupplierService); +result += mxNatNum->getNativeNumberStringParams(OUString::number(number), locale, natNum, sNatNumParams); } else if (tableSize) { if ( number > tableSize && !bRecycleSymbol) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source include/unotools offapi/com unotools/source
i18npool/inc/calendarImpl.hxx |8 +++-- i18npool/inc/calendar_gregorian.hxx |1 i18npool/source/calendar/calendarImpl.cxx | 36 i18npool/source/calendar/calendar_gregorian.cxx | 21 ++ include/unotools/calendarwrapper.hxx| 26 - offapi/com/sun/star/i18n/XCalendar4.idl | 24 unotools/source/i18n/calendarwrapper.cxx|8 ++--- 7 files changed, 110 insertions(+), 14 deletions(-) New commits: commit 942de6a01ba990e5f3bc55ce4ab3737a03f67f39 Author: Eike Rathke AuthorDate: Wed Jun 19 23:03:49 2019 +0200 Commit: Eike Rathke CommitDate: Thu Jun 20 01:57:20 2019 +0200 Resolves: tdf#92503 introduce TimeZone to calendar loading and default to UTC Without that, the system's time zone was used which on DST transition dates leads to non-existent times when switching to/from DST. As the calendar use and number parser/formatter nor conversions or calculations are time zone aware, using not DST afflicted UTC is the better choice. Change-Id: I3303c6620d8c4b9d081555c8293954fb1bd67895 Reviewed-on: https://gerrit.libreoffice.org/74386 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx index b35decb0f750..299bfe79bae2 100644 --- a/i18npool/inc/calendarImpl.hxx +++ b/i18npool/inc/calendarImpl.hxx @@ -84,6 +84,8 @@ public: // XCalendar4 virtual void SAL_CALL setLocalDateTime(double TimeInDays) override; virtual double SAL_CALL getLocalDateTime() override; +virtual void SAL_CALL loadDefaultCalendarTZ(const css::lang::Locale& rLocale, const OUString& rTimeZone) override; +virtual void SAL_CALL loadCalendarTZ(const OUString& uniqueID, const css::lang::Locale& rLocale, const OUString& rTimeZone) override; //XServiceInfo virtual OUString SAL_CALL getImplementationName() override; @@ -92,9 +94,9 @@ public: private: struct lookupTableItem { -lookupTableItem(const OUString& _uniqueID, css::uno::Reference < css::i18n::XCalendar4 > const & _xCalendar) -: uniqueID(_uniqueID), xCalendar(_xCalendar) {} -OUString uniqueID; +lookupTableItem(const OUString& rCacheID, css::uno::Reference < css::i18n::XCalendar4 > const & _xCalendar) +: m_aCacheID(rCacheID), xCalendar(_xCalendar) {} +OUString m_aCacheID; css::uno::Reference < css::i18n::XCalendar4 > xCalendar; }; std::vectorlookupTable; diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 894f2246e30b..aa9a02965d79 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -54,6 +54,7 @@ public: Calendar_gregorian(); Calendar_gregorian(const Era *_eraArray); void init(const Era *_eraArray); +bool setTimeZone( const OUString& rTimeZone ); /** * Destructor diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 93ff9b16fa0b..f0962104a4b0 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -40,12 +41,12 @@ CalendarImpl::~CalendarImpl() } void SAL_CALL -CalendarImpl::loadDefaultCalendar( const Locale& rLocale ) +CalendarImpl::loadDefaultCalendarTZ( const Locale& rLocale, const OUString& rTimeZone ) { Sequence< Calendar2 > xC = LocaleDataImpl::get()->getAllCalendars2(rLocale); for (sal_Int32 i = 0; i < xC.getLength(); i++) { if (xC[i].Default) { -loadCalendar(xC[i].Name, rLocale); +loadCalendarTZ(xC[i].Name, rLocale, rTimeZone); return; } } @@ -53,14 +54,16 @@ CalendarImpl::loadDefaultCalendar( const Locale& rLocale ) } void SAL_CALL -CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) +CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const Locale& rLocale, const OUString& rTimeZone ) { Reference < XCalendar4 > xOldCalendar( xCalendar ); // backup +const OUString aCacheID( uniqueID + "_" + rTimeZone); +bool bTimeZone = true; sal_Int32 i; for (i = 0; i < sal::static_int_cast(lookupTable.size()); i++) { lookupTableItem = lookupTable[i]; -if (uniqueID == listItem.uniqueID) { +if (aCacheID == listItem.m_aCacheID) { xCalendar = listItem.xCalendar; break; } @@ -85,7 +88,16 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) throw ERROR; xCalendar.set(xI, UNO_QUERY); -lookupTable.emplace_back( uniqueID, xCalendar ); +if (!rTimeZone.isEmpty()) +{ +/*
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18npool/util
i18npool/inc/calendar_gregorian.hxx | 10 ++ i18npool/source/calendar/calendar_gregorian.cxx | 13 + i18npool/source/registerservices/registerservices.cxx |4 i18npool/util/i18npool.component |3 +++ 4 files changed, 30 insertions(+) New commits: commit 5e67aa92a8f08fe488c9344851c2f819d4eaa542 Author: DaeHyun Sung AuthorDate: Sat May 25 09:33:33 2019 +0900 Commit: Eike Rathke CommitDate: Sat Jun 1 01:21:06 2019 +0200 Support to Korean Dangi Calendar for tdf#125446 Support to Korean Traditional Calendar, Dan-gi(단기/檀紀) Calendar The era name, Dangi(단기,檀紀) originating from the foundation of Gojoseon[고조선/古朝鮮] is also widely used in Korea as an indication of long civilization of Korea. Full name: `Dangun-giwon (단군기원, 檀君紀元 "First Age of Lord Dangun")` Abbreviation Name: `Dangi(단기,檀紀)` The Dangi Calendar measures years from the ancient founding of Korea in 2333 B.C. Reference. ICU Library ICU library support Dangi Calendar. ICU4C 50 http://bugs.icu-project.org/trac/ticket/9255 ICU4J 51 http://bugs.icu-project.org/trac/ticket/9616 Change-Id: I490b8b288c68f498eb29d4fcc73251cbef3ac6d4 Reviewed-on: https://gerrit.libreoffice.org/72943 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 6d343f33f28d..894f2246e30b 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -177,6 +177,16 @@ public: }; +// class Calendar_dangi + +class Calendar_dangi : public Calendar_gregorian +{ +public: +// Constructors +Calendar_dangi(); +}; + + // class Calendar_buddhist class Calendar_buddhist : public Calendar_gregorian diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 45a9de3bf3ef..18676361027a 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -226,6 +226,19 @@ Calendar_ROC::Calendar_ROC() : Calendar_gregorian(ROC_eraArray) cCalendar = "com.sun.star.i18n.Calendar_ROC"; } +/** +* The start year of the Korean traditional calendar (Dan-gi) is the inaugural +* year of Dan-gun (BC 2333). +*/ +static const Era dangi_eraArray[] = { +{-2332, 1, 1, 0}, +{0, 0, 0, 0} +}; +Calendar_dangi::Calendar_dangi() : Calendar_gregorian(dangi_eraArray) +{ +cCalendar = "com.sun.star.i18n.Calendar_dangi"; +} + static const Era buddhist_eraArray[] = { {-542, 1, 1, 0}, {0, 0, 0, 0} diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index f6c187c83a56..dd891558696d 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -114,6 +114,7 @@ IMPL_CREATEINSTANCE( Calendar_gregorian ) IMPL_CREATEINSTANCE( Calendar_hanja ) IMPL_CREATEINSTANCE( Calendar_gengou ) IMPL_CREATEINSTANCE( Calendar_ROC ) +IMPL_CREATEINSTANCE( Calendar_dangi ) IMPL_CREATEINSTANCE( Calendar_hijri ) IMPL_CREATEINSTANCE( Calendar_jewish ) IMPL_CREATEINSTANCE( Calendar_buddhist ) @@ -295,6 +296,9 @@ static const struct InstancesArray { { "com.sun.star.i18n.Calendar_ROC", "com.sun.star.i18n.Calendar_ROC", _ROC_CreateInstance }, +{ "com.sun.star.i18n.Calendar_dangi", +"com.sun.star.i18n.Calendar_dangi", +_dangi_CreateInstance }, { "com.sun.star.i18n.Calendar_hanja_yoil", "com.sun.star.i18n.Calendar_hanja_yoil", _hanja_CreateInstance }, diff --git a/i18npool/util/i18npool.component b/i18npool/util/i18npool.component index d4e7ea7b0a35..0b419d2f80f5 100644 --- a/i18npool/util/i18npool.component +++ b/i18npool/util/i18npool.component @@ -49,6 +49,9 @@ + + + ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/cclass_unicode.hxx |4 ++-- i18npool/source/characterclassification/cclass_unicode_parser.cxx |9 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) New commits: commit 9b4013ef522fe1faebf76f7f9c624e7e2a90c8c9 Author: Stephan Bergmann AuthorDate: Tue Aug 14 13:34:13 2018 +0200 Commit: Stephan Bergmann CommitDate: Tue Aug 14 16:07:02 2018 +0200 cclass_Unicode::StrChr needs to support non-BMP chars ...as seen with Clang's new -fsanitize=implicit-cast during CppunitTest_starmath_qa_cppunit: > i18npool/source/characterclassification/cclass_unicode_parser.cxx:565:46: runtime error: implicit conversion from type 'sal_uInt32' (aka 'unsigned int') of value 119886 (32-bit, unsigned) to type 'sal_Unicode' (aka 'char16_t') changed the value to 54350 (16-bit, unsigned) > #0 in i18npool::cclass_Unicode::getFlags(unsigned int) at i18npool/source/characterclassification/cclass_unicode_parser.cxx:565:46 (instdir/program/libi18npoollo.so +0x3ae807) > #1 in i18npool::cclass_Unicode::parseText(com::sun::star::i18n::ParseResult&, rtl::OUString const&, int, int) at i18npool/source/characterclassification/cclass_unicode_parser.cxx:712:29 (instdir/program/libi18npoollo.so +0x3b04c3) > #2 in i18npool::cclass_Unicode::parsePredefinedToken(int, rtl::OUString const&, int, com::sun::star::lang::Locale const&, int, rtl::OUString const&, int, rtl::OUString const&) at i18npool/source/characterclassification/cclass_unicode.cxx:275:5 (instdir/program/libi18npoollo.so +0x3a17ea) > #3 in non-virtual thunk to i18npool::cclass_Unicode::parsePredefinedToken(int, rtl::OUString const&, int, com::sun::star::lang::Locale const&, int, rtl::OUString const&, int, rtl::OUString const&) at i18npool/source/characterclassification/cclass_unicode.cxx (instdir/program/libi18npoollo.so +0x3a18dc) > #4 in i18npool::CharacterClassificationImpl::parsePredefinedToken(int, rtl::OUString const&, int, com::sun::star::lang::Locale const&, int, rtl::OUString const&, int, rtl::OUString const&) at i18npool/source/characterclassification/characterclassificationImpl.cxx:118:63 (instdir/program/libi18npoollo.so +0x3c48ba) > #5 in non-virtual thunk to i18npool::CharacterClassificationImpl::parsePredefinedToken(int, rtl::OUString const&, int, com::sun::star::lang::Locale const&, int, rtl::OUString const&, int, rtl::OUString const&) at i18npool/source/characterclassification/characterclassificationImpl.cxx (instdir/program/libi18npoollo.so +0x3c497c) > #6 in CharClass::parsePredefinedToken(int, rtl::OUString const&, int, int, rtl::OUString const&, int, rtl::OUString const&) const at unotools/source/i18n/charclass.cxx:443:25 (instdir/program/libutllo.so +0x904d17) > #7 in SmParser::NextToken() at starmath/source/parse.cxx:391:25 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa4a3e7) > #8 in SmParser::DoTerm(bool) at starmath/source/parse.cxx:1337:13 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa5951b) > #9 in SmParser::DoPower() at starmath/source/parse.cxx:1285:35 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa57d46) > #10 in SmParser::DoProduct() at starmath/source/parse.cxx:1105:19 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa5685a) > #11 in SmParser::DoSum() at starmath/source/parse.cxx:1087:19 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa55ebc) > #12 in SmParser::DoRelation() at starmath/source/parse.cxx:1069:19 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa558dc) > #13 in SmParser::DoExpression(bool) at starmath/source/parse.cxx:1043:29 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa54ff5) > #14 in SmParser::ParseExpression(rtl::OUString const&) at starmath/source/parse.cxx:2366:12 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0xa671dc) > #15 in (anonymous namespace)::Test::ParseAndCompare(char const*, char const*, char const*) at starmath/qa/cppunit/test_nodetotextvisitors.cxx:485:30 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0x5f7ea6) > #16 in (anonymous namespace)::Test::testMiscEquivalent() at starmath/qa/cppunit/test_nodetotextvisitors.cxx:637:5 (workdir/LinkTarget/CppunitTest/libtest_starmath_qa_cppunit.so +0x5f2dc8) Change-Id: Iaf62efd60bd6132e005ab69ce385bbf5c2db5d19 Reviewed-on: https://gerrit.libreoffice.org/58979 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index d962a3216585..cd77cbea275a 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -120,7 +120,7 @@ private: static const sal_Int32 pParseTokensType[]; /// If and where c occurs in pStr -static const sal_Unicode* StrChr( const
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/textToPronounce_zh.hxx|4 - i18npool/inc/transliteration_Ignore.hxx| 20 +++--- i18npool/inc/transliteration_Numeric.hxx | 10 +-- i18npool/inc/transliteration_OneToOne.hxx | 24 +++ i18npool/inc/transliteration_body.hxx | 14 ++-- i18npool/inc/transliteration_commonclass.hxx | 13 +++ i18npool/source/transliteration/fullwidthToHalfwidth.cxx | 28 ++-- i18npool/source/transliteration/halfwidthToFullwidth.cxx | 33 +++--- i18npool/source/transliteration/ignoreDiacritics_CTL.cxx |6 - i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx |4 - i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx |4 - i18npool/source/transliteration/ignoreKana.cxx |6 - i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx |4 - i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx |4 - i18npool/source/transliteration/ignoreSize_ja_JP.cxx |6 - i18npool/source/transliteration/ignoreWidth.cxx|6 - i18npool/source/transliteration/textToPronounce_zh.cxx |6 - i18npool/source/transliteration/transliteration_Ignore.cxx | 14 ++-- i18npool/source/transliteration/transliteration_Numeric.cxx| 14 ++-- i18npool/source/transliteration/transliteration_OneToOne.cxx | 12 +-- i18npool/source/transliteration/transliteration_body.cxx | 22 +++--- i18npool/source/transliteration/transliteration_commonclass.cxx|6 - 22 files changed, 123 insertions(+), 137 deletions(-) New commits: commit e9430571c41367625110cdcde168da178b8b30a9 Author: Luboš Luňák Date: Fri Jun 22 13:27:08 2018 +0200 remove the useOffset thread-unsafe hack from transliteration And instead pass it as an argument to an implementation function. Otherwise this is thread-unsafe for Calc's threaded calculation, and transliteration is used in various places in Calc code. Change-Id: Ibdf95e4b6867ec251618f6ff91e605acb69667c0 Reviewed-on: https://gerrit.libreoffice.org/56290 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx index d573cc1128ce..c311b8955875 100644 --- a/i18npool/inc/textToPronounce_zh.hxx +++ b/i18npool/inc/textToPronounce_zh.hxx @@ -41,8 +41,8 @@ public: #endif virtual ~TextToPronounce_zh() override; -OUString SAL_CALL -folding(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > & offset) override; +OUString +foldingImpl(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > & offset, bool useOffset) override; sal_Int16 SAL_CALL getType() override; diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index 6e01a3e8a1e9..4f46d10131c9 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -30,8 +30,8 @@ namespace i18npool { class transliteration_Ignore : public transliteration_commonclass { public: -virtual OUString SAL_CALL -folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override; +virtual OUString +foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; // This method is shared. sal_Bool SAL_CALL @@ -46,8 +46,8 @@ public: // Methods which are shared. sal_Int16 SAL_CALL getType( ) override; -OUString SAL_CALL -transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override; +OUString +transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar) override; @@ -95,8 +95,8 @@ class ignoreDiacritics_CTL : public transliteration_Ignore public: ignoreDiacritics_CTL(); -OUString SAL_CALL -folding(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence& rOffset) override; +OUString +foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence& rOffset, bool useOffset) override; sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode nInChar) override; @@ -114,8 +114,8 @@ public:\ transliterationName = "ignore"#name;\ implementationName =
[Libreoffice-commits] core.git: i18npool/inc i18npool/source svl/qa
i18npool/inc/defaultnumberingprovider.hxx |2 i18npool/inc/nativenumbersupplier.hxx |2 i18npool/source/calendar/calendar_gregorian.cxx |3 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 21 --- i18npool/source/nativenumber/nativenumbersupplier.cxx | 60 +- svl/qa/unit/svl.cxx | 13 +- 6 files changed, 77 insertions(+), 24 deletions(-) New commits: commit 261ff0cdf0e89a80f5d2af7ba5a331bc237a0ceb Author: László Németh Date: Tue Jun 12 11:50:05 2018 +0200 NatNum12: fix and add capitalization prefixes, tdf#115007 follow-up Limit NatNum12 conversion only for the selected parts of the date format (this bug – double calls of getNumberText – was hidden by the space prefix " " and empty return values at the first calls, resulting unchanged dates yet). New prefixes: "capitalize", "upper" and "title" to handle optional capitalization. (In Calc, it was not possible to format the result of NatNum formatting, but some languages often need capitalization or title case to format numbers and currencies.) Thanks code clean up using enum WhichCasing to Eike Rathke. Change-Id: I5fceb784930e6bc6d376116f5a42ad49cd248a54 Reviewed-on: https://gerrit.libreoffice.org/55681 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx index 97608c122000..1320b7e41a73 100644 --- a/i18npool/inc/defaultnumberingprovider.hxx +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -81,7 +80,6 @@ private: OUString makeNumberingIdentifier( sal_Int16 index ); /// @throws css::uno::RuntimeException bool isScriptFlagEnabled(const OUString& aName ); -mutable css::uno::Reference< css::i18n::XCharacterClassification > xCharClass; }; } diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx index d17c39fe7490..067a590b441a 100644 --- a/i18npool/inc/nativenumbersupplier.hxx +++ b/i18npool/inc/nativenumbersupplier.hxx @@ -24,6 +24,7 @@ #include #include #include +#include namespace i18npool { @@ -76,6 +77,7 @@ public: private: css::lang::Locale aLocale; bool useOffset; +mutable css::uno::Reference< css::i18n::XCharacterClassification > xCharClass; }; } diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 9d8a4c1442d3..a4ac0acfe53d 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -935,7 +935,8 @@ Calendar_gregorian::getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_In } aOUStr = OUString::createFromAscii(aStr); } -if (nNativeNumberMode > 0) { +// NatNum12 used only for selected parts +if (nNativeNumberMode > 0 && nNativeNumberMode != 12) { // For Japanese calendar, first year calls GAN, see bug 111668 for detail. if (eraArray == gengou_eraArray && value == 1 && (nCalendarDisplayCode == CalendarDisplayCode::SHORT_YEAR || diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index d363407c19fe..99cf26fe60cb 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -584,7 +584,6 @@ DefaultNumberingProvider::makeNumberingString( const Sequence xNatNum(new NativeNumberSupplierService); -OUString aNum = xNatNum->getNativeNumberStringParams(OUString::number(number), locale, +result += xNatNum->getNativeNumberStringParams(OUString::number(number), locale, natNum, sNatNumParams); -if (bCapitalize) -{ -if (!xCharClass.is()) -xCharClass = CharacterClassification::create(m_xContext); -// capitalize first letter -result += xCharClass->toTitle(aNum, 0, 1, aLocale) + aNum.copy(1); -} -else -result += aNum; } else if (tableSize) { if ( number > tableSize && !bRecycleSymbol) result += OUString::number( number); diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index b8cc35dcfef4..d9bff101a08c 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -597,7 +597,7 @@ OUString getNumberText(const Locale&
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18npool/util include/svl include/unotools offapi/com offapi/UnoApi_offapi.mk svl/qa svl/source unotools/source
i18npool/inc/nativenumbersupplier.hxx | 17 +- i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 19 +- i18npool/source/nativenumber/nativenumbersupplier.cxx | 44 +++--- i18npool/util/i18npool.component |1 include/svl/zformat.hxx |6 include/unotools/nativenumberwrapper.hxx | 12 + offapi/UnoApi_offapi.mk |2 offapi/com/sun/star/i18n/NativeNumberMode.idl | 13 - offapi/com/sun/star/i18n/NativeNumberSupplier2.idl| 45 ++ offapi/com/sun/star/i18n/XNativeNumberSupplier2.idl | 69 ++ svl/qa/unit/svl.cxx |4 svl/source/numbers/zformat.cxx| 35 - unotools/source/i18n/nativenumberwrapper.cxx | 28 +++- 13 files changed, 237 insertions(+), 58 deletions(-) New commits: commit 90d233b0311a208967a3e264820e00395bf057fb Author: Mike Kaganski Date: Sun May 13 03:09:43 2018 +0300 tdf#115007: Use [NatNum12 params...] syntax This allows using all the libnumbertext library functions. [NatNum12] gives cardinal number names (one, two, three, ...) [NatNum12 ordinal] gives ordinal number names (first, second, third, ...) [NatNum12 ordinal-number] gives ordinal indicators (1st, 2nd, 3rd, ...) [NatNum12 money USD][$-409] gives formal English (US) money text ... etc (see numbertext.org for syntax). Change-Id: I16dbb44d8d4bdb82a1b950de6d438c8311b554ff Reviewed-on: https://gerrit.libreoffice.org/54366 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx index e248a1812004..d17c39fe7490 100644 --- a/i18npool/inc/nativenumbersupplier.hxx +++ b/i18npool/inc/nativenumbersupplier.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_I18NPOOL_INC_NATIVENUMBERSUPPLIER_HXX #define INCLUDED_I18NPOOL_INC_NATIVENUMBERSUPPLIER_HXX -#include +#include #include #include #include @@ -32,7 +32,7 @@ namespace i18npool { // class NativeNumberSupplierService : public cppu::WeakImplHelper < -css::i18n::XNativeNumberSupplier, +css::i18n::XNativeNumberSupplier2, css::lang::XServiceInfo > { @@ -52,6 +52,11 @@ public: virtual sal_Int16 SAL_CALL convertFromXmlAttributes( const css::i18n::NativeNumberXmlAttributes& aAttr ) override; +// XNativeNumberSupplier2 +virtual OUString SAL_CALL getNativeNumberStringParams( +const OUString& rNumberString, const css::lang::Locale& rLocale, +sal_Int16 nNativeNumberMode, const OUString& rNativeNumberParams) override; + //XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; @@ -59,9 +64,11 @@ public: // following methods are not for XNativeNumberSupplier, they are for calling from transliterations /// @throws css::uno::RuntimeException -OUString getNativeNumberString( const OUString& aNumberString, -const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode, -css::uno::Sequence< sal_Int32 >& offset ); +OUString getNativeNumberString(const OUString& rNumberString, + const css::lang::Locale& rLocale, + sal_Int16 nNativeNumberMode, + css::uno::Sequence& offset, + const OUString& rNativeNumberParams = OUString()); /// @throws css::uno::RuntimeException sal_Unicode getNativeNumberChar( const sal_Unicode inChar, const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) ; diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index af4e27d0f69f..45a222ce9efd 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -585,6 +585,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence xNatNum(new NativeNumberSupplierService); -OUString aNum -= xNatNum->getNativeNumberString(OUString::number(number), locale, natNum); +OUString aNum = xNatNum->getNativeNumberStringParams(OUString::number(number), locale, + natNum, sNatNumParams); if (bCapitalize)
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiterator_th.hxx |5 -- i18npool/source/breakiterator/breakiterator_th.cxx | 46 - 2 files changed, 21 insertions(+), 30 deletions(-) New commits: commit 2c1fb32e0b3f0c51edcbb861977d372ae4eaf5e4 Author: Khaled HosnyDate: Tue May 22 05:40:26 2018 +0200 Use vector in BreakIterator_th instead of C arrays Change-Id: Ie93920bccfe5444e0066f8df85b4a9d2ff060a2d Reviewed-on: https://gerrit.libreoffice.org/54650 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Eike Rathke diff --git a/i18npool/inc/breakiterator_th.hxx b/i18npool/inc/breakiterator_th.hxx index 5c0119fbe919..c2f3629d1bc8 100644 --- a/i18npool/inc/breakiterator_th.hxx +++ b/i18npool/inc/breakiterator_th.hxx @@ -45,9 +45,8 @@ public: private: OUString cachedText; // for cell index -sal_Int32* nextCellIndex; -sal_Int32* previousCellIndex; -sal_Int32 cellIndexSize; +std::vector m_aNextCellIndex; +std::vector m_aPreviousCellIndex; void makeIndex(const OUString& text, sal_Int32 pos); }; diff --git a/i18npool/source/breakiterator/breakiterator_th.cxx b/i18npool/source/breakiterator/breakiterator_th.cxx index aa9d4e8b6ea5..a5ab63e9a63f 100644 --- a/i18npool/source/breakiterator/breakiterator_th.cxx +++ b/i18npool/source/breakiterator/breakiterator_th.cxx @@ -36,15 +36,12 @@ namespace i18npool { * Constructor. */ BreakIterator_th::BreakIterator_th() : -cachedText(), -nextCellIndex( nullptr ), -previousCellIndex( nullptr ), -cellIndexSize( 512 ) +cachedText() { cBreakIterator = "com.sun.star.i18n.BreakIterator_th"; // to improve performance, alloc big enough memory in construct. -nextCellIndex = static_cast (calloc(cellIndexSize, sizeof(sal_Int32))); -previousCellIndex = static_cast (calloc(cellIndexSize, sizeof(sal_Int32))); +m_aNextCellIndex.assign(512, 0); +m_aPreviousCellIndex.assign(512, 0); lineRule=nullptr; } @@ -53,8 +50,6 @@ BreakIterator_th::BreakIterator_th() : */ BreakIterator_th::~BreakIterator_th() { -free(nextCellIndex); -free(previousCellIndex); } sal_Int32 SAL_CALL BreakIterator_th::previousCharacters( const OUString& Text, @@ -66,12 +61,12 @@ sal_Int32 SAL_CALL BreakIterator_th::previousCharacters( const OUString& Text, if (nStartPos > 0) {// for others to skip cell. makeIndex(Text, nStartPos); -if (nextCellIndex[nStartPos-1] == 0) // not a CTL character +if (m_aNextCellIndex[nStartPos-1] == 0) // not a CTL character return BreakIterator_Unicode::previousCharacters(Text, nStartPos, rLocale, nCharacterIteratorMode, nCount, nDone); -else while (nCount > 0 && nextCellIndex[nStartPos - 1] > 0) { +else while (nCount > 0 && m_aNextCellIndex[nStartPos - 1] > 0) { nCount--; nDone++; -nStartPos = previousCellIndex[nStartPos - 1]; +nStartPos = m_aPreviousCellIndex[nStartPos - 1]; } } else nStartPos = 0; @@ -93,12 +88,12 @@ sal_Int32 SAL_CALL BreakIterator_th::nextCharacters(const OUString& Text, if (nStartPos < len) { makeIndex(Text, nStartPos); -if (nextCellIndex[nStartPos] == 0) // not a CTL character +if (m_aNextCellIndex[nStartPos] == 0) // not a CTL character return BreakIterator_Unicode::nextCharacters(Text, nStartPos, rLocale, nCharacterIteratorMode, nCount, nDone); -else while (nCount > 0 && nextCellIndex[nStartPos] > 0) { +else while (nCount > 0 && m_aNextCellIndex[nStartPos] > 0) { nCount--; nDone++; -nStartPos = nextCellIndex[nStartPos]; +nStartPos = m_aNextCellIndex[nStartPos]; } } else nStartPos = len; @@ -121,7 +116,7 @@ LineBreakResults SAL_CALL BreakIterator_th::getLineBreak( rLocale, nMinBreakPos, hOptions, bOptions ); if (lbr.breakIndex < Text.getLength()) { makeIndex(Text, lbr.breakIndex); -lbr.breakIndex = previousCellIndex[ lbr.breakIndex ]; +lbr.breakIndex = m_aPreviousCellIndex[ lbr.breakIndex ]; } return lbr; } @@ -193,17 +188,14 @@ void BreakIterator_th::makeIndex(const OUString& Text, sal_Int32 const nStartPos { if (Text != cachedText) { cachedText = Text; -if (cellIndexSize < cachedText.getLength()) { -cellIndexSize = cachedText.getLength(); -free(nextCellIndex); -free(previousCellIndex); -nextCellIndex = static_cast (calloc(cellIndexSize, sizeof(sal_Int32))); -previousCellIndex = static_cast (calloc(cellIndexSize, sizeof(sal_Int32))); +
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendar_hijri.hxx |2 +- i18npool/source/calendar/calendar_hijri.cxx | 15 +++ 2 files changed, 8 insertions(+), 9 deletions(-) New commits: commit bd29365d224ff1d34d4130703ddf8a33e487b6af Author: Stephan BergmannDate: Tue Jan 16 15:40:52 2018 +0100 Calendar_hijri::getJulianDay can just as well return sal_Int32 ...instead of converting from sal_Int32 to double and back to sal_Int32 Change-Id: I005777ff031dbbd919d46c971a84dff17f0adf9b Reviewed-on: https://gerrit.libreoffice.org/47997 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx index 31e2fc6d6bfc..240cc7b20095 100644 --- a/i18npool/inc/calendar_hijri.hxx +++ b/i18npool/inc/calendar_hijri.hxx @@ -67,7 +67,7 @@ private: static void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year); static void ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year); static void getGregorianDay(sal_Int32 jd, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear); -static double getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year); +static sal_Int32 getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year); }; } diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 34586a482557..064d04e6d4d6 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -176,17 +176,16 @@ Calendar_hijri::getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) sal_Int32 syndiff; sal_Int32 newsyn; double newjd; -double julday; sal_Int32 synmonth; // Get Julian Day from Gregorian -julday = getJulianDay(*day, *month, *year); +sal_Int32 const julday = getJulianDay(*day, *month, *year); // obtain approx. of how many Synodic months since the beginning of the year 1900 synmonth = static_cast(0.5 + (julday - jd1900)/SynPeriod); newsyn = synmonth; -prevday = static_cast(julday) - 0.5; +prevday = julday - 0.5; do { newjd = NewMoon(newsyn); @@ -200,7 +199,7 @@ Calendar_hijri::getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year) syndiff = newsyn - SynRef; // Round up the day -*day = static_cast(static_cast(julday) - newjd + 0.5); +*day = static_cast(julday - newjd + 0.5); *month = (syndiff % 12) + 1; // currently not supported @@ -293,17 +292,17 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3 (*pnYear)--; } -double +sal_Int32 Calendar_hijri::getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year) { double jy, jm; if( year == 0 ) { -return -1.0; +return -1; } if( year == 1582 && month == 10 && day > 4 && day < 15 ) { -return -1.0; +return -1; } if( month > 2 ) { @@ -325,7 +324,7 @@ Calendar_hijri::getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year) intgr += static_cast(2 - ja + static_cast(0.25 * ja)); } -return static_cast(intgr); +return intgr; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/collator_unicode.hxx|2 - i18npool/source/breakiterator/breakiterator_unicode.cxx | 26 +++ i18npool/source/collator/collator_unicode.cxx| 16 - i18npool/source/collator/gencoll_rule.cxx|2 - i18npool/source/ordinalsuffix/ordinalsuffix.cxx |2 - i18npool/source/transliteration/ignoreDiacritics_CTL.cxx |6 +-- 6 files changed, 27 insertions(+), 27 deletions(-) New commits: commit f7961456d81c3ee6ee4c13eac9ef7add6c7ea6b5 Author: Eike RathkeDate: Mon Dec 18 20:28:07 2017 +0100 Explicitly qualify ICU types with icu:: namespace It will be required by ICU 61 anyway, see https://ssl.icu-project.org/repos/icu/trunk/icu4c/readme.html#RecBuild Change-Id: I16b6bc8b8c49713f32424df5fc6db494df7b6892 Reviewed-on: https://gerrit.libreoffice.org/46738 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/i18npool/inc/collator_unicode.hxx b/i18npool/inc/collator_unicode.hxx index 69d317797870..d943bc9bc2c1 100644 --- a/i18npool/inc/collator_unicode.hxx +++ b/i18npool/inc/collator_unicode.hxx @@ -63,7 +63,7 @@ public: private: const sal_Char *implementationName; -RuleBasedCollator *uca_base, *collator; +icu::RuleBasedCollator *uca_base, *collator; #ifndef DISABLE_DYNLOADING oslModule hModule; #endif diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index a81a80e153ba..02da856a5b99 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -56,14 +56,14 @@ BreakIterator_Unicode::~BreakIterator_Unicode() } /* -Wrapper class to provide public access to the RuleBasedBreakIterator's +Wrapper class to provide public access to the icu::RuleBasedBreakIterator's setbreakType method. */ -class OOoRuleBasedBreakIterator : public RuleBasedBreakIterator +class OOoRuleBasedBreakIterator : public icu::RuleBasedBreakIterator { public: #if (U_ICU_VERSION_MAJOR_NUM < 58) -// RuleBasedBreakIterator::setBreakType() is private as of ICU 58. +// icu::RuleBasedBreakIterator::setBreakType() is private as of ICU 58. void publicSetBreakType(int32_t type) { setBreakType(type); @@ -71,7 +71,7 @@ class OOoRuleBasedBreakIterator : public RuleBasedBreakIterator #endif OOoRuleBasedBreakIterator(UDataMemory* image, UErrorCode ) -: RuleBasedBreakIterator(image, status) +: icu::RuleBasedBreakIterator(image, status) { }; }; @@ -334,7 +334,7 @@ sal_Int32 SAL_CALL BreakIterator_Unicode::nextCharacters( const OUString& Text, icu::BreakIterator* pBI = character.mpValue->mpBreakIterator.get(); for (nDone = 0; nDone < nCount; nDone++) { nStartPos = pBI->following(nStartPos); -if (nStartPos == BreakIterator::DONE) +if (nStartPos == icu::BreakIterator::DONE) return Text.getLength(); } } else { // for CHARACTER mode @@ -353,7 +353,7 @@ sal_Int32 SAL_CALL BreakIterator_Unicode::previousCharacters( const OUString& Te icu::BreakIterator* pBI = character.mpValue->mpBreakIterator.get(); for (nDone = 0; nDone < nCount; nDone++) { nStartPos = pBI->preceding(nStartPos); -if (nStartPos == BreakIterator::DONE) +if (nStartPos == icu::BreakIterator::DONE) return 0; } } else { // for BS to delete one char and CHARACTER mode. @@ -371,7 +371,7 @@ Boundary SAL_CALL BreakIterator_Unicode::nextWord( const OUString& Text, sal_Int Boundary rv; rv.startPos = icuBI->mpValue->mpBreakIterator->following(nStartPos); -if( rv.startPos >= Text.getLength() || rv.startPos == BreakIterator::DONE ) +if( rv.startPos >= Text.getLength() || rv.startPos == icu::BreakIterator::DONE ) rv.endPos = result.startPos; else { if ( (rWordType == WordType::ANYWORD_IGNOREWHITESPACES || @@ -380,7 +380,7 @@ Boundary SAL_CALL BreakIterator_Unicode::nextWord( const OUString& Text, sal_Int rv.startPos = icuBI->mpValue->mpBreakIterator->following(rv.startPos); rv.endPos = icuBI->mpValue->mpBreakIterator->following(rv.startPos); -if(rv.endPos == BreakIterator::DONE) +if(rv.endPos == icu::BreakIterator::DONE) rv.endPos = rv.startPos; } return rv; @@ -394,7 +394,7 @@ Boundary SAL_CALL BreakIterator_Unicode::previousWord(const OUString& Text, sal_ Boundary rv; rv.startPos = icuBI->mpValue->mpBreakIterator->preceding(nStartPos); -if( rv.startPos < 0 || rv.startPos == BreakIterator::DONE) +if( rv.startPos < 0 || rv.startPos == icu::BreakIterator::DONE) rv.endPos = rv.startPos; else { if
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18npool/util
i18npool/inc/localedata.hxx |9 +++-- i18npool/source/localedata/localedata.cxx | 46 +- i18npool/util/i18npool.component |1 3 files changed, 52 insertions(+), 4 deletions(-) New commits: commit ba9f44d6ee560bbba09834b1070d19ec62d35783 Author: Eike RathkeDate: Thu Oct 26 21:34:17 2017 +0200 Implement LocaleData2, XLocaleData5, LocaleDataItem2, tdf#81671 Change-Id: Idba5a30bc44c7b2bd951f954ea3bfd048b022660 Reviewed-on: https://gerrit.libreoffice.org/43920 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx index c3aa6cf57d2c..4a83d44375b2 100644 --- a/i18npool/inc/localedata.hxx +++ b/i18npool/inc/localedata.hxx @@ -23,7 +23,7 @@ #include -#include +#include #include @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -61,7 +61,7 @@ namespace i18npool { class LocaleDataImpl : public cppu::WeakImplHelper < -css::i18n::XLocaleData4, +css::i18n::XLocaleData5, css::lang::XServiceInfo > { @@ -108,6 +108,9 @@ public: // XLocaleData4 virtual css::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns( const css::lang::Locale& rLocale ) override; +// XLocaleData5 +virtual css::i18n::LocaleDataItem2 SAL_CALL getLocaleItem2( const css::lang::Locale& rLocale ) override; + // following methods are used by indexentry service /// @throws css::uno::RuntimeException css::uno::Sequence< OUString > SAL_CALL getIndexAlgorithm( const css::lang::Locale& rLocale ); diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 500a9408136e..e84f2b6282e7 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -423,6 +423,47 @@ LocaleDataImpl::getLocaleItem( const Locale& rLocale ) } } + +LocaleDataItem2 SAL_CALL +LocaleDataImpl::getLocaleItem2( const Locale& rLocale ) +{ +MyFunc_Type func = reinterpret_cast(getFunctionSymbol( rLocale, "getLocaleItem" )); + +if ( func ) { +sal_Int16 dataItemCount = 0; +sal_Unicode **dataItem = func(dataItemCount); + +assert(dataItemCount >= 18); + +LocaleDataItem2 item( +dataItem[0], +dataItem[1], +dataItem[2], +dataItem[3], +dataItem[4], +dataItem[5], +dataItem[6], +dataItem[7], +dataItem[8], +dataItem[9], +dataItem[10], +dataItem[11], +dataItem[12], +dataItem[13], +dataItem[14], +dataItem[15], +dataItem[16], +dataItem[17], +dataItemCount >= 19 ? dataItem[18] : OUString() +); +return item; +} +else { +LocaleDataItem2 item1; +return item1; +} +} + #ifndef DISABLE_DYNLOADING extern "C" { static void SAL_CALL thisModule() {} } @@ -1560,7 +1601,10 @@ sal_Bool SAL_CALL LocaleDataImpl::supportsService(const OUString& rServiceName) Sequence< OUString > SAL_CALL LocaleDataImpl::getSupportedServiceNames() { -Sequence< OUString > aRet { "com.sun.star.i18n.LocaleData" }; +Sequence< OUString > aRet { +"com.sun.star.i18n.LocaleData", +"com.sun.star.i18n.LocaleData2" +}; return aRet; } diff --git a/i18npool/util/i18npool.component b/i18npool/util/i18npool.component index 1b74fd736f54..3598ffa8b781 100644 --- a/i18npool/util/i18npool.component +++ b/i18npool/util/i18npool.component @@ -128,6 +128,7 @@ + ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiterator_unicode.hxx | 25 + i18npool/source/breakiterator/breakiterator_unicode.cxx | 223 2 files changed, 190 insertions(+), 58 deletions(-) New commits: commit 0f6b9eca2007629e61d3ab9cdf2a616a33cbdefe Author: Eike RathkeDate: Wed Sep 27 16:25:12 2017 +0200 i18n-perf: cache map of breakiterators, tdf#108703 See source code comment. Change-Id: I75015f3492a24f5f69a163dca165dcf57d6f0e28 Reviewed-on: https://gerrit.libreoffice.org/42866 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx index 8783764cb0e1..c9e644e31f42 100644 --- a/i18npool/inc/breakiterator_unicode.hxx +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -23,6 +23,7 @@ #include #include +#include namespace com { namespace sun { namespace star { namespace i18n { @@ -71,27 +72,35 @@ public: protected: const sal_Char *cBreakIterator, *lineRule; -struct BI_Data +/** Used as map value. */ +struct BI_ValueData { -OUStringaICUText; -UText* ut; -std::unique_ptr aBreakIterator; -css::lang::Locale maLocale; +OUStringmaICUText; +UText* mpUt; +std::shared_ptr< icu::BreakIterator > mpBreakIterator; -BI_Data() : ut(nullptr) +BI_ValueData() : mpUt(nullptr) { } -~BI_Data() +~BI_ValueData() { -utext_close(ut); +utext_close(mpUt); } +}; +struct BI_Data +{ +std::shared_ptr< BI_ValueData > mpValue; +OString maBIMapKey; } character, sentence, line, *icuBI; BI_Data words[4]; // 4 is css::i18n::WordType enumeration size /// @throws css::uno::RuntimeException void SAL_CALL loadICUBreakIterator(const css::lang::Locale& rLocale, sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const OUString& rText); + +public: +typedef std::unordered_map< OString, std::shared_ptr< BI_ValueData >, OStringHash > BIMap; }; } } } } diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 5331b8366e4d..c1d503449268 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -39,6 +39,9 @@ using namespace ::com::sun::star::lang; namespace com { namespace sun { namespace star { namespace i18n { +// Cache map of breakiterators, stores state information so has to be +// thread_local. +thread_local static BreakIterator_Unicode::BIMap theBIMap; BreakIterator_Unicode::BreakIterator_Unicode() : cBreakIterator( "com.sun.star.i18n.BreakIterator_Unicode" )// implementation name @@ -98,12 +101,43 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Local case LOAD_SENTENCE_BREAKITERATOR: icuBI= breakType = 5; break; case LOAD_LINE_BREAKITERATOR: icuBI= breakType = 4; break; } -if (!icuBI->aBreakIterator || -rLocale.Language != icuBI->maLocale.Language || -rLocale.Country != icuBI->maLocale.Country || -rLocale.Variant != icuBI->maLocale.Variant) { -icuBI->aBreakIterator.reset(); -if (rule) { + +// Using the cache map prevents accessing the file system for each +// udata_open() where ICU tries first files then data objects. And that for +// two fallbacks worst case.. for each new allocated EditEngine, layout +// cell, ... *ouch* Also non-rule locale based iterators can be mapped. +// This also speeds up loading iterators for alternating or generally more +// than one language/locale in that iterators are not constructed and +// destroyed en masse. +// Four possible keys, locale rule based with break type, locale rule based +// only, rule based only, locale based with break type. A fifth global key +// for the initial lookup. +// Multiple gobal keys may map to identical value data. +// All enums used here should be in the range 0..9 so assert that and avoid +// expensive numeric conversion in append() for faster construction of the +// always used global key. +assert( 0 <= breakType && breakType <= 9 && 0 <= rBreakType && rBreakType <= 9 && 0 <= nWordType && nWordType <= 9); +const OString aLangtagStr( LanguageTag::convertToBcp47( rLocale).toUtf8()); +OStringBuffer aKeyBuf(64); +aKeyBuf.append( aLangtagStr).append(';'); +if (rule) +aKeyBuf.append(rule); +aKeyBuf.append(';').append( static_cast('0'+breakType)).append(';'). +append( static_cast('0'+rBreakType)).append(';').append( static_cast('0'+nWordType)); +//
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/cclass_unicode.hxx | 78 - i18npool/source/characterclassification/cclass_unicode_parser.cxx | 464 -- 2 files changed, 264 insertions(+), 278 deletions(-) New commits: commit 4d64e43c1f0106f824f01feb842f8e87a0a91da8 Author: Noel GrandinDate: Wed Apr 12 15:47:30 2017 +0200 Convert TOKEN constants to o3tl::typed_flags Change-Id: I0fa6cd6160d6c61a3d6f9eeb6ffadf3db68c6d05 Reviewed-on: https://gerrit.libreoffice.org/36506 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index 811e92b0ff05..287df8e69170 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -26,14 +26,41 @@ #include #include +#include namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } -namespace com { namespace sun { namespace star { namespace i18n { -typedef sal_uInt32 UPT_FLAG_TYPE; +/// Flag values of table. +enum class ParserFlags : sal_uInt32 { +ILLEGAL = 0x, +CHAR= 0x0001, +CHAR_BOOL = 0x0002, +CHAR_WORD = 0x0004, +CHAR_VALUE = 0x0008, +CHAR_STRING = 0x0010, +CHAR_DONTCARE = 0x0020, +BOOL= 0x0040, +WORD= 0x0080, +WORD_SEP= 0x0100, +VALUE = 0x0200, +VALUE_SEP = 0x0400, +VALUE_EXP = 0x0800, +VALUE_SIGN = 0x1000, +VALUE_EXP_VALUE = 0x2000, +VALUE_DIGIT = 0x4000, +NAME_SEP= 0x2000, +STRING_SEP = 0x4000, +EXCLUDED= 0x8000, +}; +namespace o3tl { +template<> struct typed_flags : is_typed_flags {}; +} + + +namespace com { namespace sun { namespace star { namespace i18n { class cclass_Unicode : public cppu::WeakImplHelper < XCharacterClassification, css::lang::XServiceInfo > { @@ -88,30 +115,9 @@ private: }; static const sal_uInt8 nDefCnt; -static const UPT_FLAG_TYPE pDefaultParserTable[]; +static const ParserFlagspDefaultParserTable[]; static const sal_Int32 pParseTokensType[]; -/// Flag values of table. -static const UPT_FLAG_TYPE TOKEN_ILLEGAL; -static const UPT_FLAG_TYPE TOKEN_CHAR; -static const UPT_FLAG_TYPE TOKEN_CHAR_BOOL; -static const UPT_FLAG_TYPE TOKEN_CHAR_WORD; -static const UPT_FLAG_TYPE TOKEN_CHAR_VALUE; -static const UPT_FLAG_TYPE TOKEN_CHAR_STRING; -static const UPT_FLAG_TYPE TOKEN_CHAR_DONTCARE; -static const UPT_FLAG_TYPE TOKEN_BOOL; -static const UPT_FLAG_TYPE TOKEN_WORD; -static const UPT_FLAG_TYPE TOKEN_WORD_SEP; -static const UPT_FLAG_TYPE TOKEN_VALUE; -static const UPT_FLAG_TYPE TOKEN_VALUE_SEP; -static const UPT_FLAG_TYPE TOKEN_VALUE_EXP; -static const UPT_FLAG_TYPE TOKEN_VALUE_SIGN; -static const UPT_FLAG_TYPE TOKEN_VALUE_EXP_VALUE; -static const UPT_FLAG_TYPE TOKEN_VALUE_DIGIT; -static const UPT_FLAG_TYPE TOKEN_NAME_SEP; -static const UPT_FLAG_TYPE TOKEN_STRING_SEP; -static const UPT_FLAG_TYPE TOKEN_EXCLUDED; - /// If and where c occurs in pStr static const sal_Unicode* StrChr( const sal_Unicode* pStr, sal_Unicode c ); @@ -124,29 +130,29 @@ private: css::uno::Reference < css::i18n::XNativeNumberSupplier > xNatNumSup; OUString aStartChars; OUString aContChars; -UPT_FLAG_TYPE* pTable; -UPT_FLAG_TYPE* pStart; -UPT_FLAG_TYPE* pCont; -sal_Int32 nStartTypes; -sal_Int32 nContTypes; -ScanState eState; -sal_Unicode cGroupSep; -sal_Unicode cDecimalSep; +ParserFlags* pTable; +ParserFlags* pStart; +ParserFlags* pCont; +sal_Int32nStartTypes; +sal_Int32nContTypes; +ScanStateeState; +sal_Unicode cGroupSep; +sal_Unicode cDecimalSep; /// Get corresponding KParseTokens flag for a character static sal_Int32 getParseTokensType(sal_uInt32 c, bool isFirst); /// Access parser table flags. -UPT_FLAG_TYPE getFlags(sal_uInt32 c); +ParserFlags getFlags(sal_uInt32 c); /// Access parser flags via International and special definitions. -UPT_FLAG_TYPE getFlagsExtended(sal_uInt32 c); +ParserFlags getFlagsExtended(sal_uInt32 c); /// Access parser table flags for user defined start characters. -UPT_FLAG_TYPE getStartCharsFlags( sal_Unicode c ); +ParserFlags getStartCharsFlags( sal_Unicode c ); /// Access parser table flags for user defined continuation characters. -
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/transliteration_Ignore.hxx | 19 +++ i18npool/source/transliteration/ignoreDiacritics_CTL.cxx | 79 +-- 2 files changed, 87 insertions(+), 11 deletions(-) New commits: commit 278eabab2b5bdc95a51d501fcdb46c216ded3baa Author: Khaled HosnyDate: Sun Jan 8 01:02:20 2017 +0200 tdf#105170: Ignore diacritics on precomposed chars When ignoring diacritics, the old code just ignore combining marks which works when using decomposed forms (NFD) but does not work for precomposed forms (NFC). Instead, we now decompose, strip marks, then recompose, and use a nice icu::Transliterator that does the hard work for us. As a bonus, we should now handle surrogate pairs fine (most of the time). The new code (in ignoreDiacritics_CTL::folding()) might not be as efficient as the old code that used transliteration_Ignore::folding(), but it is less ugly and more easier to resonate with, or so I hope. Change-Id: If48c8be30527580cdd68f20b40a6533c5f258d83 Reviewed-on: https://gerrit.libreoffice.org/32826 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index e6573b6..3b67d64 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -21,6 +21,7 @@ #include #include +#include typedef sal_Unicode (*TransFunc)(const sal_Unicode); @@ -91,9 +92,25 @@ TRANSLITERATION_IGNORE(Space_ja_JP) TRANSLITERATION_IGNORE(TraditionalKana_ja_JP) TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP) TRANSLITERATION_IGNORE(ZiZu_ja_JP) -TRANSLITERATION_IGNORE(Diacritics_CTL) TRANSLITERATION_IGNORE(Kashida_CTL) +class ignoreDiacritics_CTL : public transliteration_Ignore +{ +icu::Transliterator* m_transliterator; + +public: +ignoreDiacritics_CTL(); + +OUString SAL_CALL +folding(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence& rOffset) +throw(css::uno::RuntimeException, std::exception) override; + +sal_Unicode SAL_CALL +transliterateChar2Char(sal_Unicode nInChar) +throw(css::uno::RuntimeException, +css::i18n::MultipleCharsOutputException, std::exception) override; +}; + #undef TRANSLITERATION_IGNORE #define TRANSLITERATION_IGNORE( name ) \ diff --git a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx index 8d6292c..c910b94 100644 --- a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx +++ b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx @@ -9,25 +9,84 @@ #include #include +#include namespace com { namespace sun { namespace star { namespace i18n { -sal_Unicode -ignoreDiacritics_CTL_translator (const sal_Unicode c) -{ -if(u_getIntPropertyValue(c, UCHAR_GENERAL_CATEGORY) == U_NON_SPACING_MARK) -return 0x; // Skip this character - -return c; -} - ignoreDiacritics_CTL::ignoreDiacritics_CTL() { -func = ignoreDiacritics_CTL_translator; +func = nullptr; table = nullptr; map = nullptr; transliterationName = "ignoreDiacritics_CTL"; implementationName = "com.sun.star.i18n.Transliteration.ignoreDiacritics_CTL"; + +UErrorCode nStatus = U_ZERO_ERROR; +m_transliterator = icu::Transliterator::createInstance("NFD; [:M:] Remove; NFC", +UTRANS_FORWARD, nStatus); +if (U_FAILURE(nStatus)) +m_transliterator = nullptr; +} + +sal_Unicode SAL_CALL +ignoreDiacritics_CTL::transliterateChar2Char(sal_Unicode nInChar) +throw(css::uno::RuntimeException, +css::i18n::MultipleCharsOutputException, std::exception) +{ +if (!m_transliterator) +throw css::uno::RuntimeException(); + +UnicodeString aChar(nInChar); +m_transliterator->transliterate(aChar); + +if (aChar.isEmpty()) +return 0x; // Skip this character. + +if (aChar.length() > 1) +return nInChar; // Don't know what to do here, return the otiginal. + +return aChar[0]; +} + +OUString SAL_CALL +ignoreDiacritics_CTL::folding(const OUString& rInStr, sal_Int32 nStartPos, +sal_Int32 nCount, css::uno::Sequence& rOffset) +throw(css::uno::RuntimeException, std::exception) +{ +if (!m_transliterator) +throw css::uno::RuntimeException(); + +OUString aOutStr; + +sal_Int32 nPosition = nStartPos; +sal_Int32 nOffset = 0; +if (useOffset) +rOffset.realloc(nCount); + +while (nPosition < nStartPos + nCount) +{ +sal_Int32 nIndex = nPosition; +UChar32 nChar = rInStr.iterateCodePoints(); +UnicodeString aChar(nChar); +m_transliterator->transliterate(aChar); + +if (useOffset && nOffset + aChar.length() > rOffset.getLength()) +rOffset.realloc(rOffset.getLength() + aChar.length()); + +for (int32_t i
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiterator_cjk.hxx |5 +- i18npool/source/breakiterator/breakiterator_cjk.cxx | 45 +--- 2 files changed, 16 insertions(+), 34 deletions(-) New commits: commit dd286c3874c3afe6bd37b7cd63c9163c172834f8 Author: Jochen NitschkeDate: Wed Dec 28 14:51:34 2016 +0100 use unique_ptr for xdictionary default destructors are good enough now Change-Id: I6d4ab68d2ee527f5f4e5696c3f093dc66cdc5b4c Reviewed-on: https://gerrit.libreoffice.org/32492 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/breakiterator_cjk.hxx b/i18npool/inc/breakiterator_cjk.hxx index 8731745..9429176 100644 --- a/i18npool/inc/breakiterator_cjk.hxx +++ b/i18npool/inc/breakiterator_cjk.hxx @@ -22,6 +22,8 @@ #include #include +#include + namespace com { namespace sun { namespace star { namespace i18n { // class BreakIterator_CJK @@ -46,7 +48,7 @@ public: throw(css::uno::RuntimeException, std::exception) override; protected: -xdictionary *dict; +std::unique_ptr m_xDict; OUString hangingCharacters; }; @@ -54,7 +56,6 @@ protected: class BreakIterator_##lang : public BreakIterator_CJK {\ public:\ BreakIterator_##lang (); \ -virtual ~BreakIterator_##lang () override; \ }; BREAKITERATOR_CJK( zh ) diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index c9268b3..167b942 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -21,6 +21,8 @@ #include #include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -30,9 +32,7 @@ namespace com { namespace sun { namespace star { namespace i18n { // class BreakIterator_CJK // ; -BreakIterator_CJK::BreakIterator_CJK() : -dict( nullptr ), -hangingCharacters() +BreakIterator_CJK::BreakIterator_CJK() { cBreakIterator = "com.sun.star.i18n.BreakIterator_CJK"; } @@ -41,8 +41,8 @@ Boundary SAL_CALL BreakIterator_CJK::previousWord(const OUString& text, sal_Int32 anyPos, const lang::Locale& nLocale, sal_Int16 wordType) throw(RuntimeException, std::exception) { -if (dict) { -result = dict->previousWord(text, anyPos, wordType); +if (m_xDict) { +result = m_xDict->previousWord(text, anyPos, wordType); // #109813# for non-CJK, single character word, fallback to ICU breakiterator. if (result.endPos - result.startPos != 1 || getScriptType(text, result.startPos) == ScriptType::ASIAN) @@ -58,8 +58,8 @@ Boundary SAL_CALL BreakIterator_CJK::nextWord(const OUString& text, sal_Int32 anyPos, const lang::Locale& nLocale, sal_Int16 wordType) throw(RuntimeException, std::exception) { -if (dict) { -result = dict->nextWord(text, anyPos, wordType); +if (m_xDict) { +result = m_xDict->nextWord(text, anyPos, wordType); // #109813# for non-CJK, single character word, fallback to ICU breakiterator. if (result.endPos - result.startPos != 1 || getScriptType(text, result.startPos) == ScriptType::ASIAN) @@ -76,8 +76,8 @@ BreakIterator_CJK::getWordBoundary( const OUString& text, sal_Int32 anyPos, const lang::Locale& nLocale, sal_Int16 wordType, sal_Bool bDirection ) throw(RuntimeException, std::exception) { -if (dict) { -result = dict->getWordBoundary(text, anyPos, wordType, bDirection); +if (m_xDict) { +result = m_xDict->getWordBoundary(text, anyPos, wordType, bDirection); // #109813# for non-CJK, single character word, fallback to ICU breakiterator. if (result.endPos - result.startPos != 1 || getScriptType(text, result.startPos) == ScriptType::ASIAN) @@ -116,47 +116,32 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( // ; BreakIterator_zh::BreakIterator_zh() { -dict = new xdictionary("zh"); +m_xDict = o3tl::make_unique("zh"); hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("zh", "CN")); cBreakIterator = "com.sun.star.i18n.BreakIterator_zh"; } -BreakIterator_zh::~BreakIterator_zh() -{ -delete dict; -} - // // class BreakIterator_zh_TW // ; BreakIterator_zh_TW::BreakIterator_zh_TW() { -dict = new xdictionary("zh"); +m_xDict = o3tl::make_unique("zh"); hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("zh", "TW")); cBreakIterator = "com.sun.star.i18n.BreakIterator_zh_TW"; } -BreakIterator_zh_TW::~BreakIterator_zh_TW() -{ -delete
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/numberformatcode.hxx | 15 +-- i18npool/source/numberformatcode/numberformatcode.cxx | 77 +++--- 2 files changed, 37 insertions(+), 55 deletions(-) New commits: commit 450a2fd5e2dafd1a0c08e73ef85db978f6b1a927 Author: Maarten BosmansDate: Tue Sep 20 20:27:04 2016 +0200 tdf#53698: Cache more than 1 item in NumberFormatCodeMapper In zforlist.cxx the function SvNumberFormatter::GetPreviewStringGuess switches between the system locale and en_US in order to guess the formatting of a number. This results in poor performance, because in the created SvNumberFormat only the last used locale is cached. Caching more than 1 entries improves the load time for the document attached to tdf#53698 from 90s to 60s in case of non en_US locales. Change-Id: Id0eb4447dea6213015e2d958d8303a1e7892487a Reviewed-on: https://gerrit.libreoffice.org/29136 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx index 62261f2..765fa90 100644 --- a/i18npool/inc/numberformatcode.hxx +++ b/i18npool/inc/numberformatcode.hxx @@ -29,6 +29,9 @@ #include #include +#include +#include + class NumberFormatCodeMapper : public cppu::WeakImplHelper < css::i18n::XNumberFormatCode, @@ -55,19 +58,15 @@ public: private: osl::Mutex maMutex; -css::lang::Locale aLocale; -css::uno::Reference < css::uno::XComponentContext > mxContext; -css::uno::Sequence< css::i18n::FormatElement > aFormatSeq; -css::uno::Reference < css::i18n::XLocaleData4 > mxLocaleData; -bool bFormatsValid; +css::uno::Reference < css::i18n::XLocaleData4 > m_xLocaleData; +typedef std::pair< css::lang::Locale, css::uno::Sequence< css::i18n::FormatElement > > FormatElementCacheItem; +std::deque < FormatElementCacheItem > m_aFormatElementCache; -void setupLocale( const css::lang::Locale& rLocale ); -void getFormats( const css::lang::Locale& rLocale ); +const css::uno::Sequence< css::i18n::FormatElement >& getFormats( const css::lang::Locale& rLocale ); static OUString mapElementTypeShortToString(sal_Int16 formatType); static sal_Int16 mapElementTypeStringToShort(const OUString& formatType); static OUString mapElementUsageShortToString(sal_Int16 formatUsage); static sal_Int16 mapElementUsageStringToShort(const OUString& formatUsage); -void createLocaleDataObject(); }; diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx index 97852dd..9dab999 100644 --- a/i18npool/source/numberformatcode/numberformatcode.cxx +++ b/i18npool/source/numberformatcode/numberformatcode.cxx @@ -25,10 +25,8 @@ NumberFormatCodeMapper::NumberFormatCodeMapper( const css::uno::Reference < css::uno::XComponentContext >& rxContext ) -: -mxContext( rxContext ), -bFormatsValid( false ) { +m_xLocaleData.set( css::i18n::LocaleData::create( rxContext ) ); } @@ -45,10 +43,10 @@ NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, OUString elementUsage = mapElementUsageShortToString(formatUsage); osl::MutexGuard g(maMutex); -getFormats( rLocale ); +const css::uno::Sequence< css::i18n::FormatElement > = getFormats( rLocale ); -for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { -if(aFormatSeq[i].isDefault && aFormatSeq[i].formatType == elementType && +for (sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { +if (aFormatSeq[i].isDefault && aFormatSeq[i].formatType == elementType && aFormatSeq[i].formatUsage == elementUsage) { css::i18n::NumberFormatCode anumberFormatCode(formatType, formatUsage, @@ -69,10 +67,10 @@ css::i18n::NumberFormatCode SAL_CALL NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const css::lang::Locale& rLocale ) throw(css::uno::RuntimeException, std::exception) { osl::MutexGuard g(maMutex); -getFormats( rLocale ); +const css::uno::Sequence< css::i18n::FormatElement > = getFormats( rLocale ); -for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { -if(aFormatSeq[i].formatIndex == formatIndex) { +for (sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { +if (aFormatSeq[i].formatIndex == formatIndex) { css::i18n::NumberFormatCode anumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType), mapElementUsageStringToShort(aFormatSeq[i].formatUsage), aFormatSeq[i].formatCode, @@ -85,7 +83,6 @@ NumberFormatCodeMapper::getFormatCode(
[Libreoffice-commits] core.git: i18npool/inc i18npool/source i18nutil/source include/i18nutil
i18npool/inc/transliteration_body.hxx |4 - i18npool/source/characterclassification/cclass_unicode.cxx |6 - i18npool/source/transliteration/transliteration_body.cxx | 38 +- i18npool/source/transliteration/transliteration_caseignore.cxx |2 i18nutil/source/utility/casefolding.cxx| 30 +-- include/i18nutil/casefolding.hxx | 38 +- 6 files changed, 64 insertions(+), 54 deletions(-) New commits: commit 33efbfda45a96f540f976abf3dc00ab256872af4 Author: Noel GrandinDate: Tue May 10 15:04:39 2016 +0200 convert MappingType to scoped enum Change-Id: I1f00e1fbdb9213d0c2f30da116684b77842282f5 Reviewed-on: https://gerrit.libreoffice.org/24851 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index 01757b9..5561699 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -56,7 +56,7 @@ public: const OUString& str2 ) throw(css::uno::RuntimeException, std::exception) override; protected: -sal_uInt8 nMappingType; +MappingType nMappingType; }; class Transliteration_u2l : public Transliteration_body @@ -75,7 +75,7 @@ class Transliteration_casemapping : public Transliteration_body { public: Transliteration_casemapping(); -void SAL_CALL setMappingType(const sal_uInt8 rMappingType, const css::lang::Locale& rLocale ); +void SAL_CALL setMappingType(const MappingType rMappingType, const css::lang::Locale& rLocale ); }; class Transliteration_togglecase : public Transliteration_body diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx index e9e9612..c4a8bab 100644 --- a/i18npool/source/characterclassification/cclass_unicode.cxx +++ b/i18npool/source/characterclassification/cclass_unicode.cxx @@ -63,7 +63,7 @@ cclass_Unicode::toUpper( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, if (nCount + nPos > len) nCount = len - nPos; -trans->setMappingType(MappingTypeToUpper, rLocale); +trans->setMappingType(MappingType::ToUpper, rLocale); return trans->transliterateString2String(Text, nPos, nCount); } @@ -75,7 +75,7 @@ cclass_Unicode::toLower( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, if (nCount + nPos > len) nCount = len - nPos; -trans->setMappingType(MappingTypeToLower, rLocale); +trans->setMappingType(MappingType::ToLower, rLocale); return trans->transliterateString2String(Text, nPos, nCount); } @@ -89,7 +89,7 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, if (nCount + nPos > len) nCount = len - nPos; -trans->setMappingType(MappingTypeToTitle, rLocale); +trans->setMappingType(MappingType::ToTitle, rLocale); rtl_uString* pStr = rtl_uString_alloc(nCount); sal_Unicode* out = pStr->buffer; Reference< BreakIteratorImpl > xBrk(new BreakIteratorImpl(m_xContext)); diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 982c80c..0470ed4 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -40,7 +40,7 @@ namespace com { namespace sun { namespace star { namespace i18n { Transliteration_body::Transliteration_body() { -nMappingType = 0; +nMappingType = MappingType::NONE; transliterationName = "Transliteration_body"; implementationName = "com.sun.star.i18n.Transliteration.Transliteration_body"; } @@ -68,22 +68,22 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString& return ostr; } -static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar ) +static MappingType lcl_getMappingTypeForToggleCase( MappingType nMappingType, sal_Unicode cChar ) { -sal_uInt8 nRes = nMappingType; +MappingType nRes = nMappingType; // take care of TOGGLE_CASE transliteration: // nMappingType should not be a combination of flags, thuse we decide now // which one to use. -if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) +if (nMappingType == (MappingType::LowerToUpper | MappingType::UpperToLower)) { const sal_Int16 nType = unicode::getUnicodeType( cChar ); if (nType & 0x02 /* lower case*/) -nRes = MappingTypeLowerToUpper; +nRes = MappingType::LowerToUpper; else { // should also work properly for non-upper characters like white spaces, numbers, ... -nRes = MappingTypeUpperToLower; +nRes =
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/transliterationImpl.hxx |2 +- i18npool/source/transliteration/transliterationImpl.cxx |2 +- i18npool/source/transliteration/transliteration_body.cxx |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 856cf7115d7b52f38371047b4a1aeae747a5d9bc Author: Rohan KumarDate: Mon Mar 7 23:28:39 2016 +0530 tdf#91794 Remove OSL_DEBUG_LEVEL > 1 conditionals I removed OSL_DEBUG_LEVEL > 1 conditionals in order to reduce debug levels. Change-Id: Ia1890277aec8ba0b57e325564a107d7fe2f6e967 Reviewed-on: https://gerrit.libreoffice.org/23008 Tested-by: Jenkins Reviewed-by: jan iversen diff --git a/i18npool/inc/transliterationImpl.hxx b/i18npool/inc/transliterationImpl.hxx index e50b63a..0c0fd5a 100644 --- a/i18npool/inc/transliterationImpl.hxx +++ b/i18npool/inc/transliterationImpl.hxx @@ -28,7 +28,7 @@ namespace com { namespace sun { namespace star { namespace i18n { -#if OSL_DEBUG_LEVEL > 1 +#if OSL_DEBUG_LEVEL > 0 #define RETURN_DEBUG_STRING ("return from transliterationImpl"); #define RETURN_DEBUG_NUMBER 'TRAN' #else diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index 287d2ce..abe434c 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -35,7 +35,7 @@ #include -#if OSL_DEBUG_LEVEL > 1 +#if OSL_DEBUG_LEVEL > 0 #include #endif diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 875b4a1..2730e9d 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -301,7 +301,7 @@ static OUString transliterate_titlecase_Impl( pOffset[i] = nIdx; } } -#if OSL_DEBUG_LEVEL > 1 +#if OSL_DEBUG_LEVEL > 0 const sal_Int32 *pCOffset = offset.getConstArray(); (void) pCOffset; #endif ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiteratorImpl.hxx| 80 ++--- i18npool/inc/breakiterator_cjk.hxx| 16 - i18npool/inc/breakiterator_ctl.hxx| 10 i18npool/inc/breakiterator_th.hxx |2 i18npool/inc/breakiterator_unicode.hxx| 50 +-- i18npool/inc/calendarImpl.hxx | 82 +++--- i18npool/inc/calendar_gregorian.hxx | 80 ++--- i18npool/inc/calendar_hijri.hxx |4 i18npool/inc/calendar_jewish.hxx |6 i18npool/inc/cclass_unicode.hxx | 46 +-- i18npool/inc/chaptercollator.hxx | 14 - i18npool/inc/characterclassificationImpl.hxx | 67 ++-- i18npool/inc/collatorImpl.hxx | 44 +-- i18npool/inc/collator_unicode.hxx | 26 - i18npool/inc/defaultnumberingprovider.hxx | 62 ++-- i18npool/inc/indexentrysupplier.hxx | 68 ++--- i18npool/inc/indexentrysupplier_asian.hxx | 20 - i18npool/inc/indexentrysupplier_common.hxx| 69 ++--- i18npool/inc/indexentrysupplier_default.hxx | 26 - i18npool/inc/indexentrysupplier_ja_phonetic.hxx | 22 - i18npool/inc/inputsequencechecker.hxx | 28 +- i18npool/inc/inputsequencechecker_hi.hxx |4 i18npool/inc/inputsequencechecker_th.hxx |4 i18npool/inc/localedata.hxx | 108 +++ i18npool/inc/nativenumbersupplier.hxx | 42 +-- i18npool/inc/numberformatcode.hxx | 36 +- i18npool/inc/ordinalsuffix.hxx| 10 i18npool/inc/textToPronounce_zh.hxx | 14 - i18npool/inc/textconversion.hxx | 136 +- i18npool/inc/textconversionImpl.hxx | 60 ++-- i18npool/inc/transliterationImpl.hxx | 82 +++--- i18npool/inc/transliteration_Ignore.hxx | 36 +- i18npool/inc/transliteration_Numeric.hxx | 24 - i18npool/inc/transliteration_OneToOne.hxx | 30 +- i18npool/inc/transliteration_body.hxx | 24 - i18npool/inc/transliteration_caseignore.hxx | 18 - i18npool/inc/transliteration_commonclass.hxx | 66 ++-- i18npool/inc/unoscripttypedetector.hxx| 24 - i18npool/source/breakiterator/breakiteratorImpl.cxx |2 i18npool/source/breakiterator/breakiterator_unicode.cxx |2 i18npool/source/calendar/calendar_gregorian.cxx | 17 - i18npool/source/characterclassification/unoscripttypedetector.cxx | 22 - i18npool/source/collator/collatorImpl.cxx |2 i18npool/source/indexentry/indexentrysupplier.cxx |4 i18npool/source/indexentry/indexentrysupplier_default.cxx |4 i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | 22 - i18npool/source/inputchecker/inputsequencechecker_hi.cxx |4 i18npool/source/inputchecker/inputsequencechecker_th.cxx |4 i18npool/source/localedata/localedata.cxx | 16 - i18npool/source/localedata/saxparser.cxx |2 i18npool/source/nativenumber/nativenumbersupplier.cxx |2 i18npool/source/numberformatcode/numberformatcode.cxx | 99 +++ i18npool/source/search/textsearch.cxx | 38 +- i18npool/source/search/textsearch.hxx | 71 ++--- i18npool/source/transliteration/transliterationImpl.cxx |4 i18npool/source/transliteration/transliteration_caseignore.cxx|2 56 files changed, 925 insertions(+), 932 deletions(-) New commits: commit 184637be60fcdbde3b3fb0ab0c1d158a92f63889 Author: Noel GrandinDate: Mon Oct 19 10:34:45 2015 +0200 com::sun::star->css in i18npool Change-Id: I13a290cba0f38c79eb2d93148b972d3d931c3862 Reviewed-on: https://gerrit.libreoffice.org/19445 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/i18npool/inc/breakiteratorImpl.hxx b/i18npool/inc/breakiteratorImpl.hxx index ce77d9f..82547e3 100644 --- a/i18npool/inc/breakiteratorImpl.hxx +++ b/i18npool/inc/breakiteratorImpl.hxx @@ -42,72 +42,72 @@ namespace com {
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiterator_unicode.hxx |2 +- i18npool/source/breakiterator/breakiterator_th.cxx |2 +- i18npool/source/breakiterator/breakiterator_unicode.cxx |7 +++ 3 files changed, 5 insertions(+), 6 deletions(-) New commits: commit 3b6ee58652d99accd610425264114d1d5b3330df Author: Stephan Bergmann sberg...@redhat.com Date: Wed Oct 15 23:04:36 2014 +0200 Remove unused BreakIterator_Unicode::wordRule Change-Id: I8cde0dfd7b760d8075f53b9de8a8d3a81a57dc27 diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx index c72c2d6..072fcd7 100644 --- a/i18npool/inc/breakiterator_unicode.hxx +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -72,7 +72,7 @@ public: throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; protected: -const sal_Char *cBreakIterator, *wordRule, *lineRule; +const sal_Char *cBreakIterator, *lineRule; Boundary result; // for word break iterator struct BI_Data diff --git a/i18npool/source/breakiterator/breakiterator_th.cxx b/i18npool/source/breakiterator/breakiterator_th.cxx index d81ef13a..cdd4c4a 100644 --- a/i18npool/source/breakiterator/breakiterator_th.cxx +++ b/i18npool/source/breakiterator/breakiterator_th.cxx @@ -34,7 +34,7 @@ namespace com { namespace sun { namespace star { namespace i18n { BreakIterator_th::BreakIterator_th() { cBreakIterator = com.sun.star.i18n.BreakIterator_th; -wordRule=lineRule=NULL; +lineRule=NULL; } BreakIterator_th::~BreakIterator_th() diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 658d4ff..933e775 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -42,7 +42,6 @@ namespace com { namespace sun { namespace star { namespace i18n { BreakIterator_Unicode::BreakIterator_Unicode() : cBreakIterator( com.sun.star.i18n.BreakIterator_Unicode )// implementation name -, wordRule( word ) , lineRule( line ) , icuBI( NULL ) , aBreakType(0) @@ -91,12 +90,12 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: switch (nWordType) { case WordType::ANY_WORD: break; // odd but previous behavior case WordType::ANYWORD_IGNOREWHITESPACES: -breakType = 0; rule = wordRule = edit_word; break; +breakType = 0; rule = edit_word; break; case WordType::DICTIONARY_WORD: -breakType = 1; rule = wordRule = dict_word; break; +breakType = 1; rule = dict_word; break; default: case WordType::WORD_COUNT: -breakType = 2; rule = wordRule = count_word; break; +breakType = 2; rule = count_word; break; } break; case LOAD_SENTENCE_BREAKITERATOR: icuBI=sentence; breakType = 5; break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendar_gregorian.hxx |2 - i18npool/inc/nativenumbersupplier.hxx |6 +-- i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |2 - i18npool/source/nativenumber/nativenumbersupplier.cxx | 20 +- i18npool/source/transliteration/transliteration_Numeric.cxx |4 +- 5 files changed, 17 insertions(+), 17 deletions(-) New commits: commit 91ba527a63f77658ee147515f1699792059aa2e5 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Sep 11 12:31:25 2014 +0200 Avoid name clash with generated C++ class corresponding to UNOIDL service Change-Id: I96582bf05787a30479d324ff8deb7cea758bb2c2 diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index bd99d18..ea06b00 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -93,7 +93,7 @@ public: protected: const Era *eraArray; icu::Calendar *body; -NativeNumberSupplier aNatNum; +NativeNumberSupplierService aNatNum; const sal_Char* cCalendar; com::sun::star::lang::Locale aLocale; sal_uInt32 fieldSet; diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx index 750b509..14d17f6 100644 --- a/i18npool/inc/nativenumbersupplier.hxx +++ b/i18npool/inc/nativenumbersupplier.hxx @@ -28,16 +28,16 @@ namespace com { namespace sun { namespace star { namespace i18n { // -// class NativeNumberSupplier +// class NativeNumberSupplierService // -class NativeNumberSupplier : public cppu::WeakImplHelper2 +class NativeNumberSupplierService : public cppu::WeakImplHelper2 com::sun::star::i18n::XNativeNumberSupplier, com::sun::star::lang::XServiceInfo { public: -NativeNumberSupplier(bool _useOffset = false) : useOffset(_useOffset) {} +NativeNumberSupplierService(bool _useOffset = false) : useOffset(_useOffset) {} // Methods virtual OUString SAL_CALL getNativeNumberString( const OUString aNumberString, diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 6e373b0..e7b1309 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -857,7 +857,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequencebeans::PropertyVal } if (natNum) { -NativeNumberSupplier sNatNum; +NativeNumberSupplierService sNatNum; result += sNatNum.getNativeNumberString(OUString::number( number ), locale, natNum); } else if (tableSize) { if ( number tableSize !recycleSymbol) diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index 4d54397..a8f08ba 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -517,7 +517,7 @@ static sal_Int16 SAL_CALL getLanguageNumber( const Locale rLocale) return -1; } -OUString SAL_CALL NativeNumberSupplier::getNativeNumberString(const OUString aNumberString, const Locale rLocale, +OUString SAL_CALL NativeNumberSupplierService::getNativeNumberString(const OUString aNumberString, const Locale rLocale, sal_Int16 nNativeNumberMode, Sequence sal_Int32 offset) throw (RuntimeException) { const Number *number = 0; @@ -595,14 +595,14 @@ OUString SAL_CALL NativeNumberSupplier::getNativeNumberString(const OUString aN return aNumberString; } -OUString SAL_CALL NativeNumberSupplier::getNativeNumberString(const OUString aNumberString, const Locale rLocale, +OUString SAL_CALL NativeNumberSupplierService::getNativeNumberString(const OUString aNumberString, const Locale rLocale, sal_Int16 nNativeNumberMode) throw (RuntimeException, std::exception) { Sequence sal_Int32 offset; return getNativeNumberString(aNumberString, rLocale, nNativeNumberMode, offset); } -sal_Unicode SAL_CALL NativeNumberSupplier::getNativeNumberChar( const sal_Unicode inChar, const Locale rLocale, sal_Int16 nNativeNumberMode ) throw(com::sun::star::uno::RuntimeException) +sal_Unicode SAL_CALL NativeNumberSupplierService::getNativeNumberChar( const sal_Unicode inChar, const Locale rLocale, sal_Int16 nNativeNumberMode ) throw(com::sun::star::uno::RuntimeException) { if (nNativeNumberMode == NativeNumberMode::NATNUM0) { // Ascii for (sal_Int16 i = 0; i NumberChar_Count; i++) @@ -636,7 +636,7 @@ sal_Unicode SAL_CALL NativeNumberSupplier::getNativeNumberChar( const sal_Unicod return inChar; }
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/ordinalsuffix.hxx |6 +++--- i18npool/source/ordinalsuffix/ordinalsuffix.cxx | 14 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) New commits: commit a6104092925a6fe9f96ca239c0292bd1539d5746 Author: Stephan Bergmann sberg...@redhat.com Date: Thu Sep 11 12:34:19 2014 +0200 Avoid name clash with generated C++ class corresponding to UNOIDL service Change-Id: Ie76cab45f5fd609457b11cb3b9732cba2da3b023 diff --git a/i18npool/inc/ordinalsuffix.hxx b/i18npool/inc/ordinalsuffix.hxx index 127d1f1..36a6d18 100644 --- a/i18npool/inc/ordinalsuffix.hxx +++ b/i18npool/inc/ordinalsuffix.hxx @@ -28,15 +28,15 @@ namespace com { namespace sun { namespace star { namespace i18n { -class OrdinalSuffix : public cppu::WeakImplHelper2 +class OrdinalSuffixService : public cppu::WeakImplHelper2 XOrdinalSuffix, com::sun::star::lang::XServiceInfo { public: -OrdinalSuffix(); -virtual ~OrdinalSuffix(); +OrdinalSuffixService(); +virtual ~OrdinalSuffixService(); // XOrdinalSuffix virtual com::sun::star::uno::Sequence OUString SAL_CALL getOrdinalSuffix( sal_Int32 nNumber, const com::sun::star::lang::Locale rLocale ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx index dafc783..53cea5f 100644 --- a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx +++ b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx @@ -35,11 +35,11 @@ using namespace ::com::sun::star; namespace com { namespace sun { namespace star { namespace i18n { -OrdinalSuffix::OrdinalSuffix() +OrdinalSuffixService::OrdinalSuffixService() { } -OrdinalSuffix::~OrdinalSuffix() +OrdinalSuffixService::~OrdinalSuffixService() { } @@ -65,7 +65,7 @@ namespace * For this method to properly return the ordinal suffix for other locales * than english ones, ICU 4.2+ has to be used. */ -uno::Sequence OUString SAL_CALL OrdinalSuffix::getOrdinalSuffix( sal_Int32 nNumber, +uno::Sequence OUString SAL_CALL OrdinalSuffixService::getOrdinalSuffix( sal_Int32 nNumber, const lang::Locale rLocale ) throw( RuntimeException, std::exception ) { uno::Sequence OUString retValue; @@ -135,17 +135,17 @@ uno::Sequence OUString SAL_CALL OrdinalSuffix::getOrdinalSuffix( sal_Int32 nN const sal_Char cOrdinalSuffix[] = com.sun.star.i18n.OrdinalSuffix; -OUString SAL_CALL OrdinalSuffix::getImplementationName(void) throw( RuntimeException, std::exception ) +OUString SAL_CALL OrdinalSuffixService::getImplementationName(void) throw( RuntimeException, std::exception ) { return OUString::createFromAscii(cOrdinalSuffix); } -sal_Bool SAL_CALL OrdinalSuffix::supportsService( const OUString rServiceName) throw( RuntimeException, std::exception ) +sal_Bool SAL_CALL OrdinalSuffixService::supportsService( const OUString rServiceName) throw( RuntimeException, std::exception ) { return cppu::supportsService(this, rServiceName); } -Sequence OUString SAL_CALL OrdinalSuffix::getSupportedServiceNames(void) throw( RuntimeException, std::exception ) +Sequence OUString SAL_CALL OrdinalSuffixService::getSupportedServiceNames(void) throw( RuntimeException, std::exception ) { Sequence OUString aRet(1); aRet[0] = OUString::createFromAscii(cOrdinalSuffix); @@ -159,7 +159,7 @@ com_sun_star_i18n_OrdinalSuffix_get_implementation( css::uno::XComponentContext *, css::uno::Sequencecss::uno::Any const ) { -return cppu::acquire(new css::i18n::OrdinalSuffix()); +return cppu::acquire(new css::i18n::OrdinalSuffixService()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/textconversion.hxx | 12 ++-- i18npool/source/textconversion/textconversion.cxx| 12 ++-- i18npool/source/textconversion/textconversion_ko.cxx |2 +- i18npool/source/textconversion/textconversion_zh.cxx |2 +- 4 files changed, 14 insertions(+), 14 deletions(-) New commits: commit 63bc11b81f8af188564a385c1e501fd7334c343d Author: Stephan Bergmann sberg...@redhat.com Date: Thu Sep 11 12:37:10 2014 +0200 Avoid name clash with generated C++ class corresponding to UNOIDL service Change-Id: Id8201bc91c8e398b972b7294b8916d4ac76c787d diff --git a/i18npool/inc/textconversion.hxx b/i18npool/inc/textconversion.hxx index d068c0e..6a41d92 100644 --- a/i18npool/inc/textconversion.hxx +++ b/i18npool/inc/textconversion.hxx @@ -31,17 +31,17 @@ namespace com { namespace sun { namespace star { namespace i18n { -// class TextConversion +// class TextConversionService -class TextConversion: public cppu::WeakImplHelper2 +class TextConversionService: public cppu::WeakImplHelper2 com::sun::star::i18n::XExtendedTextConversion, com::sun::star::lang::XServiceInfo { public: -TextConversion(const char* pImplName); -virtual ~TextConversion(); +TextConversionService(const char* pImplName); +virtual ~TextConversionService(); // Methods virtual com::sun::star::i18n::TextConversionResult SAL_CALL getConversions( const OUString aText, sal_Int32 nStartPos, sal_Int32 nLength, @@ -100,7 +100,7 @@ typedef struct { // class TextConversion_ko -class TextConversion_ko : public TextConversion +class TextConversion_ko : public TextConversionService { public: TextConversion_ko( const com::sun::star::uno::Reference com::sun::star::uno::XComponentContext rxContext ); @@ -156,7 +156,7 @@ typedef struct { sal_Int16 count; } STC_WordIndex; -class TextConversion_zh : public TextConversion +class TextConversion_zh : public TextConversionService { public: TextConversion_zh( const com::sun::star::uno::Reference com::sun::star::uno::XComponentContext rxContext ); diff --git a/i18npool/source/textconversion/textconversion.cxx b/i18npool/source/textconversion/textconversion.cxx index aec186e..7ef257d 100644 --- a/i18npool/source/textconversion/textconversion.cxx +++ b/i18npool/source/textconversion/textconversion.cxx @@ -31,7 +31,7 @@ extern C { static void SAL_CALL thisModule() {} } #endif -TextConversion::TextConversion(const char *pImplName) +TextConversionService::TextConversionService(const char *pImplName) : implementationName(pImplName) { #ifndef DISABLE_DYNLOADING @@ -45,7 +45,7 @@ TextConversion::TextConversion(const char *pImplName) #endif } -TextConversion::~TextConversion() +TextConversionService::~TextConversionService() { #ifndef DISABLE_DYNLOADING if (hModule) osl_unloadModule(hModule); @@ -60,7 +60,7 @@ static void* nullFunc() } oslGenericFunction SAL_CALL -TextConversion::getFunctionBySymbol(const sal_Char* func) +TextConversionService::getFunctionBySymbol(const sal_Char* func) { if (hModule) return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData); @@ -71,19 +71,19 @@ TextConversion::getFunctionBySymbol(const sal_Char* func) #endif OUString SAL_CALL -TextConversion::getImplementationName() throw( RuntimeException, std::exception ) +TextConversionService::getImplementationName() throw( RuntimeException, std::exception ) { return OUString::createFromAscii(implementationName); } sal_Bool SAL_CALL -TextConversion::supportsService(const OUString rServiceName) throw( RuntimeException, std::exception ) +TextConversionService::supportsService(const OUString rServiceName) throw( RuntimeException, std::exception ) { return cppu::supportsService(this, rServiceName); } Sequence OUString SAL_CALL -TextConversion::getSupportedServiceNames() throw( RuntimeException, std::exception ) +TextConversionService::getSupportedServiceNames() throw( RuntimeException, std::exception ) { Sequence OUString aRet(1); aRet[0] = OUString::createFromAscii(implementationName); diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx index 2423180..02dc72e 100644 --- a/i18npool/source/textconversion/textconversion_ko.cxx +++ b/i18npool/source/textconversion/textconversion_ko.cxx @@ -41,7 +41,7 @@ namespace com { namespace sun { namespace star { namespace i18n { #define SCRIPT_HANGUL 2 TextConversion_ko::TextConversion_ko( const Reference XComponentContext xContext ) -: TextConversion(com.sun.star.i18n.TextConversion_ko) +: TextConversionService(com.sun.star.i18n.TextConversion_ko) { Reference XInterface xI; diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx index 74ecb19..89f652c 100644 ---
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/transliteration_Ignore.hxx| 14 +++--- i18npool/source/transliteration/ignoreBaFa_ja_JP.cxx |2 +- i18npool/source/transliteration/ignoreHyuByu_ja_JP.cxx |2 +- i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx |2 +- i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx |2 +- 5 files changed, 11 insertions(+), 11 deletions(-) New commits: commit d9645bf8a1c1c95aeeb9a90b89387d82795f56dd Author: Stephan Bergmann sberg...@redhat.com Date: Thu Sep 11 12:53:25 2014 +0200 Prevent erroneous pick up of unrelated css::i18n::Maping ...from include/i18nutil/casefolding.hxx Change-Id: I892a83b8e40dadcffc1b59eaa18bee2b782131f1 diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index da3ed51..b610bf6 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -24,13 +24,6 @@ typedef sal_Unicode (*TransFunc)(const sal_Unicode); -typedef struct { -sal_Unicode previousChar; -sal_Unicode currentChar; -sal_Unicode replaceChar; -bool two2one; -} Mapping; - namespace com { namespace sun { namespace star { namespace i18n { class transliteration_Ignore : public transliteration_commonclass @@ -68,6 +61,13 @@ public: transliterateRange( const OUString str1, const OUString str2, XTransliteration t1, XTransliteration t2 ) throw(com::sun::star::uno::RuntimeException); +struct Mapping { +sal_Unicode previousChar; +sal_Unicode currentChar; +sal_Unicode replaceChar; +bool two2one; +}; + protected: TransFunc func; oneToOneMapping *table; diff --git a/i18npool/source/transliteration/ignoreBaFa_ja_JP.cxx b/i18npool/source/transliteration/ignoreBaFa_ja_JP.cxx index 39cd4c2..1285447 100644 --- a/i18npool/source/transliteration/ignoreBaFa_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreBaFa_ja_JP.cxx @@ -23,7 +23,7 @@ using namespace com::sun::star::uno; namespace com { namespace sun { namespace star { namespace i18n { -static const Mapping BaFa[] = { +static const transliteration_Ignore::Mapping BaFa[] = { { 0x30F4, 0x30A1, 0x30D0, true }, { 0x3094, 0x3041, 0x3070, true }, { 0x30D5, 0x30A1, 0x30CF, true }, diff --git a/i18npool/source/transliteration/ignoreHyuByu_ja_JP.cxx b/i18npool/source/transliteration/ignoreHyuByu_ja_JP.cxx index ae3c0c1..43e5bd0 100644 --- a/i18npool/source/transliteration/ignoreHyuByu_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreHyuByu_ja_JP.cxx @@ -24,7 +24,7 @@ using namespace com::sun::star::lang; namespace com { namespace sun { namespace star { namespace i18n { -static const Mapping HyuByu[] = { +static const transliteration_Ignore::Mapping HyuByu[] = { { 0x30D5, 0x30E5, 0x30D2, false }, { 0x3075, 0x3085, 0x3072, false }, { 0x30F4, 0x30E5, 0x30D3, false }, diff --git a/i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx b/i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx index 21c8853..fcc32a2 100644 --- a/i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx @@ -24,7 +24,7 @@ using namespace com::sun::star::lang; namespace com { namespace sun { namespace star { namespace i18n { -static const Mapping SeZe[] = { +static const transliteration_Ignore::Mapping SeZe[] = { // SI + E -- SE { 0x30B7, 0x30A7, 0x30BB, true }, // SI + E -- SE diff --git a/i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx b/i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx index 732257b..6bdf54a 100644 --- a/i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx @@ -24,7 +24,7 @@ using namespace com::sun::star::lang; namespace com { namespace sun { namespace star { namespace i18n { -static const Mapping TiJi[] = { +static const transliteration_Ignore::Mapping TiJi[] = { // TU + I -- TI { 0x30C4, 0x30A3, 0x30C1, true }, // TE + I -- TI ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/xdictionary.hxx|2 + i18npool/source/breakiterator/breakiterator_unicode.cxx |2 - i18npool/source/breakiterator/xdictionary.cxx | 19 3 files changed, 22 insertions(+), 1 deletion(-) New commits: commit a34a8fca21c670c4e7ee147d05ed9e6e4136cbe1 Author: Matthew J. Francis mjay.fran...@gmail.com Date: Wed Sep 10 17:34:01 2014 +0800 fdo#81272 Speed up break iterators Change-Id: Idcd7de83ff7e551b350db0bf80e2ac78baa67686 Reviewed-on: https://gerrit.libreoffice.org/11374 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index 57f5238..f7c0110 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -76,6 +76,8 @@ public: private: WordBreakCache cache[CACHE_MAX]; +OUString segmentCachedString; +Boundary segmentCachedBoundary; boolseekSegment(const OUString rText, sal_Int32 pos, Boundary boundary); WordBreakCache getCache(const sal_Unicode *text, Boundary boundary); diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 5270b1d..658d4ff 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -185,7 +185,7 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: } } -if (newBreak || !icuBI-aICUText.equals(rText)) +if (newBreak || icuBI-aICUText.pData != rText.pData) { // UChar != sal_Unicode in MinGW const UChar *pText = reinterpret_castconst UChar *(rText.getStr()); diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 1067e33..95e1cc9 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -271,6 +271,21 @@ bool xdictionary::seekSegment(const OUString rText, sal_Int32 pos, Boundary segBoundary) { sal_Int32 indexUtf16; + +if (segmentCachedString.pData != rText.pData) { +// Cache the passed text so we can avoid regenerating the segment if it's the same +// (pData is refcounted and assigning the OUString references it, which ensures that +// the object is the same if we get the same pointer back later) +segmentCachedString = rText; +} else { +// If pos is within the cached boundary, use that boundary +if (pos = segmentCachedBoundary.startPos pos = segmentCachedBoundary.endPos) { +indexUtf16 = segmentCachedBoundary.startPos; +rText.iterateCodePoints(indexUtf16, 1); +return segmentCachedBoundary.endPos indexUtf16; +} +} + segBoundary.endPos = segBoundary.startPos = pos; indexUtf16 = pos; @@ -293,6 +308,10 @@ bool xdictionary::seekSegment(const OUString rText, sal_Int32 pos, break; } +// Cache the calculated boundary +segmentCachedBoundary.startPos = segBoundary.startPos; +segmentCachedBoundary.endPos = segBoundary.endPos; + indexUtf16 = segBoundary.startPos; rText.iterateCodePoints(indexUtf16, 1); return segBoundary.endPos indexUtf16; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/xdictionary.hxx|2 - i18npool/source/breakiterator/breakiterator_unicode.cxx |2 - i18npool/source/breakiterator/xdictionary.cxx | 19 3 files changed, 1 insertion(+), 22 deletions(-) New commits: commit 997d1387abcfa40eca8d15a2fe025edc4a1de040 Author: Caolán McNamara caol...@redhat.com Date: Wed Sep 10 16:38:07 2014 +0100 Revert fdo#81272 Speed up break iterators hmm, make CppunitTest_i18npool_test_breakiterator fails after all This reverts commit 693f72384e081429cddb29415276cc4d07b05645. diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index f7c0110..57f5238 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -76,8 +76,6 @@ public: private: WordBreakCache cache[CACHE_MAX]; -OUString segmentCachedString; -Boundary segmentCachedBoundary; boolseekSegment(const OUString rText, sal_Int32 pos, Boundary boundary); WordBreakCache getCache(const sal_Unicode *text, Boundary boundary); diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 658d4ff..5270b1d 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -185,7 +185,7 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: } } -if (newBreak || icuBI-aICUText.pData != rText.pData) +if (newBreak || !icuBI-aICUText.equals(rText)) { // UChar != sal_Unicode in MinGW const UChar *pText = reinterpret_castconst UChar *(rText.getStr()); diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 95e1cc9..1067e33 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -271,21 +271,6 @@ bool xdictionary::seekSegment(const OUString rText, sal_Int32 pos, Boundary segBoundary) { sal_Int32 indexUtf16; - -if (segmentCachedString.pData != rText.pData) { -// Cache the passed text so we can avoid regenerating the segment if it's the same -// (pData is refcounted and assigning the OUString references it, which ensures that -// the object is the same if we get the same pointer back later) -segmentCachedString = rText; -} else { -// If pos is within the cached boundary, use that boundary -if (pos = segmentCachedBoundary.startPos pos = segmentCachedBoundary.endPos) { -indexUtf16 = segmentCachedBoundary.startPos; -rText.iterateCodePoints(indexUtf16, 1); -return segmentCachedBoundary.endPos indexUtf16; -} -} - segBoundary.endPos = segBoundary.startPos = pos; indexUtf16 = pos; @@ -308,10 +293,6 @@ bool xdictionary::seekSegment(const OUString rText, sal_Int32 pos, break; } -// Cache the calculated boundary -segmentCachedBoundary.startPos = segBoundary.startPos; -segmentCachedBoundary.endPos = segBoundary.endPos; - indexUtf16 = segBoundary.startPos; rText.iterateCodePoints(indexUtf16, 1); return segBoundary.endPos indexUtf16; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/xdictionary.hxx|2 + i18npool/source/breakiterator/breakiterator_unicode.cxx |2 - i18npool/source/breakiterator/xdictionary.cxx | 21 3 files changed, 24 insertions(+), 1 deletion(-) New commits: commit 44ead04eb5fc61a3f56f783adb1509fab440e212 Author: Matthew J. Francis mjay.fran...@gmail.com Date: Thu Sep 11 00:42:49 2014 +0800 fdo#81272 Speed up break iterators Change-Id: I7a45a61465f71a1cc6f583b9ffc68157d19e51fa Reviewed-on: https://gerrit.libreoffice.org/11386 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index 57f5238..f7c0110 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -76,6 +76,8 @@ public: private: WordBreakCache cache[CACHE_MAX]; +OUString segmentCachedString; +Boundary segmentCachedBoundary; boolseekSegment(const OUString rText, sal_Int32 pos, Boundary boundary); WordBreakCache getCache(const sal_Unicode *text, Boundary boundary); diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 5270b1d..658d4ff 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -185,7 +185,7 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: } } -if (newBreak || !icuBI-aICUText.equals(rText)) +if (newBreak || icuBI-aICUText.pData != rText.pData) { // UChar != sal_Unicode in MinGW const UChar *pText = reinterpret_castconst UChar *(rText.getStr()); diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 1067e33..b930f46 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -271,6 +271,23 @@ bool xdictionary::seekSegment(const OUString rText, sal_Int32 pos, Boundary segBoundary) { sal_Int32 indexUtf16; + +if (segmentCachedString.pData != rText.pData) { +// Cache the passed text so we can avoid regenerating the segment if it's the same +// (pData is refcounted and assigning the OUString references it, which ensures that +// the object is the same if we get the same pointer back later) +segmentCachedString = rText; +} else { +// If pos is within the cached boundary, use that boundary +if (pos = segmentCachedBoundary.startPos pos = segmentCachedBoundary.endPos) { +segBoundary.startPos = segmentCachedBoundary.startPos; +segBoundary.endPos = segmentCachedBoundary.endPos; +indexUtf16 = segmentCachedBoundary.startPos; +rText.iterateCodePoints(indexUtf16, 1); +return segmentCachedBoundary.endPos indexUtf16; +} +} + segBoundary.endPos = segBoundary.startPos = pos; indexUtf16 = pos; @@ -293,6 +310,10 @@ bool xdictionary::seekSegment(const OUString rText, sal_Int32 pos, break; } +// Cache the calculated boundary +segmentCachedBoundary.startPos = segBoundary.startPos; +segmentCachedBoundary.endPos = segBoundary.endPos; + indexUtf16 = segBoundary.startPos; rText.iterateCodePoints(indexUtf16, 1); return segBoundary.endPos indexUtf16; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/inc i18npool/source include/unotools offapi/com offapi/type_reference unotools/source
i18npool/inc/calendarImpl.hxx |2 - i18npool/inc/calendar_gregorian.hxx |2 - i18npool/source/calendar/calendarImpl.cxx |4 +-- i18npool/source/calendar/calendar_gregorian.cxx |8 +++ include/unotools/calendarwrapper.hxx|4 +-- offapi/com/sun/star/i18n/XCalendar.idl |2 - offapi/type_reference/offapi.idl|2 - unotools/source/i18n/calendarwrapper.cxx| 26 8 files changed, 25 insertions(+), 25 deletions(-) New commits: commit 4452ac23224cc6fc9c575f1b128dd71f79e12d88 Author: Isamu Mogi saturda...@gmail.com Date: Fri May 30 20:18:49 2014 +0900 Fix hungarian prefix for calendars Change-Id: I78b3c0a8d32610e86e09ab5ad6da6cc4e0395926 Reviewed-on: https://gerrit.libreoffice.org/9566 Reviewed-by: Thomas Arnhold tho...@arnhold.org Tested-by: Thomas Arnhold tho...@arnhold.org diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx index 9fd6dc3..7ec10de 100644 --- a/i18npool/inc/calendarImpl.hxx +++ b/i18npool/inc/calendarImpl.hxx @@ -58,7 +58,7 @@ public: virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual com::sun::star::uno::Sequence OUString SAL_CALL getAllCalendars(const com::sun::star::lang::Locale rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; -virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; +virtual void SAL_CALL setDateTime(double fTimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 43bc461..bd99d18 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -57,7 +57,7 @@ public: // Methods in XCalendar virtual void SAL_CALL loadCalendar(const OUString uniqueID, const com::sun::star::lang::Locale rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; -virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; +virtual void SAL_CALL setDateTime(double fTimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index b0f8977..e6bf29f 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -138,10 +138,10 @@ CalendarImpl::getAllCalendars( const Locale rLocale ) throw(RuntimeException, s } void SAL_CALL -CalendarImpl::setDateTime( double timeInDays ) throw(RuntimeException, std::exception) +CalendarImpl::setDateTime( double fTimeInDays ) throw(RuntimeException, std::exception) { if (xCalendar.is()) -xCalendar-setDateTime( timeInDays ); +xCalendar-setDateTime( fTimeInDays ); else throw ERROR ; } diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index e5f6fc8..35e01e2 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -282,7 +282,7 @@ Calendar_gregorian::getUniqueID() throw(RuntimeException, std::exception) } void SAL_CALL -Calendar_gregorian::setDateTime( double timeInDays ) throw(RuntimeException, std::exception) +Calendar_gregorian::setDateTime( double fTimeInDays ) throw(RuntimeException, std::exception) { // ICU handles dates in milliseconds as double values and uses floor() // to obtain integer values, which may yield a date decremented by one @@ -291,7 +291,7 @@ Calendar_gregorian::setDateTime( double timeInDays ) throw(RuntimeException, std // pass a value without fraction here. If not, that may lead to // fdo#44286 or
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiterator_cjk.hxx |3 i18npool/inc/chartonum.hxx |3 i18npool/inc/numtochar.hxx |3 i18npool/inc/numtotext_cjk.hxx |3 i18npool/inc/textToPronounce_zh.hxx|3 i18npool/inc/texttonum.hxx |3 i18npool/inc/transliteration_Ignore.hxx| 44 -- i18npool/inc/transliteration_OneToOne.hxx | 22 - i18npool/inc/transliteration_body.hxx |7 - i18npool/source/breakiterator/breakiterator_cjk.cxx|2 i18npool/source/registerservices/registerservices.cxx |2 i18npool/source/transliteration/chartonum.cxx |5 - i18npool/source/transliteration/data/numberchar.h |2 i18npool/source/transliteration/fullwidthToHalfwidth.cxx |9 -- i18npool/source/transliteration/halfwidthToFullwidth.cxx |8 - i18npool/source/transliteration/hiraganaToKatakana.cxx |5 - i18npool/source/transliteration/ignoreBaFa_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreDiacritics_CTL.cxx |1 i18npool/source/transliteration/ignoreHyuByu_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx |6 - i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreKana.cxx |8 - i18npool/source/transliteration/ignoreKashida_CTL.cxx |1 i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreMiddleDot_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreMinusSign_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreSeZe_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreSeparator_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreSize_ja_JP.cxx |8 - i18npool/source/transliteration/ignoreSpace_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreTiJi_ja_JP.cxx |6 - i18npool/source/transliteration/ignoreTraditionalKana_ja_JP.cxx|5 - i18npool/source/transliteration/ignoreTraditionalKanji_ja_JP.cxx |5 - i18npool/source/transliteration/ignoreWidth.cxx|7 - i18npool/source/transliteration/ignoreZiZu_ja_JP.cxx |5 - i18npool/source/transliteration/katakanaToHiragana.cxx |5 - i18npool/source/transliteration/largeToSmall_ja_JP.cxx |6 - i18npool/source/transliteration/numtochar.cxx |8 - i18npool/source/transliteration/numtotext_cjk.cxx |5 - i18npool/source/transliteration/smallToLarge_ja_JP.cxx |6 - i18npool/source/transliteration/textToPronounce_zh.cxx |9 -- i18npool/source/transliteration/texttonum.cxx |6 - i18npool/source/transliteration/transliteration_Ignore.cxx |3 i18npool/source/transliteration/transliteration_OneToOne.cxx |4 i18npool/source/transliteration/transliteration_body.cxx |1 i18npool/source/transliteration/transliteration_caseignore.cxx |5 - 47 files changed, 32 insertions(+), 252 deletions(-) New commits: commit bb2f13b473f87ec75366dad5aa318b1e24893735 Author: Tor Lillqvist t...@collabora.com Date: Wed Apr 23 09:29:09 2014 +0300 Avoid cargo cult rites Change-Id: I39fee26048d5b4ddb03217309b7117bef9ec4cd8 diff --git a/i18npool/inc/breakiterator_cjk.hxx b/i18npool/inc/breakiterator_cjk.hxx index dce0f55..4a0c93d 100644 --- a/i18npool/inc/breakiterator_cjk.hxx +++ b/i18npool/inc/breakiterator_cjk.hxx @@ -57,12 +57,11 @@ public:\ virtual ~BreakIterator_##lang (); \ }; -#ifdef BREAKITERATOR_ALL BREAKITERATOR_CJK( zh ) BREAKITERATOR_CJK( zh_TW ) BREAKITERATOR_CJK( ja ) BREAKITERATOR_CJK( ko ) -#endif + #undef BREAKITERATOR__CJK } } } } diff --git a/i18npool/inc/chartonum.hxx b/i18npool/inc/chartonum.hxx index f899b73..2a2e2c2 100644 --- a/i18npool/inc/chartonum.hxx +++ b/i18npool/inc/chartonum.hxx @@ -30,7 +30,6 @@ public: \ CharToNum##name (); \ }; -#ifdef TRANSLITERATION_ALL TRANSLITERATION_CHARTONUM(Lower_zh_CN) TRANSLITERATION_CHARTONUM(Upper_zh_CN) TRANSLITERATION_CHARTONUM(Lower_zh_TW) @@ -45,7 +44,7 @@ TRANSLITERATION_CHARTONUM(Indic_ar) TRANSLITERATION_CHARTONUM(EastIndic_ar) TRANSLITERATION_CHARTONUM(Indic_hi) TRANSLITERATION_CHARTONUM(_th) -#endif + #undef TRANSLITERATION_CHARTONUM } } } } diff --git a/i18npool/inc/numtochar.hxx
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/chartonum.hxx|7 --- i18npool/inc/numtochar.hxx|7 --- i18npool/inc/numtotext_cjk.hxx|7 --- i18npool/inc/texttonum.hxx|7 --- i18npool/source/nativenumber/data/numberchar.h|7 --- i18npool/source/transliteration/data/numberchar.h |9 - 6 files changed, 24 insertions(+), 20 deletions(-) New commits: commit dc17d5c6e467cc809a92c16bc688fb54f11b143b Author: Tor Lillqvist t...@collabora.com Date: Wed Apr 23 09:56:06 2014 +0300 Use our canonical header guard naming Change-Id: I06c9c55f75dc13893e29ec6cc96726a60c34846c diff --git a/i18npool/inc/chartonum.hxx b/i18npool/inc/chartonum.hxx index 2a2e2c2..27107fd 100644 --- a/i18npool/inc/chartonum.hxx +++ b/i18npool/inc/chartonum.hxx @@ -16,8 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _L10N_TRANSLITERATION_CHARTONUM_HXX_ -#define _L10N_TRANSLITERATION_CHARTONUM_HXX_ + +#ifndef INCLUDED_I18NPOOL_INC_CHARTONUM_HXX +#define INCLUDED_I18NPOOL_INC_CHARTONUM_HXX #include transliteration_Numeric.hxx @@ -49,6 +50,6 @@ TRANSLITERATION_CHARTONUM(_th) } } } } -#endif // _L10N_TRANSLITERATION_CHARTONUM_HXX_ +#endif // INCLUDED_I18NPOOL_INC_CHARTONUM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/numtochar.hxx b/i18npool/inc/numtochar.hxx index e64e520..f7dbd92 100644 --- a/i18npool/inc/numtochar.hxx +++ b/i18npool/inc/numtochar.hxx @@ -16,8 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ -#define _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ + +#ifndef INCLUDED_I18NPOOL_INC_NUMTOCHAR_HXX +#define INCLUDED_I18NPOOL_INC_NUMTOCHAR_HXX #include transliteration_Numeric.hxx @@ -50,6 +51,6 @@ TRANSLITERATION_NUMTOCHAR(Halfwidth) } } } } -#endif // _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ +#endif // INCLUDED_I18NPOOL_INC_NUMTOCHAR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/numtotext_cjk.hxx b/i18npool/inc/numtotext_cjk.hxx index dfdcf83..56aeebe 100644 --- a/i18npool/inc/numtotext_cjk.hxx +++ b/i18npool/inc/numtotext_cjk.hxx @@ -16,8 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _L10N_TRANSLITERATION_NUMTOTEXT_CJK_HXX_ -#define _L10N_TRANSLITERATION_NUMTOTEXT_CJK_HXX_ + +#ifndef INCLUDED_I18NPOOL_INC_NUMTOTEXT_CJK_HXX +#define INCLUDED_I18NPOOL_INC_NUMTOTEXT_CJK_HXX #include transliteration_Numeric.hxx @@ -65,6 +66,6 @@ TRANSLITERATION_NUMTOTEXT_CJK ( HangulCircledSyllable_ko ) } } } } -#endif // _L10N_TRANSLITERATION_NUMTOTEXT_HXX_ +#endif // INCLUDED_I18NPOOL_INC_NUMTOTEXT_CJK_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/texttonum.hxx b/i18npool/inc/texttonum.hxx index cb74803..ab570ec 100644 --- a/i18npool/inc/texttonum.hxx +++ b/i18npool/inc/texttonum.hxx @@ -16,8 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _L10N_TRANSLITERATION_TEXTTONUM_HXX_ -#define _L10N_TRANSLITERATION_TEXTTONUM_HXX_ + +#ifndef INCLUDED_I18NPOOL_INC_TEXTTONUM_HXX +#define INCLUDED_I18NPOOL_INC_TEXTTONUM_HXX #include transliteration_Numeric.hxx @@ -47,6 +48,6 @@ TRANSLITERATION_TEXTTONUM(KanjiLongTraditional_ja_JP) } } } } -#endif // _L10N_TRANSLITERATION_TEXTTONUM_HXX_ +#endif // INCLUDED_I18NPOOL_INC_TEXTTONUM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/nativenumber/data/numberchar.h b/i18npool/source/nativenumber/data/numberchar.h index 48d0285..5b28a6c 100644 --- a/i18npool/source/nativenumber/data/numberchar.h +++ b/i18npool/source/nativenumber/data/numberchar.h @@ -16,8 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _L10N_TRANSLITERATION_NUMTOCHAR_H_ -#define _L10N_TRANSLITERATION_NUMTOCHAR_H_ + +#ifndef INCLUDED_I18NPOOL_SOURCE_NATIVENUMBER_DATA_NUMBERCHAR_H +#define INCLUDED_I18NPOOL_SOURCE_NATIVENUMBER_DATA_NUMBERCHAR_H namespace com { namespace sun { namespace star { namespace i18n { @@ -266,6 +267,6 @@ typedef struct { } } } } -#endif // _L10N_TRANSLITERATION_NUMTOCHAR_H_ +#endif // INCLUDED_I18NPOOL_SOURCE_NATIVENUMBER_DATA_NUMBERCHAR_H /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/transliteration/data/numberchar.h b/i18npool/source/transliteration/data/numberchar.h index c9cbd38..75dbfa1 100644 --- a/i18npool/source/transliteration/data/numberchar.h +++
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/breakiteratorImpl.hxx|4 +- i18npool/inc/breakiterator_cjk.hxx|4 +- i18npool/inc/breakiterator_ctl.hxx|4 +- i18npool/inc/breakiterator_th.hxx |4 +- i18npool/inc/breakiterator_unicode.hxx|4 +- i18npool/inc/calendarImpl.hxx |4 +- i18npool/inc/calendar_gregorian.hxx | 20 +- i18npool/inc/calendar_hijri.hxx |4 +- i18npool/inc/calendar_jewish.hxx |4 +- i18npool/inc/indexentrysupplier.hxx |4 +- i18npool/inc/indexentrysupplier_asian.hxx |4 +- i18npool/inc/indexentrysupplier_common.hxx|4 +- i18npool/inc/indexentrysupplier_default.hxx |4 +- i18npool/inc/indexentrysupplier_ja_phonetic.hxx |4 +- i18npool/inc/inputsequencechecker.hxx |4 +- i18npool/inc/inputsequencechecker_hi.hxx |4 +- i18npool/inc/inputsequencechecker_th.hxx |4 +- i18npool/inc/localedata.hxx |4 +- i18npool/inc/textconversion.hxx | 12 +++--- i18npool/inc/textconversionImpl.hxx |4 +- i18npool/inc/unoscripttypedetector.hxx|4 +- i18npool/source/breakiterator/breakiteratorImpl.cxx |4 +- i18npool/source/breakiterator/breakiterator_th.cxx|2 - i18npool/source/breakiterator/xdictionary.cxx |8 ++-- i18npool/source/calendar/calendar_gregorian.cxx |2 - i18npool/source/calendar/calendar_hijri.cxx |6 +-- i18npool/source/characterclassification/cclass_unicode.cxx|2 - i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |2 - i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx |2 - i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx |2 - i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx |2 - i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx|2 - i18npool/source/transliteration/transliterationImpl.cxx |2 - 33 files changed, 72 insertions(+), 72 deletions(-) New commits: commit 2a42d5ec2965451f8cb2e719d831f4b2722f51bb Author: Alexander Wilms f.alexander.wi...@gmail.com Date: Tue Feb 25 18:57:53 2014 +0100 Remove visual noise from i18npool Change-Id: I1cd4254713ce9c1bc7c232414c24e926f1f8a653 Reviewed-on: https://gerrit.libreoffice.org/8269 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/i18npool/inc/breakiteratorImpl.hxx b/i18npool/inc/breakiteratorImpl.hxx index 92cae01..a6d3e65 100644 --- a/i18npool/inc/breakiteratorImpl.hxx +++ b/i18npool/inc/breakiteratorImpl.hxx @@ -36,9 +36,9 @@ namespace com { namespace sun { namespace star { namespace i18n { -// + // class BreakIterator -// + class BreakIteratorImpl : public cppu::WeakImplHelper2 XBreakIterator, diff --git a/i18npool/inc/breakiterator_cjk.hxx b/i18npool/inc/breakiterator_cjk.hxx index 1f16326..5985c39 100644 --- a/i18npool/inc/breakiterator_cjk.hxx +++ b/i18npool/inc/breakiterator_cjk.hxx @@ -23,9 +23,9 @@ #include xdictionary.hxx namespace com { namespace sun { namespace star { namespace i18n { -// + // class BreakIterator_CJK -// + class BreakIterator_CJK : public BreakIterator_Unicode { public: diff --git a/i18npool/inc/breakiterator_ctl.hxx b/i18npool/inc/breakiterator_ctl.hxx index 270f64b..fce4a35 100644 --- a/i18npool/inc/breakiterator_ctl.hxx +++ b/i18npool/inc/breakiterator_ctl.hxx @@ -24,9 +24,9 @@ namespace com { namespace sun { namespace star { namespace i18n { -// + // class BreakIterator_CTL -// + class BreakIterator_CTL : public BreakIterator_Unicode { public: diff --git a/i18npool/inc/breakiterator_th.hxx b/i18npool/inc/breakiterator_th.hxx index 19dbeae..8c8abb4 100644 --- a/i18npool/inc/breakiterator_th.hxx +++ b/i18npool/inc/breakiterator_th.hxx @@ -22,9 +22,9 @@ namespace com { namespace sun { namespace star { namespace i18n { -//
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/i18npool/languagetag.hxx | 40 +++ i18npool/source/languagetag/languagetag.cxx | 47 2 files changed, 87 insertions(+) New commits: commit a1554c121f5f810c77b70ece3d11522a48091d0f Author: Eike Rathke er...@redhat.com Date: Wed Mar 27 22:18:32 2013 +0100 added LanguageTag::getFallback() Similar to comphelper::Locale::getFallback() but implemented differently. comphelper::Locale is to be removed later. Change-Id: I99dc7b51029df102705f2608245c91d81dc96788 diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx index 4d99e72..eb1a518 100644 --- a/i18npool/inc/i18npool/languagetag.hxx +++ b/i18npool/inc/i18npool/languagetag.hxx @@ -236,6 +236,46 @@ public: */ ::std::vector OUStringgetFallbackStrings() const; + +/** @short search for an equal or at least for a similar locale in a list +of possible ones. + +@descr First search for a locale that is equal to the reference +locale. (means: same BCP47 string) + +If the reference locale could not be located, check for +similar locales, in the same order as obtained by +getFallbackStrings(). + +If no similar locale could be located, we search for a locale +en-US inside the given locale list. + +If en-US could not be located, we search for a locale en +inside the given list. + +If no same nor any similar locale could be found, we try +x-default and x-no-translate explicitly. Sometimes +variables don't use real localization. For example, in case the +localized value is a fix product name. + +If no locale matched until then, we use any other locale that +exists inside the set of given ones, namely the first +encountered! + +@param rList +the vector of possible locales as BCP47 strings. + +@param rReference +the reference locale, BCP47 string. + +@return An iterator that points to the found element inside the given +locale list. If no matching locale could be found it points to +the end of the list. + */ +static ::std::vector OUString ::const_iterator getFallback( const ::std::vector OUString rList, + const OUString rReference ); + + /** Test equality of two LanguageTag, possibly resolving system locale. @param bResolveSystem diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index 7b284b5..be6e228 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -1159,4 +1159,51 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString rBcp47, } +// static +::std::vector OUString ::const_iterator LanguageTag::getFallback( +const ::std::vector OUString rList, const OUString rReference ) +{ +if (rList.empty()) +return rList.end(); + +::std::vector OUString ::const_iterator it; + +// Try the simple case first without constructing fallbacks. +for (it = rList.begin(); it != rList.end(); ++it) +{ +if (*it == rReference) +return it; // exact match +} + +::std::vector OUString aFallbacks( LanguageTag( rReference).getFallbackStrings()); +aFallbacks.erase( aFallbacks.begin()); // first is full BCP47, we already checked that +if (rReference != en-US) +aFallbacks.push_back( en-US); +if (rReference != en) +aFallbacks.push_back( en); +if (rReference != x-default) +aFallbacks.push_back( x-default); +if (rReference != x-no-translate) +aFallbacks.push_back( x-no-translate); +/* TODO: the original comphelper::Locale::getFallback() code had + * x-notranslate instead of x-no-translate, but all .xcu files use + * x-no-translate and x-notranslate apparently was never used anywhere. + * Did that ever work? Was it supposed to work at all like this? */ + +for (::std::vector OUString ::const_iterator fb = aFallbacks.begin(); fb != aFallbacks.end(); ++fb) +{ +for (it = rList.begin(); it != rList.end(); ++it) +{ +if (*it == *fb) +return it; // fallback found +} +} + +// Did not find anything so return something of the list, the first value +// will do as well as any other as none did match any of the possible +// fallbacks. +return rList.begin(); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: i18npool/inc i18npool/source
i18npool/inc/calendar_gregorian.hxx |5 ++ i18npool/source/calendar/calendar_gregorian.cxx | 56 +++- 2 files changed, 40 insertions(+), 21 deletions(-) New commits: commit be16dba682b8ab1c244f8d24f1bab3a539096962 Author: Eike Rathke er...@redhat.com Date: Thu Feb 28 18:34:41 2013 +0100 resolved fdo#60915 force long year only for ROC calendar Long year was forced unconditionally for all non-Gregorian calendars, do this only for ROC calendar. Change-Id: I39d6eb269b3d38046d32dcf0f66edd5617581b9d diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 2a8ac14..929f759 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -30,10 +30,13 @@ namespace com { namespace sun { namespace star { namespace i18n { +const sal_uInt8 kDisplayEraForcedLongYear = 0x01; + struct Era { sal_Int32 year; sal_Int32 month; sal_Int32 day; +sal_uInt8 flags; }; const sal_Int16 FIELD_INDEX_COUNT = CalendarFieldIndex::FIELD_COUNT2; @@ -101,6 +104,8 @@ protected: virtual void mapFromGregorian() throw(com::sun::star::uno::RuntimeException); void getValue() throw(com::sun::star::uno::RuntimeException); +rtl::OUString getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode, bool bEraMode ) throw (com::sun::star::uno::RuntimeException); + private: Calendar2 aCalendar; diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index c92d720..a2a5324 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -200,11 +200,11 @@ Calendar_hanja::loadCalendar( const OUString /*uniqueID*/, const com::sun::star } static Era gengou_eraArray[] = { -{1868, 1, 1}, -{1912, 7, 30}, -{1926, 12, 25}, -{1989, 1, 8}, -{0, 0, 0} +{1868, 1, 1, 0}, +{1912, 7, 30, 0}, +{1926, 12, 25, 0}, +{1989, 1, 8, 0}, +{0, 0, 0, 0} }; Calendar_gengou::Calendar_gengou() : Calendar_gregorian(gengou_eraArray) { @@ -212,8 +212,8 @@ Calendar_gengou::Calendar_gengou() : Calendar_gregorian(gengou_eraArray) } static Era ROC_eraArray[] = { -{1912, 1, 1}, -{0, 0, 0} +{1912, 1, 1, kDisplayEraForcedLongYear},// #i116701# +{0, 0, 0, 0} }; Calendar_ROC::Calendar_ROC() : Calendar_gregorian(ROC_eraArray) { @@ -221,8 +221,8 @@ Calendar_ROC::Calendar_ROC() : Calendar_gregorian(ROC_eraArray) } static Era buddhist_eraArray[] = { -{-542, 1, 1}, -{0, 0, 0} +{-542, 1, 1, 0}, +{0, 0, 0, 0} }; Calendar_buddhist::Calendar_buddhist() : Calendar_gregorian(buddhist_eraArray) { @@ -1002,6 +1002,13 @@ OUString SAL_CALL Calendar_gregorian::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (RuntimeException) { +return getDisplayStringImpl( nCalendarDisplayCode, nNativeNumberMode, false); +} + +OUString +Calendar_gregorian::getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode, bool bEraMode ) +throw (RuntimeException) +{ sal_Int16 value = getValue(sal::static_int_castsal_Int16( DisplayCode2FieldIndex(nCalendarDisplayCode) )); OUString aOUStr; @@ -1045,10 +1052,17 @@ Calendar_gregorian::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 break; case CalendarDisplayCode::SHORT_YEAR: // Take last 2 digits, or only one if value10, for example, -// in case of the Gengou calendar. -// #i116701# For values in non-Gregorian era years use all -// digits. -if (value 100 || eraArray) +// in case of the Gengou calendar. For combined era+year always +// the full year is displayed, without leading 0. +// Workaround for non-combined calls in certain calendars is +// the kDisplayEraForcedLongYear flag, but this also could get +// called for YY not only E format codes, no differentiation +// possible here; the good news is that usually the Gregorian +// calendar is the default and hence YY calls for Gregorian and +// E for the other calendar and currently (2013-02-28) ROC is +// the only calendar using this. +// See i#116701 and fdo#60915 +if (value 100 || bEraMode || (eraArray (eraArray[0].flags kDisplayEraForcedLongYear))) sprintf(aStr, %d, value); // #100211# - checked else sprintf(aStr, %02d, value % 100); // #100211# - checked @@ -1087,12 +1101,12 @@ Calendar_gregorian::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 return getDisplayName(CalendarDisplayIndex::ERA, value, 1);