diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-09 11:28:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-09 12:48:08 +0200 |
commit | 43f4c075740671450766f632f2ddab5dc3563d3d (patch) | |
tree | e25e44bdeb015c300ffe913047cc2023669c42cc | |
parent | 0479f870e05d5d231d2d57aaeedff11544bd370c (diff) |
loplugin:ostr in i18npool
Change-Id: I0176d93b38788e28fa42baad293597f98eaa7a21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167378
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
25 files changed, 228 insertions, 222 deletions
diff --git a/i18npool/qa/cppunit/indexentry.cxx b/i18npool/qa/cppunit/indexentry.cxx index a95bca547a98..aa003b95c783 100644 --- a/i18npool/qa/cppunit/indexentry.cxx +++ b/i18npool/qa/cppunit/indexentry.cxx @@ -33,7 +33,7 @@ public: void testJapanese() { - css::lang::Locale loc("ja", "JP", ""); + css::lang::Locale loc(u"ja"_ustr, u"JP"_ustr, u""_ustr); auto const s = supplier_->getAlgorithmList(loc); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), s.getLength()); CPPUNIT_ASSERT( @@ -45,13 +45,13 @@ public: CPPUNIT_ASSERT( comphelper::findValue(s, "phonetic (alphanumeric last) (grouped by syllable)") != -1); CPPUNIT_ASSERT(supplier_->loadAlgorithm( - loc, "phonetic (alphanumeric first) (grouped by consonant)", 0)); + loc, u"phonetic (alphanumeric first) (grouped by consonant)"_ustr, 0)); CPPUNIT_ASSERT(supplier_->loadAlgorithm( - loc, "phonetic (alphanumeric first) (grouped by syllable)", 0)); + loc, u"phonetic (alphanumeric first) (grouped by syllable)"_ustr, 0)); CPPUNIT_ASSERT(supplier_->loadAlgorithm( - loc, "phonetic (alphanumeric last) (grouped by consonant)", 0)); - CPPUNIT_ASSERT( - supplier_->loadAlgorithm(loc, "phonetic (alphanumeric last) (grouped by syllable)", 0)); + loc, u"phonetic (alphanumeric last) (grouped by consonant)"_ustr, 0)); + CPPUNIT_ASSERT(supplier_->loadAlgorithm( + loc, u"phonetic (alphanumeric last) (grouped by syllable)"_ustr, 0)); } CPPUNIT_TEST_SUITE(IndexEntry); diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index d3f41e604503..2ac46f9bdca6 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -89,7 +89,7 @@ void TestBreakIterator::testLineBreaking() //See https://bugs.libreoffice.org/show_bug.cgi?id=31271 { - OUString aTest("(some text here)"); + OUString aTest(u"(some text here)"_ustr); aLocale.Language = "en"; aLocale.Country = "US"; @@ -129,7 +129,7 @@ void TestBreakIterator::testLineBreaking() { //Here we want the line break to leave /bar/ba clumped together on the next line - i18n::LineBreakResults aResult = m_xBreak->getLineBreak("foo /bar/baz", strlen("foo /bar/ba"), aLocale, 0, + i18n::LineBreakResults aResult = m_xBreak->getLineBreak(u"foo /bar/baz"_ustr, strlen("foo /bar/ba"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the first slash", static_cast<sal_Int32>(4), aResult.breakIndex); } @@ -143,7 +143,7 @@ void TestBreakIterator::testLineBreaking() { //Here we want the line break to leave ./bar/baz clumped together on the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "foo ./bar/baz", strlen("foo ./bar/ba"), aLocale, 0, aHyphOptions, aUserOptions); + u"foo ./bar/baz"_ustr, strlen("foo ./bar/ba"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the first period", static_cast<sal_Int32>(4), aResult.breakIndex); } @@ -159,7 +159,7 @@ void TestBreakIterator::testLineBreaking() // However, the current behavior does not wrap the string at all. This test asserts the // current behavior as a point of reference. i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "THIS... ...BE", strlen("THIS... ...B"), aLocale, 0, aHyphOptions, aUserOptions); + u"THIS... ...BE"_ustr, strlen("THIS... ...B"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aResult.breakIndex); } } @@ -172,7 +172,7 @@ void TestBreakIterator::testLineBreaking() { // The line break should leave /BE clumped together on the next line. i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "THIS... /BE", strlen("THIS... /B"), aLocale, 0, aHyphOptions, aUserOptions); + u"THIS... /BE"_ustr, strlen("THIS... /B"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8), aResult.breakIndex); } } @@ -186,7 +186,7 @@ void TestBreakIterator::testLineBreaking() // Per the bug, the line break should leave -bar clumped together on the next line. // However, this change was reverted at some point. This test asserts the new behavior. i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "foo -bar", strlen("foo -ba"), aLocale, 0, aHyphOptions, aUserOptions); + u"foo -bar"_ustr, strlen("foo -ba"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the first dash", static_cast<sal_Int32>(5), aResult.breakIndex); } @@ -200,7 +200,7 @@ void TestBreakIterator::testLineBreaking() { // Here we want the line break to leave C:\Program Files\ on the first line i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "C:\\Program Files\\LibreOffice", strlen("C:\\Program Files\\Libre"), aLocale, 0, + u"C:\\Program Files\\LibreOffice"_ustr, strlen("C:\\Program Files\\Libre"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(17), aResult.breakIndex); } @@ -214,7 +214,7 @@ void TestBreakIterator::testLineBreaking() { // Here we want the line break to leave toll- on the first line i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "toll-free", strlen("toll-fr"), aLocale, 0, aHyphOptions, aUserOptions); + u"toll-free"_ustr, strlen("toll-fr"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5), aResult.breakIndex); } } @@ -227,7 +227,7 @@ void TestBreakIterator::testLineBreaking() { // Here we want the line break to leave US$ clumped on the next line. i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "word US$ 123", strlen("word U"), aLocale, 0, aHyphOptions, aUserOptions); + u"word US$ 123"_ustr, strlen("word U"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5), aResult.breakIndex); } } @@ -240,7 +240,7 @@ void TestBreakIterator::testLineBreaking() { // Here we want the line break to leave US$ clumped on the next line. i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "word L.5 word", strlen("word L"), aLocale, 0, aHyphOptions, aUserOptions); + u"word L.5 word"_ustr, strlen("word L"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5), aResult.breakIndex); } } @@ -253,7 +253,7 @@ void TestBreakIterator::testLineBreaking() { // Here we want the line break to leave 100- clumped on the first line. i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "word 100-199 word", strlen("word 100-1"), aLocale, 0, aHyphOptions, aUserOptions); + u"word 100-199 word"_ustr, strlen("word 100-1"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(9), aResult.breakIndex); } } @@ -308,7 +308,7 @@ void TestBreakIterator::testLineBreaking() aLocale.Country = "US"; { - OUString aTest("aaa]aaa"); + OUString aTest(u"aaa]aaa"_ustr); //Here we want the line break to move the whole lot to the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, aTest.getLength()-2, aLocale, 0, aHyphOptions, aUserOptions); @@ -352,7 +352,7 @@ void TestBreakIterator::testLineBreaking() aLocale.Country = "DE"; { - auto res = m_xBreak->getLineBreak("Wort -prinzessinnen, wort", + auto res = m_xBreak->getLineBreak(u"Wort -prinzessinnen, wort"_ustr, strlen("Wort -prinzessinnen,"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(sal_Int32{ 6 }, res.breakIndex); @@ -371,7 +371,7 @@ void TestBreakIterator::testWordBoundaries() //See https://bz.apache.org/ooo/show_bug.cgi?id=11993 { - OUString aTest("abcd ef ghi??? KLM"); + OUString aTest(u"abcd ef ghi??? KLM"_ustr); CPPUNIT_ASSERT(!m_xBreak->isBeginWord(aTest, 4, aLocale, i18n::WordType::DICTIONARY_WORD)); CPPUNIT_ASSERT(m_xBreak->isEndWord(aTest, 4, aLocale, i18n::WordType::DICTIONARY_WORD)); @@ -407,7 +407,7 @@ void TestBreakIterator::testWordBoundaries() //See https://bz.apache.org/ooo/show_bug.cgi?id=21907 { - OUString aTest("b a?"); + OUString aTest(u"b a?"_ustr); CPPUNIT_ASSERT(m_xBreak->isBeginWord(aTest, 1, aLocale, i18n::WordType::ANY_WORD)); CPPUNIT_ASSERT(m_xBreak->isBeginWord(aTest, 2, aLocale, i18n::WordType::ANY_WORD)); @@ -621,7 +621,7 @@ void TestBreakIterator::testWordBoundaries() aLocale.Language = "ca"; aLocale.Country = "ES"; - OUString aTest("mirar-se comprar-vos donem-nos les mans aneu-vos-en!"); + OUString aTest(u"mirar-se comprar-vos donem-nos les mans aneu-vos-en!"_ustr); sal_Int32 nPos = 0; sal_Int32 aExpected[] = {8, 20, 30, 34, 39, 51, 52}; @@ -723,7 +723,7 @@ void TestBreakIterator::testWordBoundaries() aLocale.Language = "fi"; aLocale.Country = "FI"; - OUString aTest("Kuorma-auto kaakkois- ja Keski-Suomi USA:n 90:n %:n"); + OUString aTest(u"Kuorma-auto kaakkois- ja Keski-Suomi USA:n 90:n %:n"_ustr); { sal_Int32 nPos = 0; @@ -956,7 +956,7 @@ void TestBreakIterator::testSentenceBoundaries() // Trivial characteristic test for sentence boundary detection { - OUString aTest("This is a sentence. This is a different sentence."); + OUString aTest(u"This is a sentence. This is a different sentence."_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), m_xBreak->beginOfSentence(aTest, 5, aLocale)); CPPUNIT_ASSERT_EQUAL(sal_Int32(19), m_xBreak->endOfSentence(aTest, 5, aLocale)); @@ -967,7 +967,7 @@ void TestBreakIterator::testSentenceBoundaries() // i#24098: i18n API beginOfSentence/endOfSentence // fix beginOfSentence, ... when cursor is on the beginning of the sentence { - OUString aTest("This is a sentence. This is a different sentence."); + OUString aTest(u"This is a sentence. This is a different sentence."_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(20), m_xBreak->beginOfSentence(aTest, 20, aLocale)); CPPUNIT_ASSERT_EQUAL(sal_Int32(49), m_xBreak->endOfSentence(aTest, 20, aLocale)); @@ -976,7 +976,7 @@ void TestBreakIterator::testSentenceBoundaries() // i#24098: i18n API beginOfSentence/endOfSentence // "skip preceding space for beginOfSentence" { - OUString aTest("This is a sentence. This is a different sentence."); + OUString aTest(u"This is a sentence. This is a different sentence."_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), m_xBreak->beginOfSentence(aTest, 20, aLocale)); CPPUNIT_ASSERT_EQUAL(sal_Int32(19), m_xBreak->endOfSentence(aTest, 20, aLocale)); @@ -1447,7 +1447,7 @@ void TestBreakIterator::testJapanese() // fdo#78479 - test second / cached instantiation of xdictionary uno::Reference< i18n::XBreakIterator > xTmpBreak(m_xSFactory->createInstance( - "com.sun.star.i18n.BreakIterator"), uno::UNO_QUERY_THROW); + u"com.sun.star.i18n.BreakIterator"_ustr), uno::UNO_QUERY_THROW); doTestJapanese(xTmpBreak); } @@ -1683,7 +1683,7 @@ void TestBreakIterator::testWordCount() void TestBreakIterator::setUp() { BootstrapFixtureBase::setUp(); - m_xBreak.set(m_xSFactory->createInstance("com.sun.star.i18n.BreakIterator"), uno::UNO_QUERY_THROW); + m_xBreak.set(m_xSFactory->createInstance(u"com.sun.star.i18n.BreakIterator"_ustr), uno::UNO_QUERY_THROW); } void TestBreakIterator::tearDown() diff --git a/i18npool/qa/cppunit/test_characterclassification.cxx b/i18npool/qa/cppunit/test_characterclassification.cxx index 06f6095a376a..580f4d170365 100644 --- a/i18npool/qa/cppunit/test_characterclassification.cxx +++ b/i18npool/qa/cppunit/test_characterclassification.cxx @@ -34,13 +34,13 @@ CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testTitleCase) { //basic example - OUString sTest("Some text"); + OUString sTest(u"Some text"_ustr); OUString sTitleCase = m_xCC->toTitle(sTest, 0, sTest.getLength(), aLocale); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be title", OUString("Some Text"), sTitleCase); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be title", u"Some Text"_ustr, sTitleCase); OUString sUpperCase = m_xCC->toUpper(sTest, 0, sTest.getLength(), aLocale); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", OUString("SOME TEXT"), sUpperCase); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", u"SOME TEXT"_ustr, sUpperCase); OUString sLowerCase = m_xCC->toLower(sTest, 0, sTest.getLength(), aLocale); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower ", OUString("some text"), sLowerCase); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower ", u"some text"_ustr, sLowerCase); } { @@ -67,7 +67,7 @@ CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testStringType) { //simple case - OUString sTest("Some text"); + OUString sTest(u"Some text"_ustr); sal_Int32 nResult = m_xCC->getStringType(sTest, 0, sTest.getLength(), aLocale); CPPUNIT_ASSERT_EQUAL(sal_Int32(230), nResult); } @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testAdlam) void TestCharacterClassification::setUp() { BootstrapFixtureBase::setUp(); - m_xCC.set(m_xSFactory->createInstance("com.sun.star.i18n.CharacterClassification"), uno::UNO_QUERY_THROW); + m_xCC.set(m_xSFactory->createInstance(u"com.sun.star.i18n.CharacterClassification"_ustr), uno::UNO_QUERY_THROW); } void TestCharacterClassification::tearDown() diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index 7e37f1c28ff7..209fb47684f6 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -85,24 +85,24 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero) uno::Reference<text::XNumberingFormatter> xFormatter( text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); // Without the accompanying fix in place, this test would have failed with a // lang.IllegalArgumentException, support for ARABIC_ZERO was missing. - CPPUNIT_ASSERT_EQUAL(OUString("01"), aActual); + CPPUNIT_ASSERT_EQUAL(u"01"_ustr, aActual); // 10 -> "10" aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); - CPPUNIT_ASSERT_EQUAL(OUString("10"), aActual); + CPPUNIT_ASSERT_EQUAL(u"10"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) @@ -111,24 +111,24 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) uno::Reference<text::XNumberingFormatter> xFormatter( text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO3)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); // Without the accompanying fix in place, this test would have failed with a // lang.IllegalArgumentException, support for ARABIC_ZERO3 was missing. - CPPUNIT_ASSERT_EQUAL(OUString("010"), aActual); + CPPUNIT_ASSERT_EQUAL(u"010"_ustr, aActual); // 100 -> "100" aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO3)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(100)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); - CPPUNIT_ASSERT_EQUAL(OUString("100"), aActual); + CPPUNIT_ASSERT_EQUAL(u"100"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) @@ -137,24 +137,24 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) uno::Reference<text::XNumberingFormatter> xFormatter( text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(100)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); // Without the accompanying fix in place, this test would have failed with a // lang.IllegalArgumentException, support for ARABIC_ZERO4 was missing. - CPPUNIT_ASSERT_EQUAL(OUString("0100"), aActual); + CPPUNIT_ASSERT_EQUAL(u"0100"_ustr, aActual); // 1000 -> "1000" aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1000)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1000)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aActual); + CPPUNIT_ASSERT_EQUAL(u"1000"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5) @@ -163,24 +163,24 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5) uno::Reference<text::XNumberingFormatter> xFormatter( text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1000)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1000)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); // Without the accompanying fix in place, this test would have failed with a // lang.IllegalArgumentException, support for ARABIC_ZERO5 was missing. - CPPUNIT_ASSERT_EQUAL(OUString("01000"), aActual); + CPPUNIT_ASSERT_EQUAL(u"01000"_ustr, aActual); // 10000 -> "10000" aProperties = { - comphelper::makePropertyValue("NumberingType", + comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10000)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10000)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); - CPPUNIT_ASSERT_EQUAL(OUString("10000"), aActual); + CPPUNIT_ASSERT_EQUAL(u"10000"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting) @@ -190,8 +190,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting) text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); @@ -202,8 +202,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting) // 10 -> "십" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc2ed"_ustr, aActual); @@ -211,8 +211,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting) // 100 -> "백" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(100)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\ubc31"_ustr, aActual); @@ -225,8 +225,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); @@ -237,8 +237,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 2 -> "둘" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(2)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(2)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\ub458"_ustr, aActual); @@ -246,8 +246,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 3 -> "셋" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(3)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(3)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc14b"_ustr, aActual); @@ -255,8 +255,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 4 -> "넷" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(4)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(4)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\ub137"_ustr, aActual); @@ -264,24 +264,24 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 5 -> "다섯" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(5)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(5)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\ub2e4\uc12f"_ustr, aActual); // 6 -> "여섯 aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(6)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(6)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc5ec\uc12f"_ustr, aActual); // 7 -> "일곱" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(7)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(7)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc77c\uacf1"_ustr, aActual); @@ -289,8 +289,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 8 -> "여덟" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(8)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(8)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc5ec\ub35f"_ustr, aActual); @@ -298,8 +298,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 9 -> "아홉" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(9)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(9)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc544\ud649"_ustr, aActual); @@ -307,8 +307,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 10 -> "열" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc5f4"_ustr, aActual); @@ -316,8 +316,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 21 -> "스물하나" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(21)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(21)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc2a4\ubb3c\ud558\ub098"_ustr, aActual); @@ -325,8 +325,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 32 -> "서른둘" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(32)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(32)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc11c\ub978\ub458"_ustr, aActual); @@ -334,8 +334,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 43 -> "마흔셋" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(43)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(43)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\ub9c8\ud754\uc14b"_ustr, aActual); @@ -343,8 +343,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 54 -> "쉰넷" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(54)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(54)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc270\ub137"_ustr, aActual); @@ -352,8 +352,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 65 -> "예순다섯" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(65)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(65)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc608\uc21c\ub2e4\uc12f"_ustr, aActual); @@ -361,8 +361,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 76 -> "일흔여섯" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(76)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(76)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc77c\ud754\uc5ec\uc12f"_ustr, aActual); @@ -370,8 +370,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 87 -> "여든일곱" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(87)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(87)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc5ec\ub4e0\uc77c\uacf1"_ustr, aActual); @@ -379,8 +379,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 98 -> "아흔여덟" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(98)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(98)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc544\ud754\uc5ec\ub35f"_ustr, aActual); @@ -388,8 +388,8 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) // 99 -> "아흔아홉" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(99)), + u"NumberingType"_ustr, static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(99)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc544\ud754\uc544\ud649"_ustr, aActual); @@ -402,8 +402,9 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital) text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)), + u"NumberingType"_ustr, + static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); @@ -414,8 +415,9 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital) // 10 -> "일영" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)), + u"NumberingType"_ustr, + static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc77c\uc601"_ustr, aActual); @@ -423,8 +425,9 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital) // 100 -> "일영영" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)), + u"NumberingType"_ustr, + static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(100)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\uc77c\uc601\uc601"_ustr, aActual); @@ -437,8 +440,9 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital2) text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)), + u"NumberingType"_ustr, + static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(1)), }; lang::Locale aLocale; OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); @@ -449,8 +453,9 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital2) // 10 -> "一零" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)), + u"NumberingType"_ustr, + static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(10)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\u4e00\u96f6"_ustr, aActual); @@ -458,8 +463,9 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital2) // 100 -> "一零零" aProperties = { comphelper::makePropertyValue( - "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)), - comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)), + u"NumberingType"_ustr, + static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)), + comphelper::makePropertyValue(u"Value"_ustr, static_cast<sal_Int32>(100)), }; aActual = xFormatter->makeNumberingString(aProperties, aLocale); CPPUNIT_ASSERT_EQUAL(u"\u4e00\u96f6\u96f6"_ustr, aActual); diff --git a/i18npool/qa/cppunit/test_ordinalsuffix.cxx b/i18npool/qa/cppunit/test_ordinalsuffix.cxx index be21f38ca531..4868869feffc 100644 --- a/i18npool/qa/cppunit/test_ordinalsuffix.cxx +++ b/i18npool/qa/cppunit/test_ordinalsuffix.cxx @@ -34,7 +34,7 @@ public: void TestOrdinalSuffix::setUp() { BootstrapFixtureBase::setUp(); - m_xOrdinal.set(m_xSFactory->createInstance("com.sun.star.i18n.OrdinalSuffix"), uno::UNO_QUERY_THROW); + m_xOrdinal.set(m_xSFactory->createInstance(u"com.sun.star.i18n.OrdinalSuffix"_ustr), uno::UNO_QUERY_THROW); } void TestOrdinalSuffix::tearDown() @@ -45,36 +45,36 @@ void TestOrdinalSuffix::tearDown() void TestOrdinalSuffix::testFrench() { - lang::Locale aLocale("fr", "LU", ""); + lang::Locale aLocale(u"fr"_ustr, u"LU"_ustr, u""_ustr); //1er uno::Sequence<OUString> aSuffixes = m_xOrdinal->getOrdinalSuffix(1, aLocale); - const OUString* pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), OUString("er")); + const OUString* pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), u"er"_ustr); CPPUNIT_ASSERT(pFind != std::cend(aSuffixes)); //2e, 3e, etc. aSuffixes = m_xOrdinal->getOrdinalSuffix(2, aLocale); - pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), OUString("e")); + pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), u"e"_ustr); CPPUNIT_ASSERT(pFind != std::cend(aSuffixes)); } void TestOrdinalSuffix::testEnglish() { - lang::Locale aLocale("en", "US", ""); + lang::Locale aLocale(u"en"_ustr, u"US"_ustr, u""_ustr); //1st uno::Sequence<OUString> aSuffixes = m_xOrdinal->getOrdinalSuffix(1, aLocale); - const OUString* pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), OUString("st")); + const OUString* pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), u"st"_ustr); CPPUNIT_ASSERT(pFind != std::cend(aSuffixes)); //2nd aSuffixes = m_xOrdinal->getOrdinalSuffix(2, aLocale); - pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), OUString("nd")); + pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), u"nd"_ustr); CPPUNIT_ASSERT(pFind != std::cend(aSuffixes)); //3rd aSuffixes = m_xOrdinal->getOrdinalSuffix(3, aLocale); - pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), OUString("rd")); + pFind = std::find(std::cbegin(aSuffixes), std::cend(aSuffixes), u"rd"_ustr); CPPUNIT_ASSERT(pFind != std::cend(aSuffixes)); } diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 2efb2b9cdc37..269380a90910 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -58,8 +58,8 @@ void TestTextSearch::testICU() UErrorCode nErr = U_ZERO_ERROR; sal_uInt32 nSearchFlags = UREGEX_UWORD | UREGEX_CASE_INSENSITIVE; - OUString aString( "abcdefgh" ); - OUString aPattern( "e" ); + OUString aString( u"abcdefgh"_ustr ); + OUString aPattern( u"e"_ustr ); icu::UnicodeString aSearchPat( reinterpret_cast<const UChar*>(aPattern.getStr()), aPattern.getLength() ); std::unique_ptr<icu::RegexMatcher> pRegexMatcher(new icu::RegexMatcher( aSearchPat, nSearchFlags, nErr )); @@ -74,8 +74,8 @@ void TestTextSearch::testICU() CPPUNIT_ASSERT_EQUAL( static_cast<int32_t>(5), pRegexMatcher->end( nErr ) ); CPPUNIT_ASSERT_EQUAL( U_ZERO_ERROR, nErr ); - OUString aString2( "acababaabcababadcdaa" ); - OUString aPattern2( "a" ); + OUString aString2( u"acababaabcababadcdaa"_ustr ); + OUString aPattern2( u"a"_ustr ); icu::UnicodeString aSearchPat2( reinterpret_cast<const UChar*>(aPattern2.getStr()), aPattern2.getLength() ); pRegexMatcher.reset(new icu::RegexMatcher( aSearchPat2, nSearchFlags, nErr )); @@ -93,7 +93,7 @@ void TestTextSearch::testICU() void TestTextSearch::testSearches() { - OUString str( "acababaabcababadcdaa" ); + OUString str( u"acababaabcababadcdaa"_ustr ); sal_Int32 startPos = 2, endPos = 20 ; sal_Int32 const fStartRes = 10, fEndRes = 18 ; sal_Int32 const bStartRes = 18, bEndRes = 10 ; @@ -123,7 +123,7 @@ void TestTextSearch::testSearches() | TransliterationFlags::IGNORE_WIDTH); aOptions.searchString = "([^ ]*)[ ]*([^ ]*)"; m_xSearch->setOptions(aOptions); - aRes = m_xSearch->searchForward("11 22 33", 2, 7); + aRes = m_xSearch->searchForward(u"11 22 33"_ustr, 2, 7); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), aRes.subRegExpressions); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aRes.startOffset[0]); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aRes.endOffset[0]); @@ -526,8 +526,8 @@ void TestTextSearch::testTdf138410() void TestTextSearch::setUp() { BootstrapFixtureBase::setUp(); - m_xSearch.set(m_xSFactory->createInstance("com.sun.star.util.TextSearch"), uno::UNO_QUERY_THROW); - m_xSearch2.set(m_xSFactory->createInstance("com.sun.star.util.TextSearch2"), uno::UNO_QUERY_THROW); + m_xSearch.set(m_xSFactory->createInstance(u"com.sun.star.util.TextSearch"_ustr), uno::UNO_QUERY_THROW); + m_xSearch2.set(m_xSFactory->createInstance(u"com.sun.star.util.TextSearch2"_ustr), uno::UNO_QUERY_THROW); } void TestTextSearch::tearDown() diff --git a/i18npool/qa/cppunit/transliteration.cxx b/i18npool/qa/cppunit/transliteration.cxx index cc8eccfbb5c2..85a795135833 100644 --- a/i18npool/qa/cppunit/transliteration.cxx +++ b/i18npool/qa/cppunit/transliteration.cxx @@ -165,13 +165,13 @@ public: void testTextToChuyin_zh_TW() { // Verify that loading succeeds: - transliteration_->loadModuleByImplName("TextToChuyin_zh_TW", {}); + transliteration_->loadModuleByImplName(u"TextToChuyin_zh_TW"_ustr, {}); } void testTextToPinyin_zh_CN() { // Verify that loading succeeds: - transliteration_->loadModuleByImplName("TextToPinyin_zh_CN", {}); + transliteration_->loadModuleByImplName(u"TextToPinyin_zh_CN"_ustr, {}); } CPPUNIT_TEST_SUITE(Transliteration); diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 51f191326e5f..0f23a59cc1e9 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -646,12 +646,12 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) // load service with name <base>_<lang> createLocaleSpecificBreakIterator(rLocale.Language)) || // load default service with name <base>_Unicode - createLocaleSpecificBreakIterator("Unicode")) { + createLocaleSpecificBreakIterator(u"Unicode"_ustr)) { lookupTable.emplace_back( aLocale, xBI ); return xBI; } } - throw RuntimeException("getLocaleSpecificBreakIterator: iterator not found"); + throw RuntimeException(u"getLocaleSpecificBreakIterator: iterator not found"_ustr); } OUString SAL_CALL diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index 23706c200594..d674b8649341 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -96,7 +96,7 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( BreakIterator_zh::BreakIterator_zh() { assert(hangingCharacters.pData); - hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("zh", "CN")); + hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE(u"zh"_ustr, u"CN"_ustr)); cBreakIterator = u"com.sun.star.i18n.BreakIterator_zh"_ustr; } @@ -106,7 +106,7 @@ BreakIterator_zh::BreakIterator_zh() BreakIterator_zh_TW::BreakIterator_zh_TW() { assert(hangingCharacters.pData); - hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("zh", "TW")); + hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE(u"zh"_ustr, u"TW"_ustr)); cBreakIterator = u"com.sun.star.i18n.BreakIterator_zh_TW"_ustr; } @@ -116,7 +116,7 @@ BreakIterator_zh_TW::BreakIterator_zh_TW() BreakIterator_ja::BreakIterator_ja() { assert(hangingCharacters.pData); - hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("ja", "JP")); + hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE(u"ja"_ustr, u"JP"_ustr)); cBreakIterator = u"com.sun.star.i18n.BreakIterator_ja"_ustr; } @@ -126,7 +126,7 @@ BreakIterator_ja::BreakIterator_ja() BreakIterator_ko::BreakIterator_ko() { assert(hangingCharacters.pData); - hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE("ko", "KR")); + hangingCharacters = LocaleDataImpl::get()->getHangingCharacters(LOCALE(u"ko"_ustr, u"KR"_ustr)); cBreakIterator = u"com.sun.star.i18n.BreakIterator_ko"_ustr; } diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 952a5d5490c0..9b47c433f296 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -290,7 +290,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal theBIMap.insert( std::make_pair( aBIMapLocaleTypeKey, icuBI->mpValue)); } while (false); if (!icuBI->mpValue || !icuBI->mpValue->mpBreakIterator) { - throw uno::RuntimeException("ICU BreakIterator is not properly initialized"); + throw uno::RuntimeException(u"ICU BreakIterator is not properly initialized"_ustr); } icuBI->maBIMapKey = aBIMapGlobalKey; if (!bInMap) diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 1dde59ef2b55..650629cf69cb 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -37,7 +37,7 @@ CalendarImpl::CalendarImpl() : m_xContext(comphelper::getProcessComponentContext CalendarImpl::CalendarImpl(const Reference< XComponentContext > &rxContext) : m_xContext(rxContext) { if (!m_xContext.is()) - throw RuntimeException("CalendarImpl::CalendarImpl: empty m_xContext"); + throw RuntimeException(u"CalendarImpl::CalendarImpl: empty m_xContext"_ustr); } CalendarImpl::~CalendarImpl() @@ -50,7 +50,7 @@ CalendarImpl::loadDefaultCalendarTZ( const css::lang::Locale& rLocale, const OUS const Sequence< Calendar2 > xC = LocaleDataImpl::get()->getAllCalendars2(rLocale); auto pCal = std::find_if(xC.begin(), xC.end(), [](const Calendar2& rCal) { return rCal.Default; }); if (pCal == xC.end()) - throw RuntimeException("CalendarImpl::loadDefaultCalendarTZ: no default calendar found for this locale"); + throw RuntimeException(u"CalendarImpl::loadDefaultCalendarTZ: no default calendar found for this locale"_ustr); loadCalendarTZ(pCal->Name, rLocale, rTimeZone); } @@ -78,11 +78,11 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale& // check if the calendar is defined in localedata, load gregorian calendar service. const Sequence< Calendar2 > xC = LocaleDataImpl::get()->getAllCalendars2(rLocale); if (std::any_of(xC.begin(), xC.end(), [&uniqueID](const Calendar2& rCal) { return uniqueID == rCal.Name; })) - xI = m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.i18n.Calendar_gregorian", m_xContext); + xI = m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.i18n.Calendar_gregorian"_ustr, m_xContext); } if ( !xI.is() ) - throw RuntimeException("CalendarImpl::loadCalendarTZ: no calendar found for this locale"); + throw RuntimeException(u"CalendarImpl::loadCalendarTZ: no calendar found for this locale"_ustr); xCalendar.set(xI, UNO_QUERY); if (!rTimeZone.isEmpty()) @@ -100,7 +100,7 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale& if ( !xCalendar.is() ) { xCalendar = xOldCalendar; - throw RuntimeException("CalendarImpl::loadCalendarTZ: no calendar found for this locale, should use old one?"); + throw RuntimeException(u"CalendarImpl::loadCalendarTZ: no calendar found for this locale, should use old one?"_ustr); } try @@ -115,14 +115,14 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale& if (!bTimeZone) // The calendar is usable but is not in the expected time zone. - throw RuntimeException("CalendarImpl::loadCalendarTZ: the calendar is usable but is not in the expected time zone"); + throw RuntimeException(u"CalendarImpl::loadCalendarTZ: the calendar is usable but is not in the expected time zone"_ustr); } Calendar2 SAL_CALL CalendarImpl::getLoadedCalendar2() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getLoadedCalendar2: no calendar"); + throw RuntimeException(u"CalendarImpl::getLoadedCalendar2: no calendar"_ustr); return xCalendar->getLoadedCalendar2(); } @@ -130,7 +130,7 @@ CalendarImpl::getLoadedCalendar2() CalendarImpl::getLoadedCalendar() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getLoadedCalendar: no calendar"); + throw RuntimeException(u"CalendarImpl::getLoadedCalendar: no calendar"_ustr); return xCalendar->getLoadedCalendar(); } @@ -148,7 +148,7 @@ void SAL_CALL CalendarImpl::setDateTime( double fTimeInDays ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setDateTime: no calendar"); + throw RuntimeException(u"CalendarImpl::setDateTime: no calendar"_ustr); xCalendar->setDateTime( fTimeInDays ); } @@ -156,7 +156,7 @@ double SAL_CALL CalendarImpl::getDateTime() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getDateTime: no calendar"); + throw RuntimeException(u"CalendarImpl::getDateTime: no calendar"_ustr); return xCalendar->getDateTime(); } @@ -164,7 +164,7 @@ void SAL_CALL CalendarImpl::setLocalDateTime( double fTimeInDays ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setLocalDateTime: no calendar"); + throw RuntimeException(u"CalendarImpl::setLocalDateTime: no calendar"_ustr); xCalendar->setLocalDateTime( fTimeInDays ); } @@ -172,7 +172,7 @@ double SAL_CALL CalendarImpl::getLocalDateTime() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getLocalDateTime: no calendar"); + throw RuntimeException(u"CalendarImpl::getLocalDateTime: no calendar"_ustr); return xCalendar->getLocalDateTime(); } @@ -190,7 +190,7 @@ OUString SAL_CALL CalendarImpl::getUniqueID() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getUniqueID: no calendar"); + throw RuntimeException(u"CalendarImpl::getUniqueID: no calendar"_ustr); return xCalendar->getUniqueID(); } @@ -198,7 +198,7 @@ void SAL_CALL CalendarImpl::setValue( sal_Int16 fieldIndex, sal_Int16 value ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setValue: no calendar"); + throw RuntimeException(u"CalendarImpl::setValue: no calendar"_ustr); xCalendar->setValue( fieldIndex, value ); } @@ -206,7 +206,7 @@ sal_Int16 SAL_CALL CalendarImpl::getValue( sal_Int16 fieldIndex ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getValue: no calendar"); + throw RuntimeException(u"CalendarImpl::getValue: no calendar"_ustr); return xCalendar->getValue( fieldIndex ); } @@ -214,7 +214,7 @@ void SAL_CALL CalendarImpl::addValue( sal_Int16 fieldIndex, sal_Int32 amount ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::addValue: no calendar"); + throw RuntimeException(u"CalendarImpl::addValue: no calendar"_ustr); xCalendar->addValue( fieldIndex, amount); } @@ -222,7 +222,7 @@ sal_Int16 SAL_CALL CalendarImpl::getFirstDayOfWeek() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getFirstDayOfWeek: no calendar"); + throw RuntimeException(u"CalendarImpl::getFirstDayOfWeek: no calendar"_ustr); return xCalendar->getFirstDayOfWeek(); } @@ -230,7 +230,7 @@ void SAL_CALL CalendarImpl::setFirstDayOfWeek( sal_Int16 day ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setFirstDayOfWeek: no calendar"); + throw RuntimeException(u"CalendarImpl::setFirstDayOfWeek: no calendar"_ustr); xCalendar->setFirstDayOfWeek(day); } @@ -238,7 +238,7 @@ void SAL_CALL CalendarImpl::setMinimumNumberOfDaysForFirstWeek( sal_Int16 days ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setMinimumNumberOfDaysForFirstWeek: no calendar"); + throw RuntimeException(u"CalendarImpl::setMinimumNumberOfDaysForFirstWeek: no calendar"_ustr); xCalendar->setMinimumNumberOfDaysForFirstWeek(days); } @@ -246,7 +246,7 @@ sal_Int16 SAL_CALL CalendarImpl::getMinimumNumberOfDaysForFirstWeek() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getMinimumNumberOfDaysForFirstWeek: no calendar"); + throw RuntimeException(u"CalendarImpl::getMinimumNumberOfDaysForFirstWeek: no calendar"_ustr); return xCalendar->getMinimumNumberOfDaysForFirstWeek(); } @@ -255,7 +255,7 @@ OUString SAL_CALL CalendarImpl::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getDisplayName: no calendar"); + throw RuntimeException(u"CalendarImpl::getDisplayName: no calendar"_ustr); return xCalendar->getDisplayName( displayIndex, idx, nameType ); } @@ -263,7 +263,7 @@ sal_Int16 SAL_CALL CalendarImpl::getNumberOfMonthsInYear() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setDisplayName: no calendar"); + throw RuntimeException(u"CalendarImpl::setDisplayName: no calendar"_ustr); return xCalendar->getNumberOfMonthsInYear(); } @@ -272,7 +272,7 @@ sal_Int16 SAL_CALL CalendarImpl::getNumberOfDaysInWeek() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getNumberOfDaysInWeek: no calendar"); + throw RuntimeException(u"CalendarImpl::getNumberOfDaysInWeek: no calendar"_ustr); return xCalendar->getNumberOfDaysInWeek(); } @@ -281,7 +281,7 @@ Sequence< CalendarItem > SAL_CALL CalendarImpl::getDays() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::setNumberOfDaysInWeek: no calendar"); + throw RuntimeException(u"CalendarImpl::setNumberOfDaysInWeek: no calendar"_ustr); return xCalendar->getDays(); } @@ -290,7 +290,7 @@ Sequence< CalendarItem > SAL_CALL CalendarImpl::getMonths() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getMonths: no calendar"); + throw RuntimeException(u"CalendarImpl::getMonths: no calendar"_ustr); return xCalendar->getMonths(); } @@ -299,7 +299,7 @@ Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getDays2() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getDays2: no calendar"); + throw RuntimeException(u"CalendarImpl::getDays2: no calendar"_ustr); return xCalendar->getDays2(); } @@ -308,7 +308,7 @@ Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getMonths2() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getMonths2: no calendar"); + throw RuntimeException(u"CalendarImpl::getMonths2: no calendar"_ustr); return xCalendar->getMonths2(); } @@ -317,7 +317,7 @@ Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getGenitiveMonths2() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getGenitiveMonths2: no calendar"); + throw RuntimeException(u"CalendarImpl::getGenitiveMonths2: no calendar"_ustr); return xCalendar->getGenitiveMonths2(); } @@ -326,7 +326,7 @@ Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getPartitiveMonths2() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getPartitiveMonths2: no calendar"); + throw RuntimeException(u"CalendarImpl::getPartitiveMonths2: no calendar"_ustr); return xCalendar->getPartitiveMonths2(); } @@ -335,7 +335,7 @@ sal_Bool SAL_CALL CalendarImpl::isValid() { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::isValid: no calendar"); + throw RuntimeException(u"CalendarImpl::isValid: no calendar"_ustr); return xCalendar->isValid(); } @@ -343,7 +343,7 @@ OUString SAL_CALL CalendarImpl::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) { if (!xCalendar.is()) - throw RuntimeException("CalendarImpl::getDisplayString: no calendar"); + throw RuntimeException(u"CalendarImpl::getDisplayString: no calendar"_ustr); return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode); } diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 72ac63e30fdb..a6e2febe553e 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -207,7 +207,7 @@ Calendar_hanja::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 { if ( displayIndex == CalendarDisplayIndex::AM_PM ) { // Am/Pm string for Korean Hanja calendar will refer to Japanese locale - css::lang::Locale jaLocale("ja", OUString(), OUString()); + css::lang::Locale jaLocale(u"ja"_ustr, OUString(), OUString()); if (idx == 0) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timeAM; else if (idx == 1) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timePM; else throw RuntimeException(); @@ -227,7 +227,7 @@ Calendar_hanja_yoil::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_ { if ( displayIndex == CalendarDisplayIndex::AM_PM ) { // Am/Pm string for Korean Hanja calendar will refer to Japanese locale - css::lang::Locale jaLocale("ja", OUString(), OUString()); + css::lang::Locale jaLocale(u"ja"_ustr, OUString(), OUString()); if (idx == 0) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timeAM; else if (idx == 1) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timePM; else throw RuntimeException(); diff --git a/i18npool/source/characterclassification/unoscripttypedetector.cxx b/i18npool/source/characterclassification/unoscripttypedetector.cxx index aef7497613ca..673b486d73aa 100644 --- a/i18npool/source/characterclassification/unoscripttypedetector.cxx +++ b/i18npool/source/characterclassification/unoscripttypedetector.cxx @@ -45,19 +45,19 @@ UnoScriptTypeDetector::endOfScriptDirection( const OUString& Text, sal_Int32 nPo sal_Int16 SAL_CALL UnoScriptTypeDetector::getCTLScriptType( const OUString&, sal_Int32 ) { - throw css::uno::RuntimeException("not implemented"); + throw css::uno::RuntimeException(u"not implemented"_ustr); } sal_Int32 SAL_CALL UnoScriptTypeDetector::beginOfCTLScriptType( const OUString&, sal_Int32 ) { - throw css::uno::RuntimeException("not implemented"); + throw css::uno::RuntimeException(u"not implemented"_ustr); } sal_Int32 SAL_CALL UnoScriptTypeDetector::endOfCTLScriptType( const OUString&, sal_Int32 ) { - throw css::uno::RuntimeException("not implemented"); + throw css::uno::RuntimeException(u"not implemented"_ustr); } OUString SAL_CALL diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx index 5e5510587d19..a17d400ac6c1 100644 --- a/i18npool/source/collator/collatorImpl.cxx +++ b/i18npool/source/collator/collatorImpl.cxx @@ -196,7 +196,7 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS if (!bLoaded) { // load default service with name <base>_Unicode - bLoaded = createCollator( rLocale, "Unicode", rSortAlgorithm); + bLoaded = createCollator( rLocale, u"Unicode"_ustr, rSortAlgorithm); if (!bLoaded) { cachedItem.reset(); diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index 589c8ad6e6e9..0ecdae3e8569 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -162,7 +162,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: OUStringBuffer aBuf("get_collator_data_" + rLocale.Language + "_"); if ( rLocale.Language == "zh" ) { OUString func_base = aBuf.makeStringAndClear(); - if (OUString("TW HK MO").indexOf(rLocale.Country) >= 0) + if (u"TW HK MO"_ustr.indexOf(rLocale.Country) >= 0) { func = reinterpret_cast<const sal_uInt8* (*)()>(osl_getFunctionSymbol(hModule, OUString(func_base + "TW_" + rAlgorithm).pData)); @@ -385,7 +385,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: uppercase itself, so we don't have to bother with that. */ icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale), - u"", rAlgorithm.isEmpty() ? OUString("") : "collation=" + rAlgorithm)); + u"", rAlgorithm.isEmpty() ? u""_ustr : "collation=" + rAlgorithm)); // FIXME: apparently we get here in LOKit case only. When the language is Japanese, we pass "ja@collation=phonetic (alphanumeric first)" to ICU // and ICU does not like this (U_ILLEGAL_ARGUMENT_ERROR). Subsequently LOKit crashes, because collator is nullptr. diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 1caca1b3d054..a1630a1cc2bd 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -1166,7 +1166,7 @@ OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index) return OUString(aSupportedTypes[index].cSymbol, strlen(aSupportedTypes[index].cSymbol), RTL_TEXTENCODING_UTF8); else { OUStringBuffer result; - Locale aLocale("en", OUString(), OUString()); + Locale aLocale(u"en"_ustr, OUString(), OUString()); Sequence<beans::PropertyValue> aProperties(2); auto aPropertiesRange = asNonConstRange(aProperties); aPropertiesRange[0].Name = "NumberingType"; @@ -1210,11 +1210,11 @@ DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence( { - {"nodepath", uno::Any(OUString("/org.openoffice.Office.Common/I18N"))} + {"nodepath", uno::Any(u"/org.openoffice.Office.Common/I18N"_ustr)} })); Reference<XInterface> xInterface = xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", aArgs); + u"com.sun.star.configuration.ConfigurationAccess"_ustr, aArgs); xHierarchicalNameAccess.set(xInterface, UNO_QUERY_THROW); } @@ -1233,8 +1233,8 @@ Sequence< sal_Int16 > DefaultNumberingProvider::getSupportedNumberingTypes( ) Sequence< sal_Int16 > aRet(nSupported_NumberingTypes ); sal_Int16* pArray = aRet.getArray(); - bool cjkEnabled = isScriptFlagEnabled("CJK/CJKFont"); - bool ctlEnabled = isScriptFlagEnabled("CTL/CTLFont"); + bool cjkEnabled = isScriptFlagEnabled(u"CJK/CJKFont"_ustr); + bool ctlEnabled = isScriptFlagEnabled(u"CTL/CTLFont"_ustr); for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) { if ( (aSupportedTypes[i].langOption & LANG_ALL) || @@ -1283,7 +1283,7 @@ OUString DefaultNumberingProvider::getNumberingIdentifier( sal_Int16 nNumberingT OUString DefaultNumberingProvider::getImplementationName() { - return "com.sun.star.text.DefaultNumberingProvider"; + return u"com.sun.star.text.DefaultNumberingProvider"_ustr; } sal_Bool DefaultNumberingProvider::supportsService(const OUString& rServiceName) @@ -1293,7 +1293,7 @@ sal_Bool DefaultNumberingProvider::supportsService(const OUString& rServiceName) Sequence< OUString > DefaultNumberingProvider::getSupportedServiceNames() { - Sequence< OUString > aRet { "com.sun.star.text.DefaultNumberingProvider" }; + Sequence< OUString > aRet { u"com.sun.star.text.DefaultNumberingProvider"_ustr }; return aRet; } diff --git a/i18npool/source/indexentry/indexentrysupplier_asian.cxx b/i18npool/source/indexentry/indexentrysupplier_asian.cxx index 97bae784b669..07d08a3bdb37 100644 --- a/i18npool/source/indexentry/indexentrysupplier_asian.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_asian.cxx @@ -47,7 +47,7 @@ IndexEntrySupplier_asian::getIndexCharacter( const OUString& rIndexEntry, sal_uInt32 ch = rIndexEntry.iterateCodePoints(&o3tl::temporary(sal_Int32(0)), 0); const sal_uInt16** (*func)(sal_Int16&)=nullptr; - if ( rLocale.Language == "zh" && OUString( "TW HK MO" ).indexOf(rLocale.Country) >= 0 ) { + if ( rLocale.Language == "zh" && u"TW HK MO"_ustr.indexOf(rLocale.Country) >= 0 ) { if ( rAlgorithm == "radical" ) func = get_indexdata_zh_TW_radical; else if ( rAlgorithm == "stroke" ) @@ -117,7 +117,7 @@ IndexEntrySupplier_asian::getPhoneticCandidate( const OUString& rIndexEntry, { sal_uInt16 const **(*func)(sal_Int16&)=nullptr; if ( rLocale.Language == "zh" ) - func = (OUString("TW HK MO").indexOf(rLocale.Country) >= 0) ? get_zh_zhuyin : get_zh_pinyin; + func = (u"TW HK MO"_ustr.indexOf(rLocale.Country) >= 0) ? get_zh_zhuyin : get_zh_pinyin; else if ( rLocale.Language == "ko" ) func = get_ko_phonetic; diff --git a/i18npool/source/indexentry/indexentrysupplier_default.cxx b/i18npool/source/indexentry/indexentrysupplier_default.cxx index f65ee2843857..f616c041ac71 100644 --- a/i18npool/source/indexentry/indexentrysupplier_default.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_default.cxx @@ -175,7 +175,7 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, std::u16string_view algor LocaleDataImpl::get()->getDefaultIndexAlgorithm(LOCALE_EN)); if (keyStr.isEmpty()) throw RuntimeException( - "Index::makeIndexKeys: No index keys returned by algorithm"); + u"Index::makeIndexKeys: No index keys returned by algorithm"_ustr); } sal_Int16 len = sal::static_int_cast<sal_Int16>( keyStr.getLength() ); @@ -194,8 +194,8 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, std::u16string_view algor switch(curr) { case u'-': { if (key_count <= 0 || i + 1 >= len) - throw RuntimeException("Index::makeIndexKeys: key_count<=0||" - "'-' is the last char of KeyString"); + throw RuntimeException(u"Index::makeIndexKeys: key_count<=0||" + "'-' is the last char of KeyString"_ustr); for (curr = keyStr[++i]; key_count < MAX_KEYS && keys[key_count-1].key < curr; key_count++) { keys[key_count].key = keys[key_count-1].key+1; keys[key_count].desc.clear(); @@ -220,13 +220,13 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, std::u16string_view algor [[fallthrough]]; case u'(': { if (key_count <= 0) - throw RuntimeException("Index::makeIndexKeys: key_count<=0"); + throw RuntimeException(u"Index::makeIndexKeys: key_count<=0"_ustr); sal_Int16 end = i+1; for (; end < len && keyStr[end] != close; end++) ; if (end >= len) // no found - throw RuntimeException("Index::makeIndexKeys: Closing bracket not found"); + throw RuntimeException(u"Index::makeIndexKeys: Closing bracket not found"_ustr); if (close == ')') keys[key_count-1].desc = keyStr.copy(i+1, end-i-1); else { @@ -264,12 +264,12 @@ void Index::init(const lang::Locale &rLocale, const OUString& algorithm) if (!scriptList.hasElements()) { scriptList = LocaleDataImpl::get()->getUnicodeScripts(LOCALE_EN); if (!scriptList.hasElements()) - throw RuntimeException("Index::init: scriptList is empty"); + throw RuntimeException(u"Index::init: scriptList is empty"_ustr); } table_count = sal::static_int_cast<sal_Int16>( scriptList.getLength() ); if (table_count > MAX_TABLES) - throw RuntimeException("Index::init: Length of scriptList is too big"); + throw RuntimeException(u"Index::init: Length of scriptList is too big"_ustr); collator->loadCollatorAlgorithm(algorithm, rLocale, CollatorOptions::CollatorOptions_IGNORE_CASE_ACCENT); sal_Int16 j=0; diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 4aca351fc2c4..ad6be9d12633 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -1577,17 +1577,17 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const // Of course there must be an implementation for new to be added // identifiers.. see data/locale.dtd std::map< OUString, bool > aCalendars; - aCalendars["buddhist"] = false; - aCalendars["gengou"] = false; - aCalendars["gregorian"] = false; - aCalendars["hanja"] = false; - aCalendars["hanja_yoil"] = false; - aCalendars["hijri"] = false; - aCalendars["jewish"] = false; - aCalendars["ROC"] = false; + aCalendars[u"buddhist"_ustr] = false; + aCalendars[u"gengou"_ustr] = false; + aCalendars[u"gregorian"_ustr] = false; + aCalendars[u"hanja"_ustr] = false; + aCalendars[u"hanja_yoil"_ustr] = false; + aCalendars[u"hijri"_ustr] = false; + aCalendars[u"jewish"_ustr] = false; + aCalendars[u"ROC"_ustr] = false; // Not in ODF: - aCalendars["dangi"] = false; - aCalendars["persian"] = false; + aCalendars[u"dangi"_ustr] = false; + aCalendars[u"persian"_ustr] = false; sal_Int16 j; sal_Int16 i; diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 7f59dabda5fb..750e2c2bb844 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -670,7 +670,7 @@ Sequence< CalendarItem2 > &LocaleDataImpl::getCalendarItemByName(const OUString& ref_cal = *pCal; else { // Referred locale not found, return name for en_US locale. - cals = getAllCalendars2( Locale("en", "US", OUString()) ); + cals = getAllCalendars2( Locale(u"en"_ustr, u"US"_ustr, OUString()) ); if (!cals.hasElements()) throw RuntimeException(); ref_cal = cals.getConstArray()[0]; @@ -1433,7 +1433,7 @@ oslGenericFunction LocaleDataImpl::getFunctionSymbol( const Locale& rLocale, con if (!pSymbol) { // load default function with name <func>_en_US - pSymbol = rLookupTable.getFunctionSymbolByName("en_US", pFunction, oCachedItem); + pSymbol = rLookupTable.getFunctionSymbolByName(u"en_US"_ustr, pFunction, oCachedItem); } if (!pSymbol) diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx index 4f6051445f6a..2c959d0648bf 100644 --- a/i18npool/source/localedata/saxparser.cxx +++ b/i18npool/source/localedata/saxparser.cxx @@ -164,7 +164,7 @@ public: // Error handler ++nError; printf( "Error !\n" ); throw SAXException( - "error from error handler", + u"error from error handler"_ustr, Reference < XInterface >() , aSAXParseException ); } diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx index 5562c301a300..2d63baf29fbd 100644 --- a/i18npool/source/numberformatcode/numberformatcode.cxx +++ b/i18npool/source/numberformatcode/numberformatcode.cxx @@ -165,11 +165,11 @@ NumberFormatCodeMapper::mapElementTypeShortToString(sal_Int16 formatType) switch ( formatType ) { case css::i18n::KNumberFormatType::SHORT : - return "short"; + return u"short"_ustr; case css::i18n::KNumberFormatType::MEDIUM : - return "medium"; + return u"medium"_ustr; case css::i18n::KNumberFormatType::LONG : - return "long"; + return u"long"_ustr; } return OUString(); } @@ -193,21 +193,21 @@ NumberFormatCodeMapper::mapElementUsageShortToString(sal_Int16 formatUsage) switch ( formatUsage ) { case css::i18n::KNumberFormatUsage::DATE : - return "DATE"; + return u"DATE"_ustr; case css::i18n::KNumberFormatUsage::TIME : - return "TIME"; + return u"TIME"_ustr; case css::i18n::KNumberFormatUsage::DATE_TIME : - return "DATE_TIME"; + return u"DATE_TIME"_ustr; case css::i18n::KNumberFormatUsage::FIXED_NUMBER : - return "FIXED_NUMBER"; + return u"FIXED_NUMBER"_ustr; case css::i18n::KNumberFormatUsage::FRACTION_NUMBER : - return "FRACTION_NUMBER"; + return u"FRACTION_NUMBER"_ustr; case css::i18n::KNumberFormatUsage::PERCENT_NUMBER : - return "PERCENT_NUMBER"; + return u"PERCENT_NUMBER"_ustr; case css::i18n::KNumberFormatUsage::CURRENCY : - return "CURRENCY"; + return u"CURRENCY"_ustr; case css::i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER : - return "SCIENTIFIC_NUMBER"; + return u"SCIENTIFIC_NUMBER"_ustr; } return OUString(); } diff --git a/i18npool/source/textconversion/textconversionImpl.cxx b/i18npool/source/textconversion/textconversionImpl.cxx index af5bb288fe45..6f30a990b8dc 100644 --- a/i18npool/source/textconversion/textconversionImpl.cxx +++ b/i18npool/source/textconversion/textconversionImpl.cxx @@ -79,7 +79,7 @@ TextConversionImpl::getLocaleSpecificTextConversion(const Locale& rLocale) if (rLocale != aLocale) { aLocale = rLocale; - OUString aPrefix("com.sun.star.i18n.TextConversion_"); + OUString aPrefix(u"com.sun.star.i18n.TextConversion_"_ustr); Reference < XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext( aPrefix + LocaleDataImpl::getFirstLocaleServiceName( aLocale), m_xContext); if (!xI.is()) diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx index c68c66a38cd4..19a4f07de2f9 100644 --- a/i18npool/source/textconversion/textconversion_ko.cxx +++ b/i18npool/source/textconversion/textconversion_ko.cxx @@ -45,7 +45,7 @@ TextConversion_ko::TextConversion_ko( const Reference < XComponentContext >& xCo : TextConversionService("com.sun.star.i18n.TextConversion_ko") { Reference < XInterface > xI = xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.i18n.ConversionDictionary_ko", xContext); + u"com.sun.star.i18n.ConversionDictionary_ko"_ustr, xContext); if ( xI.is() ) xCD.set( xI, UNO_QUERY ); @@ -56,7 +56,7 @@ TextConversion_ko::TextConversion_ko( const Reference < XComponentContext >& xCo // get maximum length of word in dictionary if (xCDL.is()) { - Locale loc("ko", "KR", OUString()); + Locale loc(u"ko"_ustr, u"KR"_ustr, OUString()); maxLeftLength = xCDL->queryMaxCharCount(loc, ConversionDictionaryType::HANGUL_HANJA, ConversionDirection_FROM_LEFT); diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index c5b6d9cf5cce..6224fa014d5b 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -184,7 +184,7 @@ TransliterationImpl::getName() if (numCascade == 1 && bodyCascade[0].is()) return bodyCascade[0]->getName(); if (numCascade < 1) - return ( OUString("Not Loaded")); + return ( u"Not Loaded"_ustr); throw RuntimeException(); } |