diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-15 12:47:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-16 12:41:43 +0200 |
commit | e51b4fc8c278bfa0b0671bbdb0ab35346881ebb7 (patch) | |
tree | 2fab442dfd820b5ff20c7a7d934a49b4d8b14777 /i18npool/source/localedata/filewriter.cxx | |
parent | 4a40a42afc3ba551e6e58947fc2e44689979b629 (diff) |
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: Idd27071c1200d6ced2c4f43e10310df786fbc8fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153125
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/localedata/filewriter.cxx')
-rw-r--r-- | i18npool/source/localedata/filewriter.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx index a2ec7a1ea72d..9aaa27bbb47f 100644 --- a/i18npool/source/localedata/filewriter.cxx +++ b/i18npool/source/localedata/filewriter.cxx @@ -176,6 +176,15 @@ void OFileWriter::writeFunction3(const char *func, const char *style, const char fprintf(m_f, "\treturn %s;\n}\n", array); } +void OFileWriter::writeOUStringFunction3(const char *func, const char *style, const char* levels, const char* attr, const char *array) const +{ + fprintf(m_f, "const OUString *** SAL_CALL %s%s( sal_Int16& nStyles, sal_Int16& nLevels, sal_Int16& nAttributes )\n{\n", func, theLocale.c_str()); + fprintf(m_f, "\tnStyles = %s;\n", style); + fprintf(m_f, "\tnLevels = %s;\n", levels); + fprintf(m_f, "\tnAttributes = %s;\n", attr); + fprintf(m_f, "\treturn (const OUString ***) %s;\n}\n", array); +} + void OFileWriter::writeRefFunction3(const char *func, std::u16string_view useLocale) const { OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) ); @@ -185,6 +194,15 @@ void OFileWriter::writeRefFunction3(const char *func, std::u16string_view useLoc fprintf(m_f, "\treturn %s%s(nStyles, nLevels, nAttributes);\n}\n", func, locale); } +void OFileWriter::writeOUStringRefFunction3(const char *func, std::u16string_view useLocale) const +{ + OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) ); + const char* locale = aRefLocale.getStr(); + fprintf(m_f, "extern const OUString **** SAL_CALL %s%s(sal_Int16& nStyles, sal_Int16& nLevels, sal_Int16& nAttributes);\n", func, locale); + fprintf(m_f, "const OUString **** SAL_CALL %s%s(sal_Int16& nStyles, sal_Int16& nLevels, sal_Int16& nAttributes)\n{\n", func, theLocale.c_str()); + fprintf(m_f, "\treturn %s%s(nStyles, nLevels, nAttributes);\n}\n", func, locale); +} + void OFileWriter::writeIntParameter(const char* pAsciiStr, const sal_Int16 count, sal_Int16 val) const { fprintf(m_f, "static const sal_Unicode %s%d[] = {%d};\n", pAsciiStr, count, val); |