summaryrefslogtreecommitdiff
path: root/i18npool/source/localedata/filewriter.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-13 21:39:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-14 08:47:00 +0200
commitee76ed70e97448082f4c00c5c4207a44e1a91617 (patch)
treedaeeaa234ef92bc004141c069c87a88db2743f43 /i18npool/source/localedata/filewriter.cxx
parent3af9bd139458b534ae72e3e010c8725b826fd12c (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: Iecc822169a2fcd2f4678e4d6c303083c54a54456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153005 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.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx
index 91768b2bd54e..de75307b3596 100644
--- a/i18npool/source/localedata/filewriter.cxx
+++ b/i18npool/source/localedata/filewriter.cxx
@@ -39,6 +39,11 @@ void OFileWriter::writeInt(sal_Int16 nb) const
fprintf(m_f, "%d", nb);
}
+void OFileWriter::writeHexInt(sal_Int16 nb) const
+{
+ fprintf(m_f, "%x", nb);
+}
+
void OFileWriter::writeAsciiString(const char* str) const
{
fprintf(m_f, "%s", str);
@@ -83,6 +88,13 @@ void OFileWriter::writeFunction(const char *func, const char *count, const char
fprintf(m_f, "\treturn (sal_Unicode**)%s;\n}\n", array);
}
+void OFileWriter::writeOUStringFunction(const char *func, const char *count, const char *array) const
+{
+ fprintf(m_f, "OUString const * SAL_CALL %s%s(sal_Int16& count)\n{\n", func, theLocale.c_str());
+ fprintf(m_f, "\tcount = %s;\n", count);
+ fprintf(m_f, "\treturn (OUString const *)%s;\n}\n", array);
+}
+
void OFileWriter::writeRefFunction(const char *func, std::u16string_view useLocale) const
{
OString aRefLocale( OUStringToOString(useLocale, RTL_TEXTENCODING_ASCII_US) );
@@ -208,6 +220,13 @@ void OFileWriter::writeParameter(const char* pAsciiStr, std::u16string_view aCha
fprintf(m_f, "0x0};\n");
}
+void OFileWriter::writeOUStringLiteralParameter(const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count0, sal_Int16 count1) const
+{
+ fprintf(m_f, "static constexpr OUStringLiteral %s%d%d = u\"", pAsciiStr, count0, count1);
+ writeOUStringLiteralCharacters(aChars);
+ fprintf(m_f, "\";\n");
+}
+
void OFileWriter::writeParameter(const char* pTagStr, const char* pAsciiStr, std::u16string_view aChars, const sal_Int16 count) const
{
fprintf(m_f, "static const sal_Unicode %s%s%d[] = {", pTagStr, pAsciiStr, count);
@@ -222,6 +241,13 @@ void OFileWriter::writeParameter(const char* pTagStr, const char* pAsciiStr, std
fprintf(m_f, "0x0};\n");
}
+void OFileWriter::writeOUStringLiteralParameter(const char* pTagStr, const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count0, sal_Int16 count1) const
+{
+ fprintf(m_f, "static constexpr OUStringLiteral %s%s%d%d = u\"", pTagStr, pAsciiStr, count0, count1);
+ writeOUStringLiteralCharacters(aChars);
+ fprintf(m_f, "\";\n");
+}
+
void OFileWriter::closeOutput() const
{
if(m_f)