summaryrefslogtreecommitdiff
path: root/i18npool/inc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-27 16:25:12 +0200
committerEike Rathke <erack@redhat.com>2017-09-28 12:53:16 +0200
commit0f6b9eca2007629e61d3ab9cdf2a616a33cbdefe (patch)
tree1954e70c55cf7bae6e03e7412bce997d0f8f2c9b /i18npool/inc
parente67f6acc303dc09c6f35ea6374a721266dedaabd (diff)
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 <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'i18npool/inc')
-rw-r--r--i18npool/inc/breakiterator_unicode.hxx25
1 files changed, 17 insertions, 8 deletions
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 <unicode/brkiter.h>
#include <memory>
+#include <unordered_map>
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
{
- OUString aICUText;
- UText* ut;
- std::unique_ptr<icu::BreakIterator> aBreakIterator;
- css::lang::Locale maLocale;
+ OUString maICUText;
+ 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;
};
} } } }