diff options
37 files changed, 573 insertions, 575 deletions
diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx index b17edc2ba3da..26b04a6cc9af 100644 --- a/UnoControls/source/controls/OConnectionPointHelper.cxx +++ b/UnoControls/source/controls/OConnectionPointHelper.cxx @@ -101,7 +101,7 @@ Type SAL_CALL OConnectionPointHelper::getConnectionType() // Set default return value, if method failed. if ( !impl_LockContainer() ) { - throw RuntimeException("Container does not exist!"); + throw RuntimeException(u"Container does not exist!"_ustr); } // If container reference valid, return right type of supported interfaces of THIS connectionpoint. @@ -144,7 +144,7 @@ void SAL_CALL OConnectionPointHelper::advise( const Reference< XInterface >& xLi // Operation is permitted only, if reference to container is valid! if ( !impl_LockContainer() ) { - throw RuntimeException("Container does not exist!"); + throw RuntimeException(u"Container does not exist!"_ustr); } // Forward it to OConnectionPointHelperContainer! m_pContainerImplementation->advise( m_aInterfaceType, xListener ); @@ -161,7 +161,7 @@ void SAL_CALL OConnectionPointHelper::unadvise( const Reference< XInterface >& x // Operation is permitted only, if reference to container is valid! if ( !impl_LockContainer() ) { - throw RuntimeException("Container does not exist!"); + throw RuntimeException(u"Container does not exist!"_ustr); } // Forward it to OConnectionPointHelperContainer! @@ -179,7 +179,7 @@ Sequence< Reference< XInterface > > SAL_CALL OConnectionPointHelper::getConnecti // Operation is permitted only, if reference to container is valid! if ( !impl_LockContainer() ) { - throw RuntimeException("Container does not exist!"); + throw RuntimeException(u"Container does not exist!"_ustr); } // Set default return value, if method failed. Sequence< Reference< XInterface > > seqReturnConnections; diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx index ab841d906fde..6b12862d734b 100644 --- a/UnoControls/source/controls/framecontrol.cxx +++ b/UnoControls/source/controls/framecontrol.cxx @@ -126,12 +126,12 @@ Sequence< Type > SAL_CALL FrameControl::getTypes() OUString FrameControl::getImplementationName() { - return "stardiv.UnoControls.FrameControl"; + return u"stardiv.UnoControls.FrameControl"_ustr; } css::uno::Sequence<OUString> FrameControl::getSupportedServiceNames() { - return { "com.sun.star.frame.FrameControl" }; + return { u"com.sun.star.frame.FrameControl"_ustr }; } // XControl @@ -323,11 +323,11 @@ IPropertyArrayHelper& FrameControl::getInfoHelper() // attention: properties need to be sorted by name! static OPropertyArrayHelper ourPropertyInfo( { - Property( "ComponentUrl", PropertyHandle::Componenturl, cppu::UnoType<OUString>::get(), + Property( u"ComponentUrl"_ustr, PropertyHandle::Componenturl, cppu::UnoType<OUString>::get(), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ), - Property( "Frame", PropertyHandle::Frame, cppu::UnoType<XFrame>::get(), + Property( u"Frame"_ustr, PropertyHandle::Frame, cppu::UnoType<XFrame>::get(), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT ), - Property( "LoaderArguments", PropertyHandle::Loaderarguments, cppu::UnoType<Sequence<PropertyValue>>::get(), + Property( u"LoaderArguments"_ustr, PropertyHandle::Loaderarguments, cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ) }, true ); diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx index d35b5f99b191..9301c2494106 100644 --- a/UnoControls/source/controls/statusindicator.cxx +++ b/UnoControls/source/controls/statusindicator.cxx @@ -65,7 +65,7 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext > m_xProgressBar->setVisible( true ); // Reset to defaults !!! // (progressbar take automatically its own defaults) - m_xText->setText( "" ); + m_xText->setText( u""_ustr ); osl_atomic_decrement(&m_refCount); } diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx index 5172fbb17b8f..334adf58fb49 100644 --- a/comphelper/source/property/propertysethelper.cxx +++ b/comphelper/source/property/propertysethelper.cxx @@ -112,7 +112,7 @@ void SAL_CALL PropertySetHelper::setPropertyValues( const Sequence< OUString >& const sal_Int32 nCount = rPropertyNames.getLength(); if( nCount != rValues.getLength() ) - throw IllegalArgumentException("lengths do not match", static_cast<XPropertySet*>(this), -1); + throw IllegalArgumentException(u"lengths do not match"_ustr, static_cast<XPropertySet*>(this), -1); if( !nCount ) return; diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index ea49739b9a5a..75ea128c44e4 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -177,12 +177,12 @@ static Reference< XInterface > loadComponent( if (aExt == u"dll" || aExt == u"exe" || aExt == u"dylib" || aExt == u"so") { createInstance( - xLoader, xContext, "com.sun.star.loader.SharedLibrary" ); + xLoader, xContext, u"com.sun.star.loader.SharedLibrary"_ustr ); } else if (aExt == u"jar" || aExt == u"class") { createInstance( - xLoader, xContext, "com.sun.star.loader.Java" ); + xLoader, xContext, u"com.sun.star.loader.Java"_ustr ); } else { @@ -404,18 +404,18 @@ SAL_IMPLEMENT_MAIN() } if (!(aImplName.isEmpty() || aServiceName.isEmpty())) - throw RuntimeException("give component exOR service name!" ); + throw RuntimeException(u"give component exOR service name!"_ustr ); if (aImplName.isEmpty() && aServiceName.isEmpty()) { if (! aUnoUrl.endsWithIgnoreAsciiCase( ";uno.ComponentContext" )) throw RuntimeException( - "expected UNO-URL with instance name uno.ComponentContext!" ); + u"expected UNO-URL with instance name uno.ComponentContext!"_ustr ); if (bSingleInstance) throw RuntimeException( - "unexpected option --singleinstance!" ); + u"unexpected option --singleinstance!"_ustr ); } if (!aImplName.isEmpty() && aLocation.isEmpty()) - throw RuntimeException("give component location!" ); + throw RuntimeException(u"give component location!"_ustr ); if (!aServiceName.isEmpty() && !aLocation.isEmpty()) out( "\n> warning: service name given, will ignore location!" ); @@ -437,7 +437,7 @@ SAL_IMPLEMENT_MAIN() { if (aUnoUrl.getLength() < 10 || !aUnoUrl.startsWithIgnoreAsciiCase( "uno:" )) { - throw RuntimeException("illegal uno url given!" ); + throw RuntimeException(u"illegal uno url given!"_ustr ); } sal_Int32 nIndex = 4; // skip initial "uno:" @@ -451,7 +451,7 @@ SAL_IMPLEMENT_MAIN() // Exactly 3 tokens are required if (bTooFewTokens || nIndex>0) { - throw RuntimeException("illegal uno url given!" ); + throw RuntimeException(u"illegal uno url given!"_ustr ); } Reference< XAcceptor > xAcceptor = Acceptor::create(xContext); @@ -482,7 +482,7 @@ SAL_IMPLEMENT_MAIN() Reference< XBridgeFactory > xBridgeFactory; createInstance( xBridgeFactory, xContext, - "com.sun.star.bridge.BridgeFactory" ); + u"com.sun.star.bridge.BridgeFactory"_ustr ); // bridge Reference< XBridge > xBridge( xBridgeFactory->createBridge( @@ -520,7 +520,7 @@ SAL_IMPLEMENT_MAIN() Reference< XComponent > xComp( xInstance, UNO_QUERY ); if (xComp.is()) xComp->dispose(); - throw RuntimeException( "component does not export interface \"com.sun.star.lang.XMain\"!" ); + throw RuntimeException( u"component does not export interface \"com.sun.star.lang.XMain\"!"_ustr ); } } } diff --git a/docmodel/source/theme/Theme.cxx b/docmodel/source/theme/Theme.cxx index d4095eeb3ebd..364b25fc7187 100644 --- a/docmodel/source/theme/Theme.cxx +++ b/docmodel/source/theme/Theme.cxx @@ -60,7 +60,7 @@ void Theme::dumpAsXml(xmlTextWriterPtr pWriter) const void Theme::ToAny(uno::Any& rVal) const { comphelper::SequenceAsHashMap aMap; - aMap["Name"] <<= maName; + aMap[u"Name"_ustr] <<= maName; if (mpColorSet) { @@ -74,8 +74,8 @@ void Theme::ToAny(uno::Any& rVal) const } } - aMap["ColorSchemeName"] <<= mpColorSet->getName(); - aMap["ColorScheme"] <<= comphelper::containerToSequence(aColorScheme); + aMap[u"ColorSchemeName"_ustr] <<= mpColorSet->getName(); + aMap[u"ColorScheme"_ustr] <<= comphelper::containerToSequence(aColorScheme); } rVal <<= aMap.getAsConstPropertyValueList(); @@ -87,7 +87,7 @@ std::unique_ptr<Theme> Theme::FromAny(const uno::Any& rVal) std::unique_ptr<Theme> pTheme; std::shared_ptr<model::ColorSet> pColorSet; - auto it = aMap.find("Name"); + auto it = aMap.find(u"Name"_ustr); if (it != aMap.end()) { OUString aName; @@ -95,7 +95,7 @@ std::unique_ptr<Theme> Theme::FromAny(const uno::Any& rVal) pTheme = std::make_unique<Theme>(aName); } - it = aMap.find("ColorSchemeName"); + it = aMap.find(u"ColorSchemeName"_ustr); if (it != aMap.end() && pTheme) { OUString aName; @@ -104,7 +104,7 @@ std::unique_ptr<Theme> Theme::FromAny(const uno::Any& rVal) pTheme->setColorSet(pColorSet); } - it = aMap.find("ColorScheme"); + it = aMap.find(u"ColorScheme"_ustr); if (it != aMap.end() && pColorSet) { uno::Sequence<util::Color> aColors; diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index c47a933f061a..1ced171df9d3 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -278,7 +278,7 @@ EventAttacherImpl::EventAttacherImpl( const Reference< XComponentContext >& rxCo /// @throws Exception OUString SAL_CALL EventAttacherImpl::getImplementationName( ) { - return "com.sun.star.comp.EventAttacher"; + return u"com.sun.star.comp.EventAttacher"_ustr; } sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceName ) @@ -288,7 +288,7 @@ sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceNam Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames( ) { - return { "com.sun.star.script.EventAttacher" }; + return { u"com.sun.star.script.EventAttacher"_ustr }; } void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx index 5b269d209da9..4d575984a7f8 100644 --- a/i18nlangtag/qa/cppunit/test_languagetag.cxx +++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx @@ -48,27 +48,27 @@ public: void TestLanguageTag::testAllTags() { { - LanguageTag de_DE( "de-Latn-DE", true ); + LanguageTag de_DE( u"de-Latn-DE"_ustr, true ); OUString aBcp47 = de_DE.getBcp47(); lang::Locale aLocale = de_DE.getLocale(); LanguageType nLanguageType = de_DE.getLanguageType(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Default script should be stripped after canonicalize.", OUString("de-DE"), aBcp47 ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default script should be stripped after canonicalize.", u"de-DE"_ustr, aBcp47 ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, nLanguageType ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), de_DE.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_DE.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, de_DE.getCountry() ); CPPUNIT_ASSERT( de_DE.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE.getLanguageAndScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE.makeFallback().getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_DE.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, de_DE.makeFallback().getBcp47() ); } { - LanguageTag klingon( "i-klingon", true ); + LanguageTag klingon( u"i-klingon"_ustr, true ); lang::Locale aLocale = klingon.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("tlh"), klingon.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("tlh"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"tlh"_ustr, klingon.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"tlh"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT( klingon.isValidBcp47() ); @@ -76,16 +76,16 @@ void TestLanguageTag::testAllTags() CPPUNIT_ASSERT( klingon.isIsoODF() ); LanguageType nLang = klingon.getLanguageType(); LanguageTag klingon_id( nLang); - CPPUNIT_ASSERT_EQUAL( OUString("tlh"), klingon_id.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"tlh"_ustr, klingon_id.getBcp47() ); } { - OUString s_sr_RS( "sr-RS" ); + OUString s_sr_RS( u"sr-RS"_ustr ); LanguageTag sr_RS( s_sr_RS, true ); lang::Locale aLocale = sr_RS.getLocale(); CPPUNIT_ASSERT_EQUAL( s_sr_RS, sr_RS.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"sr"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"RS"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA, sr_RS.getLanguageType() ); CPPUNIT_ASSERT( sr_RS.isValidBcp47() ); @@ -94,79 +94,79 @@ void TestLanguageTag::testAllTags() } { - OUString s_sr_Latn_RS( "sr-Latn-RS" ); + OUString s_sr_Latn_RS( u"sr-Latn-RS"_ustr ); LanguageTag sr_RS( s_sr_Latn_RS, true ); lang::Locale aLocale = sr_RS.getLocale(); CPPUNIT_ASSERT_EQUAL( s_sr_Latn_RS, sr_RS.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"RS"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_sr_Latn_RS, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA, sr_RS.getLanguageType() ); CPPUNIT_ASSERT( sr_RS.isValidBcp47() ); CPPUNIT_ASSERT( !sr_RS.isIsoLocale() ); CPPUNIT_ASSERT( sr_RS.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr"), sr_RS.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("RS"), sr_RS.getCountry() ); - CPPUNIT_ASSERT_EQUAL( OUString("Latn"), sr_RS.getScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sr_RS.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"sr"_ustr, sr_RS.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"RS"_ustr, sr_RS.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"Latn"_ustr, sr_RS.getScript() ); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn"_ustr, sr_RS.getLanguageAndScript() ); } { - OUString s_sr_Latn_CS( "sr-Latn-CS" ); + OUString s_sr_Latn_CS( u"sr-Latn-CS"_ustr ); LanguageTag sr_Latn_CS( s_sr_Latn_CS, true ); lang::Locale aLocale = sr_Latn_CS.getLocale(); CPPUNIT_ASSERT_EQUAL( s_sr_Latn_CS, sr_Latn_CS.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("CS"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"CS"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_sr_Latn_CS, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_SERBIAN_LATIN_SAM, sr_Latn_CS.getLanguageType() ); CPPUNIT_ASSERT( sr_Latn_CS.isValidBcp47() ); CPPUNIT_ASSERT( !sr_Latn_CS.isIsoLocale() ); CPPUNIT_ASSERT( sr_Latn_CS.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr"), sr_Latn_CS.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("CS"), sr_Latn_CS.getCountry() ); - CPPUNIT_ASSERT_EQUAL( OUString("Latn"), sr_Latn_CS.getScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sr_Latn_CS.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"sr"_ustr, sr_Latn_CS.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"CS"_ustr, sr_Latn_CS.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"Latn"_ustr, sr_Latn_CS.getScript() ); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn"_ustr, sr_Latn_CS.getLanguageAndScript() ); ::std::vector< OUString > sr_Latn_CS_Fallbacks( sr_Latn_CS.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(9), sr_Latn_CS_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-CS"), sr_Latn_CS_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-YU"), sr_Latn_CS_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("sh-CS"), sr_Latn_CS_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("sh-YU"), sr_Latn_CS_Fallbacks[3]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sr_Latn_CS_Fallbacks[4]); - CPPUNIT_ASSERT_EQUAL( OUString("sh"), sr_Latn_CS_Fallbacks[5]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-CS"), sr_Latn_CS_Fallbacks[6]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-YU"), sr_Latn_CS_Fallbacks[7]); - CPPUNIT_ASSERT_EQUAL( OUString("sr"), sr_Latn_CS_Fallbacks[8]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-CS"), sr_Latn_CS.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-CS"_ustr, sr_Latn_CS_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-YU"_ustr, sr_Latn_CS_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"sh-CS"_ustr, sr_Latn_CS_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"sh-YU"_ustr, sr_Latn_CS_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn"_ustr, sr_Latn_CS_Fallbacks[4]); + CPPUNIT_ASSERT_EQUAL( u"sh"_ustr, sr_Latn_CS_Fallbacks[5]); + CPPUNIT_ASSERT_EQUAL( u"sr-CS"_ustr, sr_Latn_CS_Fallbacks[6]); + CPPUNIT_ASSERT_EQUAL( u"sr-YU"_ustr, sr_Latn_CS_Fallbacks[7]); + CPPUNIT_ASSERT_EQUAL( u"sr"_ustr, sr_Latn_CS_Fallbacks[8]); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-CS"_ustr, sr_Latn_CS.makeFallback().getBcp47()); } // 'sh-RS' has an internal override to 'sr-Latn-RS' { - LanguageTag sh_RS( "sh-RS", true ); + LanguageTag sh_RS( u"sh-RS"_ustr, true ); lang::Locale aLocale = sh_RS.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-RS"_ustr, sh_RS.getBcp47() ); CPPUNIT_ASSERT_EQUAL( I18NLANGTAG_QLT , aLocale.Language); - CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale.Country ); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), aLocale.Variant ); + CPPUNIT_ASSERT_EQUAL( u"RS"_ustr, aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-RS"_ustr, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA, sh_RS.getLanguageType() ); CPPUNIT_ASSERT( sh_RS.isValidBcp47() ); CPPUNIT_ASSERT( !sh_RS.isIsoLocale() ); CPPUNIT_ASSERT( sh_RS.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr"), sh_RS.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("RS"), sh_RS.getCountry() ); - CPPUNIT_ASSERT_EQUAL( OUString("Latn"), sh_RS.getScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sh_RS.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"sr"_ustr, sh_RS.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"RS"_ustr, sh_RS.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"Latn"_ustr, sh_RS.getScript() ); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn"_ustr, sh_RS.getLanguageAndScript() ); ::std::vector< OUString > sh_RS_Fallbacks( sh_RS.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(6), sh_RS_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("sh-RS"), sh_RS_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sh_RS_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("sh"), sh_RS_Fallbacks[3]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-RS"), sh_RS_Fallbacks[4]); - CPPUNIT_ASSERT_EQUAL( OUString("sr"), sh_RS_Fallbacks[5]); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS.makeFallback().getBcp47()); - CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS.getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-RS"_ustr, sh_RS_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"sh-RS"_ustr, sh_RS_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn"_ustr, sh_RS_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"sh"_ustr, sh_RS_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"sr-RS"_ustr, sh_RS_Fallbacks[4]); + CPPUNIT_ASSERT_EQUAL( u"sr"_ustr, sh_RS_Fallbacks[5]); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-RS"_ustr, sh_RS.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"sr-Latn-RS"_ustr, sh_RS.getBcp47()); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA, sh_RS.getLanguageType() ); } @@ -174,134 +174,134 @@ void TestLanguageTag::testAllTags() // known LangID with an override and canonicalization should work the same // without liblangtag. { - LanguageTag bs_Latn_BA( "bs-Latn-BA", true ); + LanguageTag bs_Latn_BA( u"bs-Latn-BA"_ustr, true ); lang::Locale aLocale = bs_Latn_BA.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("bs"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("BA"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"bs-BA"_ustr, bs_Latn_BA.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"bs"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"BA"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA, bs_Latn_BA.getLanguageType() ); CPPUNIT_ASSERT( bs_Latn_BA.isValidBcp47() ); CPPUNIT_ASSERT( bs_Latn_BA.isIsoLocale() ); CPPUNIT_ASSERT( bs_Latn_BA.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("BA"), bs_Latn_BA.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"bs"_ustr, bs_Latn_BA.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"BA"_ustr, bs_Latn_BA.getCountry() ); CPPUNIT_ASSERT( bs_Latn_BA.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"bs"_ustr, bs_Latn_BA.getLanguageAndScript() ); ::std::vector< OUString > bs_Latn_BA_Fallbacks( bs_Latn_BA.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), bs_Latn_BA_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA.makeFallback().getBcp47()); - CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA.getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"bs-BA"_ustr, bs_Latn_BA_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"bs"_ustr, bs_Latn_BA_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"bs-BA"_ustr, bs_Latn_BA.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"bs-BA"_ustr, bs_Latn_BA.getBcp47()); CPPUNIT_ASSERT_EQUAL( LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA, bs_Latn_BA.getLanguageType() ); } { - OUString s_ca_ES_valencia( "ca-ES-valencia" ); + OUString s_ca_ES_valencia( u"ca-ES-valencia"_ustr ); LanguageTag ca_ES_valencia( s_ca_ES_valencia, true ); lang::Locale aLocale = ca_ES_valencia.getLocale(); CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia, ca_ES_valencia.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"ES"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_CATALAN_VALENCIAN, ca_ES_valencia.getLanguageType() ); CPPUNIT_ASSERT( ca_ES_valencia.isValidBcp47() ); CPPUNIT_ASSERT( !ca_ES_valencia.isIsoLocale() ); CPPUNIT_ASSERT( !ca_ES_valencia.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_ES_valencia.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("ES"), ca_ES_valencia.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_ES_valencia.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"ES"_ustr, ca_ES_valencia.getCountry() ); CPPUNIT_ASSERT( ca_ES_valencia.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_ES_valencia.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_ES_valencia.getLanguageAndScript() ); ::std::vector< OUString > ca_ES_valencia_Fallbacks( ca_ES_valencia.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), ca_ES_valencia_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_ES_valencia_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-XV"), ca_ES_valencia_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-valencia"), ca_ES_valencia_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES"), ca_ES_valencia_Fallbacks[3]); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_ES_valencia_Fallbacks[4]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_ES_valencia.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"ca-ES-valencia"_ustr, ca_ES_valencia_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"ca-XV"_ustr, ca_ES_valencia_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"ca-valencia"_ustr, ca_ES_valencia_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"ca-ES"_ustr, ca_ES_valencia_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_ES_valencia_Fallbacks[4]); + CPPUNIT_ASSERT_EQUAL( u"ca-ES-valencia"_ustr, ca_ES_valencia.makeFallback().getBcp47()); } { - OUString s_ca_valencia( "ca-valencia" ); + OUString s_ca_valencia( u"ca-valencia"_ustr ); LanguageTag ca_valencia( s_ca_valencia, true ); lang::Locale aLocale = ca_valencia.getLocale(); CPPUNIT_ASSERT_EQUAL( s_ca_valencia, ca_valencia.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT_EQUAL( s_ca_valencia, aLocale.Variant ); CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( ca_valencia.getLanguageType()) ); CPPUNIT_ASSERT( ca_valencia.isValidBcp47() ); CPPUNIT_ASSERT( !ca_valencia.isIsoLocale() ); CPPUNIT_ASSERT( !ca_valencia.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_valencia.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_valencia.getLanguage() ); CPPUNIT_ASSERT( ca_valencia.getCountry().isEmpty() ); CPPUNIT_ASSERT( ca_valencia.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_valencia.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_valencia.getLanguageAndScript() ); ::std::vector< OUString > ca_valencia_Fallbacks( ca_valencia.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), ca_valencia_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("ca-valencia"), ca_valencia_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_valencia_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_valencia.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"ca-valencia"_ustr, ca_valencia_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_valencia_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"ca-ES-valencia"_ustr, ca_valencia.makeFallback().getBcp47()); } // 'ca-XV' has an internal override to 'ca-ES-valencia' { - OUString s_ca_ES_valencia( "ca-ES-valencia" ); - LanguageTag ca_XV( "ca-XV", true ); + OUString s_ca_ES_valencia( u"ca-ES-valencia"_ustr ); + LanguageTag ca_XV( u"ca-XV"_ustr, true ); lang::Locale aLocale = ca_XV.getLocale(); CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia, ca_XV.getBcp47() ); CPPUNIT_ASSERT_EQUAL( I18NLANGTAG_QLT , aLocale.Language); - CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"ES"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_CATALAN_VALENCIAN, ca_XV.getLanguageType() ); CPPUNIT_ASSERT( ca_XV.isValidBcp47() ); CPPUNIT_ASSERT( !ca_XV.isIsoLocale() ); CPPUNIT_ASSERT( !ca_XV.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_XV.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("ES"), ca_XV.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_XV.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"ES"_ustr, ca_XV.getCountry() ); CPPUNIT_ASSERT( ca_XV.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_XV.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_XV.getLanguageAndScript() ); ::std::vector< OUString > ca_XV_Fallbacks( ca_XV.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), ca_XV_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_XV_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-XV"), ca_XV_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-valencia"), ca_XV_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES"), ca_XV_Fallbacks[3]); - CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_XV_Fallbacks[4]); - CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_XV.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"ca-ES-valencia"_ustr, ca_XV_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"ca-XV"_ustr, ca_XV_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"ca-valencia"_ustr, ca_XV_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"ca-ES"_ustr, ca_XV_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"ca"_ustr, ca_XV_Fallbacks[4]); + CPPUNIT_ASSERT_EQUAL( u"ca-ES-valencia"_ustr, ca_XV.makeFallback().getBcp47()); } { - OUString s_de_DE( "de-DE" ); + OUString s_de_DE( u"de-DE"_ustr ); LanguageTag de_DE( s_de_DE, true ); lang::Locale aLocale = de_DE.getLocale(); CPPUNIT_ASSERT_EQUAL( s_de_DE, de_DE.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, de_DE.getLanguageType() ); CPPUNIT_ASSERT( de_DE.isValidBcp47() ); CPPUNIT_ASSERT( de_DE.isIsoLocale() ); CPPUNIT_ASSERT( de_DE.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), de_DE.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_DE.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, de_DE.getCountry() ); CPPUNIT_ASSERT( de_DE.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_DE.getLanguageAndScript() ); ::std::vector< OUString > de_DE_Fallbacks( de_DE.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), de_DE_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, de_DE_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_DE_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, de_DE.makeFallback().getBcp47()); } { - LanguageTag de_DE( lang::Locale( "de", "DE", "" ) ); + LanguageTag de_DE( lang::Locale( u"de"_ustr, u"DE"_ustr, u""_ustr ) ); lang::Locale aLocale = de_DE.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, de_DE.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, de_DE.getLanguageType() ); } @@ -309,26 +309,26 @@ void TestLanguageTag::testAllTags() { LanguageTag de_DE( LANGUAGE_GERMAN ); lang::Locale aLocale = de_DE.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, de_DE.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, de_DE.getLanguageType() ); } // Unmapped but known language-only. { - OUString s_de( "de" ); + OUString s_de( u"de"_ustr ); LanguageTag de( s_de, true ); lang::Locale aLocale = de.getLocale(); CPPUNIT_ASSERT_EQUAL( s_de, de.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); LanguageType de_LangID = de.getLanguageType(); CPPUNIT_ASSERT( de_LangID != LANGUAGE_GERMAN ); CPPUNIT_ASSERT_EQUAL( MsLangId::getPrimaryLanguage( LANGUAGE_GERMAN) , de_LangID); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, de.makeFallback().getBcp47()); // Check registered mapping. LanguageTag de_l( de_LangID); CPPUNIT_ASSERT_EQUAL( s_de, de_l.getBcp47() ); @@ -337,9 +337,9 @@ void TestLanguageTag::testAllTags() // "bo" and "dz" share the same primary language ID, only one gets it // assigned, "dz" language-only has a special mapping. { - LanguageTag bo( "bo", true ); + LanguageTag bo( u"bo"_ustr, true ); CPPUNIT_ASSERT_EQUAL( MsLangId::getPrimaryLanguage( LANGUAGE_TIBETAN), bo.getLanguageType() ); - LanguageTag dz( "dz", true ); + LanguageTag dz( u"dz"_ustr, true ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_DZONGKHA_MAP_LONLY, dz.getLanguageType() ); } @@ -347,36 +347,36 @@ void TestLanguageTag::testAllTags() // assigned to "no-NO" for legacy so none gets it assigned, all on-the-fly // except if there is a defined MS-LCID for LanguageScriptOnly (LSO). { - LanguageTag no( "no", true ); + LanguageTag no( u"no"_ustr, true ); CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( no.getLanguageType()) ); - LanguageTag nb( "nb", true ); + LanguageTag nb( u"nb"_ustr, true ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN_BOKMAL_LSO, nb.getLanguageType() ); - LanguageTag nn( "nn", true ); + LanguageTag nn( u"nn"_ustr, true ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN_NYNORSK_LSO, nn.getLanguageType() ); - LanguageTag no_NO( "no-NO", true ); + LanguageTag no_NO( u"no-NO"_ustr, true ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN, no_NO.getLanguageType() ); } // 'de-1901' derived from 'de-DE-1901' grandfathered to check that it is // accepted as (DIGIT 3ALNUM) variant { - OUString s_de_1901( "de-1901" ); + OUString s_de_1901( u"de-1901"_ustr ); LanguageTag de_1901( s_de_1901 ); lang::Locale aLocale = de_1901.getLocale(); CPPUNIT_ASSERT_EQUAL( s_de_1901, de_1901.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT_EQUAL( s_de_1901, aLocale.Variant ); CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( de_1901.getLanguageType()) ); CPPUNIT_ASSERT( de_1901.isValidBcp47() ); CPPUNIT_ASSERT( !de_1901.isIsoLocale() ); CPPUNIT_ASSERT( !de_1901.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_1901.getLanguageAndScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("1901"), de_1901.getVariants() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_1901.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"1901"_ustr, de_1901.getVariants() ); ::std::vector< OUString > de_1901_Fallbacks( de_1901.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), de_1901_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("de-1901"), de_1901_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("de"), de_1901_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"de-1901"_ustr, de_1901_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, de_1901_Fallbacks[1]); } // 'en-GB-oed' is known grandfathered for English, Oxford English @@ -384,199 +384,199 @@ void TestLanguageTag::testAllTags() // Deprecated as of 2015-04-17, prefer en-GB-oxendict instead. // As of 2017-03-14 we also alias to en-GB-oxendict. { - OUString s_en_GB_oxendict( "en-GB-oxendict" ); - LanguageTag en_GB_oed( "en-GB-oed" ); + OUString s_en_GB_oxendict( u"en-GB-oxendict"_ustr ); + LanguageTag en_GB_oed( u"en-GB-oed"_ustr ); lang::Locale aLocale = en_GB_oed.getLocale(); CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, en_GB_oed.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("GB"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"GB"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_ENGLISH_UK_OXENDICT, en_GB_oed.getLanguageType() ); CPPUNIT_ASSERT( en_GB_oed.isValidBcp47() ); CPPUNIT_ASSERT( !en_GB_oed.isIsoLocale() ); CPPUNIT_ASSERT( !en_GB_oed.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oed.getLanguageAndScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("oxendict"), en_GB_oed.getVariants() ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, en_GB_oed.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"oxendict"_ustr, en_GB_oed.getVariants() ); ::std::vector< OUString > en_GB_oed_Fallbacks( en_GB_oed.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), en_GB_oed_Fallbacks.size() ); - CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oxendict"), en_GB_oed_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oed"), en_GB_oed_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("en-oxendict"), en_GB_oed_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("en-GB"), en_GB_oed_Fallbacks[3]); - CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oed_Fallbacks[4]); + CPPUNIT_ASSERT_EQUAL( u"en-GB-oxendict"_ustr, en_GB_oed_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"en-GB-oed"_ustr, en_GB_oed_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"en-oxendict"_ustr, en_GB_oed_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"en-GB"_ustr, en_GB_oed_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, en_GB_oed_Fallbacks[4]); // 'en-oed' is not a valid fallback! } // 'en-GB-oxendict' as preferred over 'en-GB-oed'. { - OUString s_en_GB_oxendict( "en-GB-oxendict" ); + OUString s_en_GB_oxendict( u"en-GB-oxendict"_ustr ); LanguageTag en_GB_oxendict( s_en_GB_oxendict ); lang::Locale aLocale = en_GB_oxendict.getLocale(); CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, en_GB_oxendict.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("GB"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"GB"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_ENGLISH_UK_OXENDICT, en_GB_oxendict.getLanguageType() ); CPPUNIT_ASSERT( en_GB_oxendict.isValidBcp47() ); CPPUNIT_ASSERT( !en_GB_oxendict.isIsoLocale() ); CPPUNIT_ASSERT( !en_GB_oxendict.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oxendict.getLanguageAndScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("oxendict"), en_GB_oxendict.getVariants() ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, en_GB_oxendict.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"oxendict"_ustr, en_GB_oxendict.getVariants() ); ::std::vector< OUString > en_GB_oxendict_Fallbacks( en_GB_oxendict.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), en_GB_oxendict_Fallbacks.size() ); - CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oxendict"), en_GB_oxendict_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oed"), en_GB_oxendict_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("en-oxendict"), en_GB_oxendict_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("en-GB"), en_GB_oxendict_Fallbacks[3]); - CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oxendict_Fallbacks[4]); + CPPUNIT_ASSERT_EQUAL( u"en-GB-oxendict"_ustr, en_GB_oxendict_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"en-GB-oed"_ustr, en_GB_oxendict_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"en-oxendict"_ustr, en_GB_oxendict_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"en-GB"_ustr, en_GB_oxendict_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, en_GB_oxendict_Fallbacks[4]); } // 'es-ES-u-co-trad' is a valid (and known) Extension U tag { - OUString s_es_ES_u_co_trad( "es-ES-u-co-trad" ); + OUString s_es_ES_u_co_trad( u"es-ES-u-co-trad"_ustr ); LanguageTag es_ES_u_co_trad( s_es_ES_u_co_trad ); lang::Locale aLocale = es_ES_u_co_trad.getLocale(); CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad, es_ES_u_co_trad.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"ES"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_SPANISH_DATED, es_ES_u_co_trad.getLanguageType() ); CPPUNIT_ASSERT( es_ES_u_co_trad.isValidBcp47() ); CPPUNIT_ASSERT( !es_ES_u_co_trad.isIsoLocale() ); CPPUNIT_ASSERT( !es_ES_u_co_trad.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_u_co_trad.getLanguageAndScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("u-co-trad"), es_ES_u_co_trad.getVariants() ); + CPPUNIT_ASSERT_EQUAL( u"es"_ustr, es_ES_u_co_trad.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"u-co-trad"_ustr, es_ES_u_co_trad.getVariants() ); ::std::vector< OUString > es_ES_u_co_trad_Fallbacks( es_ES_u_co_trad.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(4), es_ES_u_co_trad_Fallbacks.size() ); - CPPUNIT_ASSERT_EQUAL( OUString("es-ES-u-co-trad"), es_ES_u_co_trad_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("es-u-co-trad"), es_ES_u_co_trad_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("es-ES"), es_ES_u_co_trad_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_u_co_trad_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"es-ES-u-co-trad"_ustr, es_ES_u_co_trad_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"es-u-co-trad"_ustr, es_ES_u_co_trad_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"es-ES"_ustr, es_ES_u_co_trad_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"es"_ustr, es_ES_u_co_trad_Fallbacks[3]); // Map to broken MS. - CPPUNIT_ASSERT_EQUAL( OUString("es-ES_tradnl"), es_ES_u_co_trad.getBcp47MS() ); + CPPUNIT_ASSERT_EQUAL( u"es-ES_tradnl"_ustr, es_ES_u_co_trad.getBcp47MS() ); } // 'es-ES_tradnl' (broken MS) maps to 'es-ES-u-co-trad' { - OUString s_es_ES_u_co_trad( "es-ES-u-co-trad" ); - OUString s_es_ES_tradnl( "es-ES_tradnl" ); + OUString s_es_ES_u_co_trad( u"es-ES-u-co-trad"_ustr ); + OUString s_es_ES_tradnl( u"es-ES_tradnl"_ustr ); LanguageTag es_ES_tradnl( s_es_ES_tradnl ); lang::Locale aLocale = es_ES_tradnl.getLocale(); CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad, es_ES_tradnl.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"ES"_ustr, aLocale.Country ); CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_SPANISH_DATED, es_ES_tradnl.getLanguageType() ); CPPUNIT_ASSERT( es_ES_tradnl.isValidBcp47() ); CPPUNIT_ASSERT( !es_ES_tradnl.isIsoLocale() ); CPPUNIT_ASSERT( !es_ES_tradnl.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_tradnl.getLanguageAndScript() ); - CPPUNIT_ASSERT_EQUAL( OUString("u-co-trad"), es_ES_tradnl.getVariants() ); + CPPUNIT_ASSERT_EQUAL( u"es"_ustr, es_ES_tradnl.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"u-co-trad"_ustr, es_ES_tradnl.getVariants() ); ::std::vector< OUString > es_ES_tradnl_Fallbacks( es_ES_tradnl.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(4), es_ES_tradnl_Fallbacks.size() ); - CPPUNIT_ASSERT_EQUAL( OUString("es-ES-u-co-trad"), es_ES_tradnl_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("es-u-co-trad"), es_ES_tradnl_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("es-ES"), es_ES_tradnl_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_tradnl_Fallbacks[3]); + CPPUNIT_ASSERT_EQUAL( u"es-ES-u-co-trad"_ustr, es_ES_tradnl_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"es-u-co-trad"_ustr, es_ES_tradnl_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"es-ES"_ustr, es_ES_tradnl_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"es"_ustr, es_ES_tradnl_Fallbacks[3]); // Map back to broken MS. CPPUNIT_ASSERT_EQUAL( s_es_ES_tradnl, es_ES_tradnl.getBcp47MS() ); } // 'zh-Hans-CN' maps to 'zh-CN' and fallbacks { - LanguageTag zh_Hans_CN( "zh-Hans-CN", true ); + LanguageTag zh_Hans_CN( u"zh-Hans-CN"_ustr, true ); lang::Locale aLocale = zh_Hans_CN.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("zh-CN"), zh_Hans_CN.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("CN"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"zh-CN"_ustr, zh_Hans_CN.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"CN"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_CHINESE_SIMPLIFIED, zh_Hans_CN.getLanguageType() ); CPPUNIT_ASSERT( zh_Hans_CN.isValidBcp47() ); CPPUNIT_ASSERT( zh_Hans_CN.isIsoLocale() ); CPPUNIT_ASSERT( zh_Hans_CN.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_Hans_CN.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("CN"), zh_Hans_CN.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_Hans_CN.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"CN"_ustr, zh_Hans_CN.getCountry() ); CPPUNIT_ASSERT( zh_Hans_CN.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_Hans_CN.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_Hans_CN.getLanguageAndScript() ); ::std::vector< OUString > zh_Hans_CN_Fallbacks( zh_Hans_CN.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), zh_Hans_CN_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("zh-CN"), zh_Hans_CN_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_Hans_CN_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-CN"), zh_Hans_CN.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"zh-CN"_ustr, zh_Hans_CN_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_Hans_CN_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"zh-CN"_ustr, zh_Hans_CN.makeFallback().getBcp47()); } // 'zh-Hant-TW' maps to 'zh-TW' and fallbacks { - LanguageTag zh_Hant_TW( "zh-Hant-TW", true ); + LanguageTag zh_Hant_TW( u"zh-Hant-TW"_ustr, true ); lang::Locale aLocale = zh_Hant_TW.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("zh-TW"), zh_Hant_TW.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("TW"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"zh-TW"_ustr, zh_Hant_TW.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"TW"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_CHINESE_TRADITIONAL, zh_Hant_TW.getLanguageType() ); CPPUNIT_ASSERT( zh_Hant_TW.isValidBcp47() ); CPPUNIT_ASSERT( zh_Hant_TW.isIsoLocale() ); CPPUNIT_ASSERT( zh_Hant_TW.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_Hant_TW.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("TW"), zh_Hant_TW.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_Hant_TW.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"TW"_ustr, zh_Hant_TW.getCountry() ); CPPUNIT_ASSERT( zh_Hant_TW.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_Hant_TW.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_Hant_TW.getLanguageAndScript() ); ::std::vector< OUString > zh_Hant_TW_Fallbacks( zh_Hant_TW.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(3), zh_Hant_TW_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("zh-TW"), zh_Hant_TW_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-CN"), zh_Hant_TW_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_Hant_TW_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-TW"), zh_Hant_TW.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"zh-TW"_ustr, zh_Hant_TW_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"zh-CN"_ustr, zh_Hant_TW_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_Hant_TW_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"zh-TW"_ustr, zh_Hant_TW.makeFallback().getBcp47()); } // 'zh-SG' and fallbacks { - OUString s_zh_SG( "zh-SG" ); + OUString s_zh_SG( u"zh-SG"_ustr ); LanguageTag zh_SG( s_zh_SG, true ); lang::Locale aLocale = zh_SG.getLocale(); CPPUNIT_ASSERT_EQUAL( s_zh_SG, zh_SG.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("SG"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"SG"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_CHINESE_SINGAPORE, zh_SG.getLanguageType() ); CPPUNIT_ASSERT( zh_SG.isValidBcp47() ); CPPUNIT_ASSERT( zh_SG.isIsoLocale() ); CPPUNIT_ASSERT( zh_SG.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_SG.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("SG"), zh_SG.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_SG.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"SG"_ustr, zh_SG.getCountry() ); CPPUNIT_ASSERT( zh_SG.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_SG.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_SG.getLanguageAndScript() ); ::std::vector< OUString > zh_SG_Fallbacks( zh_SG.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(3), zh_SG_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("zh-SG"), zh_SG_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-CN"), zh_SG_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_SG_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-SG"), zh_SG.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"zh-SG"_ustr, zh_SG_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"zh-CN"_ustr, zh_SG_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_SG_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"zh-SG"_ustr, zh_SG.makeFallback().getBcp47()); } // 'zh-HK' and fallbacks { - OUString s_zh_HK( "zh-HK" ); + OUString s_zh_HK( u"zh-HK"_ustr ); LanguageTag zh_HK( s_zh_HK, true ); lang::Locale aLocale = zh_HK.getLocale(); CPPUNIT_ASSERT_EQUAL( s_zh_HK, zh_HK.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("HK"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"HK"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_CHINESE_HONGKONG, zh_HK.getLanguageType() ); CPPUNIT_ASSERT( zh_HK.isValidBcp47() ); CPPUNIT_ASSERT( zh_HK.isIsoLocale() ); CPPUNIT_ASSERT( zh_HK.isIsoODF() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_HK.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("HK"), zh_HK.getCountry() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_HK.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"HK"_ustr, zh_HK.getCountry() ); CPPUNIT_ASSERT( zh_HK.getScript().isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_HK.getLanguageAndScript() ); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_HK.getLanguageAndScript() ); ::std::vector< OUString > zh_HK_Fallbacks( zh_HK.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(3), zh_HK_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("zh-HK"), zh_HK_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-TW"), zh_HK_Fallbacks[1]); - CPPUNIT_ASSERT_EQUAL( OUString("zh"), zh_HK_Fallbacks[2]); - CPPUNIT_ASSERT_EQUAL( OUString("zh-HK"), zh_HK.makeFallback().getBcp47()); + CPPUNIT_ASSERT_EQUAL( u"zh-HK"_ustr, zh_HK_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"zh-TW"_ustr, zh_HK_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"zh"_ustr, zh_HK_Fallbacks[2]); + CPPUNIT_ASSERT_EQUAL( u"zh-HK"_ustr, zh_HK.makeFallback().getBcp47()); } // 'zh-yue-HK' uses redundant 'zh-yue' and should be preferred 'yue-HK' @@ -611,27 +611,27 @@ void TestLanguageTag::testAllTags() // 'es-419' fallbacks { - OUString s_es_419( "es-419" ); + OUString s_es_419( u"es-419"_ustr ); LanguageTag es_419( s_es_419 ); lang::Locale aLocale = es_419.getLocale(); CPPUNIT_ASSERT_EQUAL( s_es_419, es_419.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("es-419"), aLocale.Variant ); + CPPUNIT_ASSERT_EQUAL( u"es-419"_ustr, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_SPANISH_LATIN_AMERICA, es_419.getLanguageType() ); ::std::vector< OUString > es_419_Fallbacks( es_419.getFallbackStrings( true)); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), es_419_Fallbacks.size()); - CPPUNIT_ASSERT_EQUAL( OUString("es-419"), es_419_Fallbacks[0]); - CPPUNIT_ASSERT_EQUAL( OUString("es"), es_419_Fallbacks[1]); + CPPUNIT_ASSERT_EQUAL( u"es-419"_ustr, es_419_Fallbacks[0]); + CPPUNIT_ASSERT_EQUAL( u"es"_ustr, es_419_Fallbacks[1]); } // 'qtz' is a local use known pseudolocale for key ID resource { - OUString s_qtz( "qtz" ); + OUString s_qtz( u"qtz"_ustr ); LanguageTag qtz( s_qtz ); lang::Locale aLocale = qtz.getLocale(); CPPUNIT_ASSERT_EQUAL( s_qtz, qtz.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qtz"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qtz"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_KEYID, qtz.getLanguageType() ); @@ -639,11 +639,11 @@ void TestLanguageTag::testAllTags() // 'qty' is a local use unknown locale { - OUString s_qty( "qty" ); + OUString s_qty( u"qty"_ustr ); LanguageTag qty( s_qty ); lang::Locale aLocale = qty.getLocale(); CPPUNIT_ASSERT_EQUAL( s_qty, qty.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qty"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qty"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( qty.getLanguageType()) ); @@ -651,7 +651,7 @@ void TestLanguageTag::testAllTags() // 'qtx' is an unknown new mslangid { - LanguageTag qtx( "qtx" ); + LanguageTag qtx( u"qtx"_ustr ); qtx.setScriptType( LanguageTag::ScriptType::RTL ); LanguageType n_qtx = qtx.getLanguageType(); CPPUNIT_ASSERT_EQUAL( css::i18n::ScriptType::COMPLEX, MsLangId::getScriptType(n_qtx) ); @@ -661,68 +661,68 @@ void TestLanguageTag::testAllTags() // 'x-comment' is a privateuse known "locale" { - OUString s_xcomment( "x-comment" ); + OUString s_xcomment( u"x-comment"_ustr ); LanguageTag xcomment( s_xcomment ); lang::Locale aLocale = xcomment.getLocale(); CPPUNIT_ASSERT_EQUAL( s_xcomment, xcomment.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("x-comment"), aLocale.Variant ); + CPPUNIT_ASSERT_EQUAL( u"x-comment"_ustr, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_COMMENT, xcomment.getLanguageType() ); } // 'x-foobar' is a privateuse unknown "locale" { - OUString s_xfoobar( "x-foobar" ); + OUString s_xfoobar( u"x-foobar"_ustr ); LanguageTag xfoobar( s_xfoobar ); lang::Locale aLocale = xfoobar.getLocale(); CPPUNIT_ASSERT_EQUAL( s_xfoobar, xfoobar.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aLocale.Variant ); + CPPUNIT_ASSERT_EQUAL( u"x-foobar"_ustr, aLocale.Variant ); CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( xfoobar.getLanguageType()) ); } // '*' the dreaded jolly joker is a "privateuse" known "locale" { - OUString s_joker( "*" ); + OUString s_joker( u"*"_ustr ); LanguageTag joker( s_joker ); lang::Locale aLocale = joker.getLocale(); CPPUNIT_ASSERT_EQUAL( s_joker, joker.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("*"), aLocale.Variant ); + CPPUNIT_ASSERT_EQUAL( u"*"_ustr, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_JOKER, joker.getLanguageType() ); joker.reset( LANGUAGE_USER_PRIV_JOKER ); aLocale = joker.getLocale(); CPPUNIT_ASSERT_EQUAL( s_joker, joker.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); - CPPUNIT_ASSERT_EQUAL( OUString("*"), aLocale.Variant ); + CPPUNIT_ASSERT_EQUAL( u"*"_ustr, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_JOKER, joker.getLanguageType() ); } // 'C' locale shall map to 'en-US' { - LanguageTag aTag( "C" ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), aTag.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("US"), aTag.getCountry() ); + LanguageTag aTag( u"C"_ustr ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, aTag.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"US"_ustr, aTag.getCountry() ); lang::Locale aLocale = aTag.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aTag.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"en-US"_ustr, aTag.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"US"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US, aTag.getLanguageType() ); } { - LanguageTag aTag( lang::Locale("C","","") ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), aTag.getLanguage() ); - CPPUNIT_ASSERT_EQUAL( OUString("US"), aTag.getCountry() ); + LanguageTag aTag( lang::Locale(u"C"_ustr,u""_ustr,u""_ustr) ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, aTag.getLanguage() ); + CPPUNIT_ASSERT_EQUAL( u"US"_ustr, aTag.getCountry() ); lang::Locale aLocale = aTag.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aTag.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"en-US"_ustr, aTag.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"US"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US, aTag.getLanguageType() ); } @@ -734,35 +734,35 @@ void TestLanguageTag::testAllTags() aTag.reset( LANGUAGE_GERMAN ); aLocale = aTag.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aTag.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, aTag.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, aTag.getLanguageType() ); - aTag.reset( "en-US" ); + aTag.reset( u"en-US"_ustr ); aLocale = aTag.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aTag.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"en-US"_ustr, aTag.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"en"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"US"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US, aTag.getLanguageType() ); - aTag.reset( lang::Locale( "de", "DE", "" ) ); + aTag.reset( lang::Locale( u"de"_ustr, u"DE"_ustr, u""_ustr ) ); aLocale = aTag.getLocale(); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aTag.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language ); - CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country ); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, aTag.getBcp47() ); + CPPUNIT_ASSERT_EQUAL( u"de"_ustr, aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"DE"_ustr, aLocale.Country ); CPPUNIT_ASSERT( aLocale.Variant.isEmpty() ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, aTag.getLanguageType() ); } { - OUString s_uab( "unreg-and-bad" ); + OUString s_uab( u"unreg-and-bad"_ustr ); LanguageTag uab( s_uab, true ); lang::Locale aLocale = uab.getLocale(); CPPUNIT_ASSERT_EQUAL( s_uab, uab.getBcp47() ); - CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language ); + CPPUNIT_ASSERT_EQUAL( u"qlt"_ustr, aLocale.Language ); CPPUNIT_ASSERT( aLocale.Country.isEmpty() ); CPPUNIT_ASSERT_EQUAL( s_uab, aLocale.Variant ); CPPUNIT_ASSERT_EQUAL( LANGUAGE_DONTKNOW, uab.getLanguageType() ); @@ -774,24 +774,24 @@ void TestLanguageTag::testAllTags() // test static isValidBcp47() method { OUString aCanonicalized; - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized) ); - CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aCanonicalized ); - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized) ); - CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aCanonicalized ); - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", &aCanonicalized) ); - CPPUNIT_ASSERT_EQUAL( OUString("qaa"), aCanonicalized ); - CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "unreg-and-bad", &aCanonicalized) ); - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized, LanguageTag::PrivateUse::DISALLOW) ); - CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aCanonicalized ); - CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized, LanguageTag::PrivateUse::DISALLOW) ); - CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aCanonicalized ); - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", &aCanonicalized, LanguageTag::PrivateUse::DISALLOW) ); - CPPUNIT_ASSERT_EQUAL( OUString("qaa"), aCanonicalized ); - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", &aCanonicalized) ); - CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aCanonicalized ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"en-US"_ustr, &aCanonicalized) ); + CPPUNIT_ASSERT_EQUAL( u"en-US"_ustr, aCanonicalized ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"x-foobar"_ustr, &aCanonicalized) ); + CPPUNIT_ASSERT_EQUAL( u"x-foobar"_ustr, aCanonicalized ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"qaa"_ustr, &aCanonicalized) ); + CPPUNIT_ASSERT_EQUAL( u"qaa"_ustr, aCanonicalized ); + CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( u"unreg-and-bad"_ustr, &aCanonicalized) ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"en-US"_ustr, &aCanonicalized, LanguageTag::PrivateUse::DISALLOW) ); + CPPUNIT_ASSERT_EQUAL( u"en-US"_ustr, aCanonicalized ); + CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( u"x-foobar"_ustr, &aCanonicalized, LanguageTag::PrivateUse::DISALLOW) ); + CPPUNIT_ASSERT_EQUAL( u"x-foobar"_ustr, aCanonicalized ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"qaa"_ustr, &aCanonicalized, LanguageTag::PrivateUse::DISALLOW) ); + CPPUNIT_ASSERT_EQUAL( u"qaa"_ustr, aCanonicalized ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"de-Latn-DE"_ustr, &aCanonicalized) ); + CPPUNIT_ASSERT_EQUAL( u"de-DE"_ustr, aCanonicalized ); /* TODO: at least some (those we know) grandfathered tags should be * recognized by the replacement code. */ - CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-GB-oed", &aCanonicalized) ); + CPPUNIT_ASSERT( LanguageTag::isValidBcp47( u"en-GB-oed"_ustr, &aCanonicalized) ); // en-GB-oed has become deprecated in updated language-subtag-registry database // (liblangtag 0.5.7) CPPUNIT_ASSERT( ( aCanonicalized == "en-GB-oxendict" ) || ( aCanonicalized == "en-GB-oed" ) ); @@ -931,73 +931,73 @@ void TestLanguageTag::testAllIsoLangEntries() void TestLanguageTag::testDisplayNames() { OUString aStr; - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("en-US")); - CPPUNIT_ASSERT_EQUAL( OUString("English (United States)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("English (United States)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("English"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("de-DE")); - CPPUNIT_ASSERT_EQUAL( OUString("Englisch (Vereinigte Staaten)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("de")); - CPPUNIT_ASSERT_EQUAL( OUString("Englisch (Vereinigte Staaten)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en"), LanguageTag("de")); - CPPUNIT_ASSERT_EQUAL( OUString("Englisch"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("de-DE"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("German (Germany)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("de"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("German"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("de-DE-1901"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("German (Germany, Traditional German orthography)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("de-DE-1901"), LanguageTag("de-DE")); - CPPUNIT_ASSERT_EQUAL( OUString("Deutsch (Deutschland, Alte deutsche Rechtschreibung)"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-GB"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("English (United Kingdom)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-GB-oxendict"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("English (United Kingdom, Oxford English Dictionary spelling)"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("ca-ES-valencia"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("Catalan (Spain, Valencian)"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("sr-Cyrl-RS"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("Serbian (Serbia)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("sr-Latn-RS"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("Serbian (Latin, Serbia)"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("tlh"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("Klingon"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("und"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("Unknown language"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("zxx"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("No linguistic content"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("x-lala"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("Unknown language (Private-Use=lala)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("x-lala"), LanguageTag("de")); - CPPUNIT_ASSERT_EQUAL( OUString("Unbekannte Sprache (Privatnutzung=lala)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-GB"), LanguageTag("x-lala")); - CPPUNIT_ASSERT_EQUAL( OUString("en (GB)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-GB-oxendict"), LanguageTag("x-lala")); - CPPUNIT_ASSERT_EQUAL( OUString("en (GB, OXENDICT)"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("unreg-and-bad"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("unreg (Andorra, BAD)"), aStr); // a tad of a surprise.. - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("en-029"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("English (Caribbean)"), aStr); - aStr = LanguageTagIcu::getDisplayName( LanguageTag("fr-015"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("French (Northern Africa)"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("qtz"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("qtz"), aStr); - - aStr = LanguageTagIcu::getDisplayName( LanguageTag("*"), LanguageTag("en")); - CPPUNIT_ASSERT_EQUAL( OUString("*"), aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-US"_ustr), LanguageTag(u"en-US"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"English (United States)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-US"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"English (United States)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"English"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-US"_ustr), LanguageTag(u"de-DE"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Englisch (Vereinigte Staaten)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-US"_ustr), LanguageTag(u"de"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Englisch (Vereinigte Staaten)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en"_ustr), LanguageTag(u"de"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Englisch"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"de-DE"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"German (Germany)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"de"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"German"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"de-DE-1901"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"German (Germany, Traditional German orthography)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"de-DE-1901"_ustr), LanguageTag(u"de-DE"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Deutsch (Deutschland, Alte deutsche Rechtschreibung)"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-GB"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"English (United Kingdom)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-GB-oxendict"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"English (United Kingdom, Oxford English Dictionary spelling)"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"ca-ES-valencia"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Catalan (Spain, Valencian)"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"sr-Cyrl-RS"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Serbian (Serbia)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"sr-Latn-RS"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Serbian (Latin, Serbia)"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"tlh"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Klingon"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"und"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Unknown language"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"zxx"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"No linguistic content"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"x-lala"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Unknown language (Private-Use=lala)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"x-lala"_ustr), LanguageTag(u"de"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"Unbekannte Sprache (Privatnutzung=lala)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-GB"_ustr), LanguageTag(u"x-lala"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"en (GB)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-GB-oxendict"_ustr), LanguageTag(u"x-lala"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"en (GB, OXENDICT)"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"unreg-and-bad"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"unreg (Andorra, BAD)"_ustr, aStr); // a tad of a surprise.. + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"en-029"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"English (Caribbean)"_ustr, aStr); + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"fr-015"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"French (Northern Africa)"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"qtz"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"qtz"_ustr, aStr); + + aStr = LanguageTagIcu::getDisplayName( LanguageTag(u"*"_ustr), LanguageTag(u"en"_ustr)); + CPPUNIT_ASSERT_EQUAL( u"*"_ustr, aStr); } void TestLanguageTag::testLanguagesWithoutHyphenation() diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 26a3d5db2c79..5a922babd5ea 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -224,7 +224,7 @@ void LiblangtagDataRef::setupDataPath() maDataPath = OString(lo_get_app_data_dir()) + "/share/liblangtag"; #else // maDataPath is assumed to be empty here. - OUString aURL("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/liblangtag"); + OUString aURL(u"$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/liblangtag"_ustr); rtl::Bootstrap::expandMacros(aURL); //TODO: detect failure // Check if data is in our own installation, else assume system @@ -2210,7 +2210,7 @@ LanguageTag & LanguageTag::makeFallback() } else if (aLanguage == "ca" && aCountry == "XV") { - ::std::vector< OUString > aRep( LanguageTag( "ca-ES-valencia").getFallbackStrings( true)); + ::std::vector< OUString > aRep( LanguageTag( u"ca-ES-valencia"_ustr).getFallbackStrings( true)); aVec.insert( aVec.end(), aRep.begin(), aRep.end()); // Already includes 'ca' language fallback. } @@ -2398,7 +2398,7 @@ LanguageTag & LanguageTag::makeFallback() OUString LanguageTag::getBcp47MS() const { if (getLanguageType() == LANGUAGE_SPANISH_DATED) - return "es-ES_tradnl"; + return u"es-ES_tradnl"_ustr; return getBcp47(); } @@ -3153,7 +3153,7 @@ LanguageTag makeLanguageTagFromAppleLanguageId(AppleLanguageId nLanguage) nLang = LANGUAGE_AZERI_CYRILLIC; break; case AppleLanguageId::AZERI_ARABIC: - return LanguageTag("az-Arab"); + return LanguageTag(u"az-Arab"_ustr); case AppleLanguageId::ARMENIAN: nLang = LANGUAGE_ARMENIAN; break; @@ -3275,7 +3275,7 @@ LanguageTag makeLanguageTagFromAppleLanguageId(AppleLanguageId nLanguage) nLang = LANGUAGE_KINYARWANDA_RWANDA; break; case AppleLanguageId::RUNDI: - return LanguageTag("rn"); + return LanguageTag(u"rn"_ustr); case AppleLanguageId::NYANJA: nLang = LANGUAGE_USER_NYANJA; break; @@ -3304,7 +3304,7 @@ LanguageTag makeLanguageTagFromAppleLanguageId(AppleLanguageId nLanguage) nLang = LANGUAGE_GUARANI_PARAGUAY; break; case AppleLanguageId::AYMARA: - return LanguageTag("ay"); + return LanguageTag(u"ay"_ustr); case AppleLanguageId::TATAR: nLang = LANGUAGE_TATAR; break; @@ -3315,9 +3315,9 @@ LanguageTag makeLanguageTagFromAppleLanguageId(AppleLanguageId nLanguage) nLang = LANGUAGE_DZONGKHA_BHUTAN; break; case AppleLanguageId::JAVANESE_LATIN: - return LanguageTag("jv-Latn"); + return LanguageTag(u"jv-Latn"_ustr); case AppleLanguageId::SUNDANESE_LATIN: - return LanguageTag("su-Latn"); + return LanguageTag(u"su-Latn"_ustr); case AppleLanguageId::GALICIAN: nLang = LANGUAGE_GALICIAN; break; @@ -3337,9 +3337,9 @@ LanguageTag makeLanguageTagFromAppleLanguageId(AppleLanguageId nLanguage) nLang = LANGUAGE_USER_MANX; break; case AppleLanguageId::IRISH_GAELIC_WITH_DOT_ABOVE: - return LanguageTag("ga-Latg"); + return LanguageTag(u"ga-Latg"_ustr); case AppleLanguageId::TONGAN: - return LanguageTag("to"); + return LanguageTag(u"to"_ustr); case AppleLanguageId::GREEK_POLYTONIC: nLang = LANGUAGE_USER_ANCIENT_GREEK; break; diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 0103637989e4..e790c17e1155 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -217,7 +217,7 @@ void TestBreakIterator::testLineBreaking() // An identical result should be generated for solidus. 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>(11), aResult.breakIndex); } @@ -289,7 +289,7 @@ void TestBreakIterator::testLineBreaking() // From the same bug: "the leading minus must stay with numbers and strings" i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "range of -100.000 to 100.000", strlen("range of -1"), aLocale, 0, + u"range of -100.000 to 100.000"_ustr, strlen("range of -1"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(sal_Int32{9}, aResult.breakIndex); @@ -306,7 +306,7 @@ void TestBreakIterator::testLineBreaking() // From the same bug: "the leading minus must stay with numbers and strings" i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "EURO is -10,50", strlen("EURO is -1"), aLocale, 0, aHyphOptions, aUserOptions); + u"EURO is -10,50"_ustr, strlen("EURO is -1"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(sal_Int32{8}, aResult.breakIndex); // Also the mathematical minus sign: @@ -321,7 +321,7 @@ void TestBreakIterator::testLineBreaking() // From the same bug: "the leading minus must stay with numbers and strings" i18n::LineBreakResults aResult = m_xBreak->getLineBreak( - "und -kosten", strlen("und -ko"), aLocale, 0, + u"und -kosten"_ustr, strlen("und -ko"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL(sal_Int32{4}, aResult.breakIndex); diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index e98afeeff3b8..b0e1cd4d85ef 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -1044,7 +1044,7 @@ OUString unicode::formatPercent(double dNumber, // http://www.unicode.org/cldr/charts/24/by_type/numbers.number_formatting_patterns.html // so format using French which has the desired rules if (aLangTag.getLanguage() == "es" || aLangTag.getLanguage() == "sl") - aLangTag.reset("fr-FR"); + aLangTag.reset(u"fr-FR"_ustr); icu::Locale aLocale = LanguageTagIcu::getIcuLocale(aLangTag); diff --git a/include/docmodel/theme/Theme.hxx b/include/docmodel/theme/Theme.hxx index 898cf3d787a7..c13f0549b7a8 100644 --- a/include/docmodel/theme/Theme.hxx +++ b/include/docmodel/theme/Theme.hxx @@ -58,7 +58,7 @@ private: public: FontScheme() - : maName("Office") + : maName(u"Office"_ustr) { } diff --git a/include/systools/curlinit.hxx b/include/systools/curlinit.hxx index 4b226c7a4218..7c6f8d07deaf 100644 --- a/include/systools/curlinit.hxx +++ b/include/systools/curlinit.hxx @@ -37,7 +37,7 @@ static void InitCurl_easy(CURL* const pCURL) rc = curl_easy_setopt(pCURL, CURLOPT_CAINFO, path); if (rc != CURLE_OK) // only if OOM? { - throw css::uno::RuntimeException("CURLOPT_CAINFO failed"); + throw css::uno::RuntimeException(u"CURLOPT_CAINFO failed"_ustr); } #endif diff --git a/include/systools/opensslinit.hxx b/include/systools/opensslinit.hxx index 48b38cf67512..be9cd43c58d5 100644 --- a/include/systools/opensslinit.hxx +++ b/include/systools/opensslinit.hxx @@ -36,7 +36,7 @@ static char const* GetCABundleFile() } } - throw css::uno::RuntimeException("no OpenSSL CA certificate bundle found"); + throw css::uno::RuntimeException(u"no OpenSSL CA certificate bundle found"_ustr); } #endif diff --git a/o3tl/qa/test-sorted_vector.cxx b/o3tl/qa/test-sorted_vector.cxx index 8e04e1d2232d..f993ab80a302 100644 --- a/o3tl/qa/test-sorted_vector.cxx +++ b/o3tl/qa/test-sorted_vector.cxx @@ -263,16 +263,16 @@ public: CPPUNIT_ASSERT(!aVec.insert(std::make_unique<OUString>("b")).second); aVec.insert(std::make_unique<OUString>("a")); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(3), aVec.size() ); - CPPUNIT_ASSERT_EQUAL( OUString("a"), *aVec[0] ); - CPPUNIT_ASSERT_EQUAL( OUString("b"), *aVec[1] ); - CPPUNIT_ASSERT_EQUAL( OUString("c"), *aVec[2] ); + CPPUNIT_ASSERT_EQUAL( u"a"_ustr, *aVec[0] ); + CPPUNIT_ASSERT_EQUAL( u"b"_ustr, *aVec[1] ); + CPPUNIT_ASSERT_EQUAL( u"c"_ustr, *aVec[2] ); CPPUNIT_ASSERT( aVec.find(str_c) != aVec.end() ); CPPUNIT_ASSERT( aVec.find(str_b1) != aVec.end() ); - OUString tmp("b"); + OUString tmp(u"b"_ustr); CPPUNIT_ASSERT( aVec.find(&tmp) != aVec.end() ); - OUString tmp2("z"); + OUString tmp2(u"z"_ustr); CPPUNIT_ASSERT( bool(aVec.find(&tmp2) == aVec.end()) ); } @@ -286,16 +286,16 @@ public: auto str_b2 = aVec.insert(std::make_unique<OUString>("b")).first->get(); aVec.insert(std::make_unique<OUString>("a")); CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(4), aVec.size() ); - CPPUNIT_ASSERT_EQUAL( OUString("a"), *aVec[0] ); - CPPUNIT_ASSERT_EQUAL( OUString("b"), *aVec[1] ); - CPPUNIT_ASSERT_EQUAL( OUString("b"), *aVec[2] ); - CPPUNIT_ASSERT_EQUAL( OUString("c"), *aVec[3] ); + CPPUNIT_ASSERT_EQUAL( u"a"_ustr, *aVec[0] ); + CPPUNIT_ASSERT_EQUAL( u"b"_ustr, *aVec[1] ); + CPPUNIT_ASSERT_EQUAL( u"b"_ustr, *aVec[2] ); + CPPUNIT_ASSERT_EQUAL( u"c"_ustr, *aVec[3] ); CPPUNIT_ASSERT( aVec.find(str_c) != aVec.end() ); CPPUNIT_ASSERT( aVec.find(str_b1) != aVec.end() ); CPPUNIT_ASSERT( aVec.find(str_b2) != aVec.end() ); - OUString tmp2("z"); + OUString tmp2(u"z"_ustr); CPPUNIT_ASSERT( bool(aVec.find(&tmp2) == aVec.end()) ); } diff --git a/o3tl/qa/test-string_view.cxx b/o3tl/qa/test-string_view.cxx index f32537aa3596..91dda3e9e883 100644 --- a/o3tl/qa/test-string_view.cxx +++ b/o3tl/qa/test-string_view.cxx @@ -37,12 +37,12 @@ OString ostringFood() { return "food"_ostr; } // avoid loplugin:stringview OString ostringOof() { return "oof"_ostr; } // avoid loplugin:stringview OString ostringSraboof() { return "sraboof"_ostr; } // avoid loplugin:stringview OUString oustringEmpty() { return {}; } // avoid loplugin:stringview -OUString oustringDoof() { return "doof"; } // avoid loplugin:stringview -OUString oustringFoo() { return "foo"; } // avoid loplugin:stringview -OUString oustringFoobars() { return "foobars"; } // avoid loplugin:stringview -OUString oustringFood() { return "food"; } // avoid loplugin:stringview -OUString oustringOof() { return "oof"; } // avoid loplugin:stringview -OUString oustringSraboof() { return "sraboof"; } // avoid loplugin:stringview +OUString oustringDoof() { return u"doof"_ustr; } // avoid loplugin:stringview +OUString oustringFoo() { return u"foo"_ustr; } // avoid loplugin:stringview +OUString oustringFoobars() { return u"foobars"_ustr; } // avoid loplugin:stringview +OUString oustringFood() { return u"food"_ustr; } // avoid loplugin:stringview +OUString oustringOof() { return u"oof"_ustr; } // avoid loplugin:stringview +OUString oustringSraboof() { return u"sraboof"_ustr; } // avoid loplugin:stringview class Test : public CppUnit::TestFixture { @@ -597,7 +597,7 @@ private: { // Explicit initialization of suTokenStr to avoid an unhelpful loplugin:stringviewvar; // it is the o3tl::getToken overload taking OUString that we want to test here: - OUString suTokenStr(""); + OUString suTokenStr(u""_ustr); sal_Int32 nIndex = 0; do { @@ -606,7 +606,7 @@ private: // should not GPF } { - OUString suTokenStr("a;b"); + OUString suTokenStr(u"a;b"_ustr); sal_Int32 nIndex = 0; diff --git a/opencl/source/openclconfig.cxx b/opencl/source/openclconfig.cxx index a2b69c175cbf..2c011eedd5ce 100644 --- a/opencl/source/openclconfig.cxx +++ b/opencl/source/openclconfig.cxx @@ -27,14 +27,14 @@ OpenCLConfig::OpenCLConfig() : // This entry we have had for some time (when denylisting was // done elsewhere in the code), so presumably there is a known // good reason for it. - maDenyList.insert(ImplMatcher("Windows", "", "Intel\\(R\\) Corporation", "", "9\\.17\\.10\\.2884")); + maDenyList.insert(ImplMatcher(u"Windows"_ustr, u""_ustr, u"Intel\\(R\\) Corporation"_ustr, u""_ustr, u"9\\.17\\.10\\.2884"_ustr)); // This was reported to produce bogus values in unit tests - maDenyList.insert(ImplMatcher("Windows", "", "Intel\\(R\\) Corporation", "", "27\\.20\\.100\\.8681")); + maDenyList.insert(ImplMatcher(u"Windows"_ustr, u""_ustr, u"Intel\\(R\\) Corporation"_ustr, u""_ustr, u"27\\.20\\.100\\.8681"_ustr)); // For now, assume that AMD, Intel and NVIDIA drivers are good - maAllowList.insert(ImplMatcher("", "", "Advanced Micro Devices, Inc\\.", "", "")); - maAllowList.insert(ImplMatcher("", "", "Intel\\(R\\) Corporation", "", "")); - maAllowList.insert(ImplMatcher("", "", "NVIDIA Corporation", "", "")); + maAllowList.insert(ImplMatcher(u""_ustr, u""_ustr, u"Advanced Micro Devices, Inc\\."_ustr, u""_ustr, u""_ustr)); + maAllowList.insert(ImplMatcher(u""_ustr, u""_ustr, u"Intel\\(R\\) Corporation"_ustr, u""_ustr, u""_ustr)); + maAllowList.insert(ImplMatcher(u""_ustr, u""_ustr, u"NVIDIA Corporation"_ustr, u""_ustr, u""_ustr)); } bool OpenCLConfig::operator== (const OpenCLConfig& r) const diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index 8d840d65c181..16109971c0a9 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -90,7 +90,7 @@ OString const & getCacheFolder() { static OString const aCacheFolder = []() { - OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/cache/"); + OUString url(u"${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/cache/"_ustr); rtl::Bootstrap::expandMacros(url); osl::Directory::create(url); diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx index c332402e390d..7e83206cc389 100644 --- a/postprocess/qa/services.cxx +++ b/postprocess/qa/services.cxx @@ -149,7 +149,7 @@ void Test::test() { m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW); css::uno::Reference<css::container::XHierarchicalNameAccess> typeMgr( m_xContext->getValueByName( - "/singletons/com.sun.star.reflection.theTypeDescriptionManager"), + u"/singletons/com.sun.star.reflection.theTypeDescriptionManager"_ustr), css::uno::UNO_QUERY_THROW); const css::uno::Sequence<OUString> serviceNames( m_xContext->getServiceManager()->getAvailableServiceNames()); @@ -346,7 +346,7 @@ void Test::createInstance( // Instantiating a ConfigurationProvider with no or empty args must // return theDefaultProvider: expImpl = "com.sun.star.comp.configuration.DefaultProvider"; - expServs = {"com.sun.star.configuration.DefaultProvider"}; + expServs = {u"com.sun.star.configuration.DefaultProvider"_ustr}; } else if (name == "com.sun.star.datatransfer.clipboard.SystemClipboard") { // SystemClipboard is a wrapper returning either a platform-specific or // the generic VCLGenericClipboard: @@ -356,19 +356,19 @@ void Test::createInstance( || name == "com.sun.star.datatransfer.dnd.XdndSupport") { expImpl = "com.sun.star.datatransfer.dnd.VclGenericDragSource"; - expServs = {"com.sun.star.datatransfer.dnd.GenericDragSource"}; + expServs = {u"com.sun.star.datatransfer.dnd.GenericDragSource"_ustr}; } else if (name == "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1" || name == "com.sun.star.datatransfer.dnd.XdndDropTarget") { expImpl = "com.sun.star.datatransfer.dnd.VclGenericDropTarget"; - expServs = {"com.sun.star.datatransfer.dnd.GenericDropTarget"}; + expServs = {u"com.sun.star.datatransfer.dnd.GenericDropTarget"_ustr}; #endif } else if (name == "com.sun.star.ui.dialogs.FolderPicker") { // FolderPicker is a wrapper returning either a platform-specific or the // generic OfficeFolderPicker. In headless mode it is always the // generic one. expImpl = "com.sun.star.svtools.OfficeFolderPicker"; - expServs = {"com.sun.star.ui.dialogs.OfficeFolderPicker"}; + expServs = {u"com.sun.star.ui.dialogs.OfficeFolderPicker"_ustr}; } else if (expImpl == "com.sun.star.comp.Calc.SpreadsheetDocument") { expImpl = "ScModelObj"; } else if (expImpl == "com.sun.star.comp.Draw.DrawingDocument" diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx index c9fc096eaf48..450df235ce21 100644 --- a/registry/source/regkey.cxx +++ b/registry/source/regkey.cxx @@ -174,7 +174,7 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, if (pKey->isReadOnly()) return RegError::REGISTRY_READONLY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -213,7 +213,7 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey, if (pKey->isReadOnly()) return RegError::REGISTRY_READONLY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -252,7 +252,7 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey, if (pKey->isReadOnly()) return RegError::REGISTRY_READONLY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -291,7 +291,7 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey, if (pKey->isReadOnly()) return RegError::REGISTRY_READONLY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -333,7 +333,7 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey, RegValueType valueType; sal_uInt32 valueSize; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -376,7 +376,7 @@ RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey, if (pKey->isDeleted()) return RegError::INVALID_KEY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -413,7 +413,7 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, if (pKey->isDeleted()) return RegError::INVALID_KEY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -450,7 +450,7 @@ RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey, if (pKey->isDeleted()) return RegError::INVALID_KEY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; @@ -487,7 +487,7 @@ RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey, if (pKey->isDeleted()) return RegError::INVALID_KEY; - OUString valueName("value"); + OUString valueName(u"value"_ustr); if (keyName->length) { ORegKey* pSubKey = nullptr; diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx index 6dc273ab365e..d4e8f6e9744f 100644 --- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx +++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx @@ -67,7 +67,7 @@ ResolverImpl::ResolverImpl( const Reference< XComponentContext > & xCtx ) // XServiceInfo OUString ResolverImpl::getImplementationName() { - return "com.sun.star.comp.bridge.UnoUrlResolver"; + return u"com.sun.star.comp.bridge.UnoUrlResolver"_ustr; } sal_Bool ResolverImpl::supportsService( const OUString & rServiceName ) @@ -77,7 +77,7 @@ sal_Bool ResolverImpl::supportsService( const OUString & rServiceName ) Sequence< OUString > ResolverImpl::getSupportedServiceNames() { - return { "com.sun.star.bridge.UnoUrlResolver" }; + return { u"com.sun.star.bridge.UnoUrlResolver"_ustr }; } // XUnoUrlResolver @@ -99,7 +99,7 @@ Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl ) } Reference< XConnector > xConnector( - _xSMgr->createInstanceWithContext( "com.sun.star.connection.Connector", _xCtx ), + _xSMgr->createInstanceWithContext( u"com.sun.star.connection.Connector"_ustr, _xCtx ), UNO_QUERY_THROW ); Reference< XConnection > xConnection( xConnector->connect( aConnectDescr ) ); diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 525a17000456..249946f3699c 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -522,7 +522,7 @@ double SAL_CALL AnalysisAddIn::getSeriessum( double fX, double fN, double fM, co // #i32269# 0^0 is undefined, Excel returns #NUM! error if( fX == 0.0 && fN == 0 ) - throw uno::RuntimeException("undefined expression: 0^0"); + throw uno::RuntimeException(u"undefined expression: 0^0"_ustr); if( fX != 0.0 ) { diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 721e23e28f87..e2ad9e2a7557 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -262,7 +262,7 @@ sal_Int32 GetNullDate( const uno::Reference< beans::XPropertySet >& xOpt ) { try { - uno::Any aAny = xOpt->getPropertyValue( "NullDate" ); + uno::Any aAny = xOpt->getPropertyValue( u"NullDate"_ustr ); util::Date aDate; if( aAny >>= aDate ) return DateToDays( aDate.Day, aDate.Month, aDate.Year ); diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index c8839662d04e..81f2f6393a20 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -422,7 +422,7 @@ sal_Int32 GetNullDate( const uno::Reference< beans::XPropertySet >& xOptions ) { try { - uno::Any aAny = xOptions->getPropertyValue( "NullDate" ); + uno::Any aAny = xOptions->getPropertyValue( u"NullDate"_ustr ); util::Date aDate; if ( aAny >>= aDate ) return DateToDays( aDate.Day, aDate.Month, aDate.Year ); diff --git a/smoketest/smoketest.cxx b/smoketest/smoketest.cxx index 3a4f2b1afc86..cbf201450384 100644 --- a/smoketest/smoketest.cxx +++ b/smoketest/smoketest.cxx @@ -141,11 +141,11 @@ void Test::test() { test::getTestArgument( u"smoketest.doc", &doc)); css::uno::Sequence< css::beans::PropertyValue > args{ - { /* Name */ "MacroExecutionMode", + { /* Name */ u"MacroExecutionMode"_ustr, /* Handle */ -1, /* Value */ css::uno::Any(css::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN), /* State */ css::beans::PropertyState_DIRECT_VALUE }, - { /* Name */ "ReadOnly", + { /* Name */ u"ReadOnly"_ustr, /* Handle */ -1, /* Value */ css::uno::Any(true), /* State */ css::beans::PropertyState_DIRECT_VALUE } @@ -162,12 +162,12 @@ void Test::test() { css::uno::Reference< css::frame::XModel >( xDesktop->loadComponentFromURL( test::toAbsoluteFileUrl(doc), - "_default", + u"_default"_ustr, 0, args), css::uno::UNO_QUERY_THROW)->getCurrentController(), css::uno::UNO_SET_THROW)->getFrame(), css::uno::UNO_QUERY_THROW)->queryDispatch( - url, "_self", 0), + url, u"_self"_ustr, 0), css::uno::UNO_QUERY_THROW); Result result; // Shifted to main thread to work around potential deadlocks (i112867): diff --git a/store/qa/store.cxx b/store/qa/store.cxx index 69bc3f8f8674..679c3ebc29c2 100644 --- a/store/qa/store.cxx +++ b/store/qa/store.cxx @@ -43,8 +43,8 @@ void StoreTest::createStream() CPPUNIT_ASSERT_EQUAL(store_E_None, aFile.createInMemory()); store::OStoreStream aStream; - CPPUNIT_ASSERT_EQUAL(store_E_None, - aStream.create(aFile, "testnode", "testname", storeAccessMode::Create)); + CPPUNIT_ASSERT_EQUAL(store_E_None, aStream.create(aFile, u"testnode"_ustr, u"testname"_ustr, + storeAccessMode::Create)); aFile.close(); } @@ -55,8 +55,8 @@ void StoreTest::writeAndReadByte() CPPUNIT_ASSERT_EQUAL(store_E_None, aFile.createInMemory()); store::OStoreStream aStream; - CPPUNIT_ASSERT_EQUAL(store_E_None, - aStream.create(aFile, "testnode", "testname", storeAccessMode::Create)); + CPPUNIT_ASSERT_EQUAL(store_E_None, aStream.create(aFile, u"testnode"_ustr, u"testname"_ustr, + storeAccessMode::Create)); { std::unique_ptr<sal_uInt8[]> pWriteBuffer(new sal_uInt8[1]); diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index c438459b5406..b8095d9804e7 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -646,7 +646,7 @@ static bool performTest( TestPolyStruct< sal_Int64 > tps1(12345); xLBT->transportPolyHyper(tps1); bRet &= check(tps1.member == 12345, "transportPolyHyper"); - Sequence< Any > seq{ Any(static_cast< sal_uInt32 >(33)), Any(OUString("ABC")) }; + Sequence< Any > seq{ Any(static_cast< sal_uInt32 >(33)), Any(u"ABC"_ustr) }; TestPolyStruct< Sequence< Any > > tps2(seq); TestPolyStruct< Sequence< Any > > tps3; xLBT->transportPolySequence(tps2, tps3); @@ -762,8 +762,8 @@ static bool performTest( Sequence<float> arFloat({1.1f, 2.2f, 3.3f}); Sequence<double> arDouble({1.11, 2.22, 3.33}); Sequence<OUString> arString({ - OUString("String 1"), OUString("String 2"), - OUString("String 3")}); + u"String 1"_ustr, u"String 2"_ustr, + u"String 3"_ustr}); Sequence<Any> arAny(_arAny, 3); Sequence<Reference<XInterface> > arObject(_arObj, 3); Sequence<TestEnum> arEnum({ @@ -1157,7 +1157,7 @@ static bool makeSurrogate( OUString aCppEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME ); OUString aUnoEnvTypeName( - UNO_LB_UNO ); + u"" UNO_LB_UNO ""_ustr ); // official: uno_getEnvironment( reinterpret_cast< uno_Environment ** >( &aCppEnv_official ), @@ -1175,7 +1175,7 @@ static bool makeSurrogate( Mapping uno2cpp( aUnoEnv_ano.get(), aCppEnv_ano.get() ); if (!cpp2uno.is() || !uno2cpp.is()) { - throw RuntimeException("cannot get C++-UNO mappings!" ); + throw RuntimeException(u"cannot get C++-UNO mappings!"_ustr ); } cpp2uno.mapInterface( reinterpret_cast< void ** >( &unoI.m_pUnoI ), @@ -1183,7 +1183,7 @@ static bool makeSurrogate( if (! unoI.is()) { throw RuntimeException( - "mapping C++ to binary UNO failed!" ); + u"mapping C++ to binary UNO failed!"_ustr ); } uno2cpp.mapInterface( reinterpret_cast< void ** >( &rOut ), @@ -1191,7 +1191,7 @@ static bool makeSurrogate( if (! rOut.is()) { throw RuntimeException( - "mapping binary UNO to C++ failed!" ); + u"mapping binary UNO to C++ failed!"_ustr ); } return rOut.is(); @@ -1205,8 +1205,8 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) { if (! rArgs.hasElements()) { - throw RuntimeException( "no test object specified!\n" - "usage : ServiceName of test object | -u unourl of test object" ); + throw RuntimeException( u"no test object specified!\n" + "usage : ServiceName of test object | -u unourl of test object"_ustr ); } Reference< XInterface > xOriginal; @@ -1251,7 +1251,7 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) if (! xOriginal.is()) { - throw RuntimeException( "cannot get test object!" ); + throw RuntimeException( u"cannot get test object!"_ustr ); } Reference< XBridgeTest > xTest( xOriginal, UNO_QUERY_THROW ); @@ -1269,7 +1269,7 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) bRet = (dynamic_cast<TestBridgeImpl *>(xOriginal.get()) == nullptr) && bRet; if (! bRet) { - throw RuntimeException( "error: test failed!" ); + throw RuntimeException( u"error: test failed!"_ustr ); } } catch (const Exception & exc) diff --git a/testtools/source/bridgetest/constructors.cxx b/testtools/source/bridgetest/constructors.cxx index 47be30649a42..5fb6d9fb1358 100644 --- a/testtools/source/bridgetest/constructors.cxx +++ b/testtools/source/bridgetest/constructors.cxx @@ -412,11 +412,11 @@ css::uno::Reference< css::uno::XInterface > create( OUString getImplementationName() { return - "comp.test.testtools.bridgetest.Constructors"; + u"comp.test.testtools.bridgetest.Constructors"_ustr; } css::uno::Sequence< OUString > getSupportedServiceNames() { - return { "test.testtools.bridgetest.Constructors" }; + return { u"test.testtools.bridgetest.Constructors"_ustr }; } css::uno::Reference< css::uno::XInterface > create2( @@ -427,11 +427,11 @@ css::uno::Reference< css::uno::XInterface > create2( } OUString getImplementationName2() { - return "comp.test.testtools.bridgetest.Constructors2"; + return u"comp.test.testtools.bridgetest.Constructors2"_ustr; } css::uno::Sequence< OUString > getSupportedServiceNames2() { - return { "test.testtools.bridgetest.Constructors2" }; + return { u"test.testtools.bridgetest.Constructors2"_ustr }; } ::cppu::ImplementationEntry const entries[] = { diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx index e77a582a0907..1c749ef8a086 100644 --- a/testtools/source/bridgetest/cppobj.cxx +++ b/testtools/source/bridgetest/cppobj.cxx @@ -961,7 +961,7 @@ void Test_Impl::testConstructorsService( Sequence< float > arg22{ 0.123f }; Sequence< double > arg23{ 0.456 }; Sequence< sal_Unicode > arg24{ 'X' }; - Sequence< OUString > arg25 { "test" }; + Sequence< OUString > arg25 { u"test"_ustr }; Sequence< Type > arg26{ UnoType< Any >::get() }; Sequence< Any > arg27{ Any(true) }; Sequence< Sequence< sal_Bool > > arg28{ { true } }; @@ -983,7 +983,7 @@ void Test_Impl::testConstructorsService( 0.123f, 0.456, 'X', - "test", + u"test"_ustr, UnoType< Any >::get(), Any(true), arg14, @@ -1024,7 +1024,7 @@ void Test_Impl::testConstructorsService( Any(0.123f), Any(0.456), Any(u'X'), - Any(OUString("test")), + Any(u"test"_ustr), Any(UnoType< Any >::get()), Any(true), Any(arg14), @@ -1074,10 +1074,10 @@ void Test_Impl::testConstructorsService( Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > > argSeq8 { TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > ( TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>( - TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test"))) }; + TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), u"test"_ustr)) }; Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > argSeq9 { TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >( - OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >( + u"test"_ustr, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >( 'X', TestPolyStruct<Any>(Any(true)))) }; Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> > > argSeq10 { TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >( @@ -1090,10 +1090,10 @@ void Test_Impl::testConstructorsService( Sequence<Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > > > argSeq13 { {TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> >( TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString>( - TestPolyStruct2<sal_Unicode,Any>('X', Any(true)), OUString("test")))} }; + TestPolyStruct2<sal_Unicode,Any>('X', Any(true)), u"test"_ustr))} }; Sequence<Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > > argSeq14 { { TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >( - OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >( + u"test"_ustr, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >( 'X', TestPolyStruct<Any>(Any(true)))) } }; Sequence<Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > > > argSeq15 { { TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> >( @@ -1109,7 +1109,7 @@ void Test_Impl::testConstructorsService( TestPolyStruct<sal_Int32>(SAL_MIN_INT32), TestPolyStruct<sal_Int64>(SAL_MIN_INT64), TestPolyStruct<sal_Unicode>('X'), - TestPolyStruct<OUString>(OUString("test")), + TestPolyStruct<OUString>(u"test"_ustr), TestPolyStruct<float>(0.123f), TestPolyStruct<double>(0.456), TestPolyStruct<Reference<XInterface> >(static_cast<XBridgeTest2*>(this)), @@ -1119,9 +1119,9 @@ void Test_Impl::testConstructorsService( TestPolyStruct2<sal_Unicode, Any>('X', Any(true))), TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > ( TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>( - TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test"))), + TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), u"test"_ustr)), TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode,TestPolyStruct<Any> > >( - OUString("test"), + u"test"_ustr, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >('X', TestPolyStruct<Any>(Any(true)))), TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >( TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), diff --git a/testtools/source/bridgetest/multi.cxx b/testtools/source/bridgetest/multi.cxx index 1ac6aa81b135..8d91a952303e 100644 --- a/testtools/source/bridgetest/multi.cxx +++ b/testtools/source/bridgetest/multi.cxx @@ -118,30 +118,30 @@ OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( multi, css::uno::UNO_QUERY_THROW)->fn11(5)); checkEqual( - OUString("12" "abc"), + u"12" "abc"_ustr, css::uno::Reference< test::testtools::bridgetest::XMultiBase1 >( multi, css::uno::UNO_QUERY_THROW)->fn12( - "abc")); + u"abc"_ustr)); checkEqual( - OUString("12" "abc-2"), + u"12" "abc-2"_ustr, static_cast< test::testtools::bridgetest::XMultiBase2 * >( - multi.get())->fn12("abc-2")); + multi.get())->fn12(u"abc-2"_ustr)); checkEqual( - OUString("12" "abc-2"), + u"12" "abc-2"_ustr, css::uno::Reference< test::testtools::bridgetest::XMultiBase2 >( - multi, css::uno::UNO_QUERY_THROW)->fn12("abc-2")); + multi, css::uno::UNO_QUERY_THROW)->fn12(u"abc-2"_ustr)); checkEqual( - OUString("12" "abc-5"), + u"12" "abc-5"_ustr, static_cast< test::testtools::bridgetest::XMultiBase5 * >( - multi.get())->fn12("abc-5")); + multi.get())->fn12(u"abc-5"_ustr)); checkEqual( - OUString("12" "abc-5"), + u"12" "abc-5"_ustr, css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( - multi, css::uno::UNO_QUERY_THROW)->fn12("abc-5")); + multi, css::uno::UNO_QUERY_THROW)->fn12(u"abc-5"_ustr)); checkEqual< sal_Int32 >(21 * 2, multi->fn21(2)); checkEqual( - OUString("22" "de"), - multi->fn22("de")); + u"22" "de"_ustr, + multi->fn22(u"de"_ustr)); checkEqual< sal_Int32 >( 31 * 3, css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( @@ -181,17 +181,17 @@ OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( multi, css::uno::UNO_QUERY_THROW)->getatt3()); checkEqual( - OUString("32" "f"), + u"32" "f"_ustr, css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( - multi, css::uno::UNO_QUERY_THROW)->fn32("f")); + multi, css::uno::UNO_QUERY_THROW)->fn32(u"f"_ustr)); checkEqual( - OUString("32" "f-5"), + u"32" "f-5"_ustr, static_cast< test::testtools::bridgetest::XMultiBase5 * >( - multi.get())->fn32("f-5")); + multi.get())->fn32(u"f-5"_ustr)); checkEqual( - OUString("32" "f-5"), + u"32" "f-5"_ustr, css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( - multi, css::uno::UNO_QUERY_THROW)->fn32("f-5")); + multi, css::uno::UNO_QUERY_THROW)->fn32(u"f-5"_ustr)); checkEqual< sal_Int32 >( 33, css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( @@ -207,12 +207,12 @@ OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > checkEqual< sal_Int32 >(41 * 4, multi->fn41(4)); checkEqual< sal_Int32 >(61 * 6, multi->fn61(6)); checkEqual( - OUString("62" ""), + u"62" ""_ustr, multi->fn62(OUString())); checkEqual< sal_Int32 >(71 * 7, multi->fn71(7)); checkEqual( - OUString("72" "g"), - multi->fn72("g")); + u"72" "g"_ustr, + multi->fn72(u"g"_ustr)); checkEqual< sal_Int32 >(73, multi->fn73()); } catch (CheckFailed const & f) { return f.message; diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx index 0942d7cde694..7555ba7f43a6 100644 --- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx @@ -781,18 +781,18 @@ static OString generateClassDefinition(std::ostream& o, << scopedCppName(u2b(propertyhelper)) << " >(\n" " context, static_cast< Implements >(\n "; OStringBuffer buffer(128); - if (propinterfaces.find("com/sun/star/beans/XPropertySet") + if (propinterfaces.find(u"com/sun/star/beans/XPropertySet"_ustr) != propinterfaces.end()) { buffer.append("IMPLEMENTS_PROPERTY_SET"); } - if (propinterfaces.find("com/sun/star/beans/XFastPropertySet") + if (propinterfaces.find(u"com/sun/star/beans/XFastPropertySet"_ustr) != propinterfaces.end()) { if (!buffer.isEmpty()) buffer.append(" | IMPLEMENTS_FAST_PROPERTY_SET"); else buffer.append("IMPLEMENTS_FAST_PROPERTY_SET"); } - if (propinterfaces.find("com/sun/star/beans/XPropertyAccess") + if (propinterfaces.find(u"com/sun/star/beans/XPropertyAccess"_ustr) != propinterfaces.end()) { if (!buffer.isEmpty()) buffer.append(" | IMPLEMENTS_PROPERTY_ACCESS"); @@ -945,9 +945,9 @@ void generateSkeleton(ProgramOptions const & options, // so it is defaulted. The XDispatchProvider provides Dispatch objects for // certain functions and the generated impl object implements XDispatch // directly for simplicity reasons. - checkType(manager, "com.sun.star.frame.ProtocolHandler", + checkType(manager, u"com.sun.star.frame.ProtocolHandler"_ustr, interfaces, services, properties); - checkType(manager, "com.sun.star.frame.XDispatch", + checkType(manager, u"com.sun.star.frame.XDispatch"_ustr, interfaces, services, properties); } @@ -962,8 +962,8 @@ void generateSkeleton(ProgramOptions const & options, if (interfaces.size() > 12) throw CannotDumpException( - "the skeletonmaker supports components with 12 interfaces " - "only (limitation of the UNO implementation helpers)!"); + u"the skeletonmaker supports components with 12 interfaces " + "only (limitation of the UNO implementation helpers)!"_ustr); supportxcomponent = checkXComponentSupport(manager, interfaces); @@ -1075,8 +1075,8 @@ void generateCalcAddin(ProgramOptions const & options, OUString sAddinService; if (services.size() != 1) { throw CannotDumpException( - "for calc add-in components one and only one service type is necessary!" - " Please reference a valid type with the '-t' option."); + u"for calc add-in components one and only one service type is necessary!" + " Please reference a valid type with the '-t' option."_ustr); } @@ -1093,13 +1093,13 @@ void generateCalcAddin(ProgramOptions const & options, // taken from the configuration from Calc directly, this simplifies the // add-in code if (options.backwardcompatible) { - checkType(manager, "com.sun.star.sheet.AddIn", + checkType(manager, u"com.sun.star.sheet.AddIn"_ustr, interfaces, services, properties); } else { // special case for the optional XLocalization interface. It should be // implemented always. But it is parent of the XAddIn and we need it only // if backwardcompatible is false. - interfaces.insert("com.sun.star.lang.XLocalizable"); + interfaces.insert(u"com.sun.star.lang.XLocalizable"_ustr); } OUString propertyhelper = checkPropertyHelper( @@ -1113,8 +1113,8 @@ void generateCalcAddin(ProgramOptions const & options, if (interfaces.size() > 12) { throw CannotDumpException( - "the skeletonmaker supports components with 12 interfaces " - "only (limitation of the UNO implementation helpers)!"); + u"the skeletonmaker supports components with 12 interfaces " + "only (limitation of the UNO implementation helpers)!"_ustr); } // check if service object or simple UNO object diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx index 1de92fac0bc2..916c96a2c196 100644 --- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx @@ -820,17 +820,17 @@ void generateSkeleton(ProgramOptions const & options, // so it is defaulted. The XDispatchProvider provides Dispatch objects for // certain functions and the generated impl object implements XDispatch // directly for simplicity reasons. - checkType(manager, "com.sun.star.frame.ProtocolHandler", + checkType(manager, u"com.sun.star.frame.ProtocolHandler"_ustr, interfaces, services, properties); - checkType(manager, "com.sun.star.frame.XDispatch", + checkType(manager, u"com.sun.star.frame.XDispatch"_ustr, interfaces, services, properties); } if (options.componenttype == 2) { if (services.size() != 1) { throw CannotDumpException( - "for calc add-in components one and only one service type is " - "necessary! Please reference a valid type with the '-t' option."); + u"for calc add-in components one and only one service type is " + "necessary! Please reference a valid type with the '-t' option."_ustr); } // if backwardcompatible==true the AddIn service needs to be added to the @@ -839,13 +839,13 @@ void generateSkeleton(ProgramOptions const & options, // taken from the configuration from Calc directly, this simplifies the // add-in code if (options.backwardcompatible) { - checkType(manager, "com.sun.star.sheet.AddIn", + checkType(manager, u"com.sun.star.sheet.AddIn"_ustr, interfaces, services, properties); } else { // special case for the optional XLocalization interface. It should be // implemented always. But it is parent of the XAddIn and we need it only // if backwardcompatible is false. - interfaces.insert("com.sun.star.lang.XLocalizable"); + interfaces.insert(u"com.sun.star.lang.XLocalizable"_ustr); } } diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/unodevtools/source/skeletonmaker/skeletoncommon.cxx index 664bc90888aa..a2623b652e4e 100644 --- a/unodevtools/source/skeletonmaker/skeletoncommon.cxx +++ b/unodevtools/source/skeletonmaker/skeletoncommon.cxx @@ -188,7 +188,7 @@ void checkType(rtl::Reference< TypeManager > const & manager, (ent2->getConstructors().size() == 1 && !ent2->getConstructors()[0].defaultConstructor)) { - interfaceTypes.insert(OUString("com.sun.star.lang.XInitialization")); + interfaceTypes.insert(u"com.sun.star.lang.XInitialization"_ustr); } } } @@ -228,15 +228,15 @@ void checkDefaultInterfaces( std::u16string_view propertyhelper) { if ( services.empty() ) { - interfaces.erase("com.sun.star.lang.XServiceInfo"); + interfaces.erase(u"com.sun.star.lang.XServiceInfo"_ustr); } else { - interfaces.insert("com.sun.star.lang.XServiceInfo"); + interfaces.insert(u"com.sun.star.lang.XServiceInfo"_ustr); } if ( propertyhelper == u"_" ) { - interfaces.erase("com.sun.star.beans.XPropertySet"); - interfaces.erase("com.sun.star.beans.XFastPropertySet"); - interfaces.erase("com.sun.star.beans.XPropertyAccess"); + interfaces.erase(u"com.sun.star.beans.XPropertySet"_ustr); + interfaces.erase(u"com.sun.star.beans.XFastPropertySet"_ustr); + interfaces.erase(u"com.sun.star.beans.XPropertyAccess"_ustr); } } @@ -314,7 +314,7 @@ OUString checkPropertyHelper( ++iter; } - return oldStyleWithProperties ? OUString("_") : OUString(); + return oldStyleWithProperties ? u"_"_ustr : OUString(); } static bool checkXComponentSupport( @@ -349,7 +349,7 @@ bool checkXComponentSupport(rtl::Reference< TypeManager > const & manager, for ( const auto& rIface : interfaces ) { if ( rIface == "com.sun.star.lang.XComponent" ) { - interfaces.erase("com.sun.star.lang.XComponent"); + interfaces.erase(u"com.sun.star.lang.XComponent"_ustr); return true; } if ( checkXComponentSupport(manager, rIface) ) @@ -467,13 +467,11 @@ static void checkAddInTypes( + " parameter of the calc add-in function '" + name + ":" + rMethod.name + "' is invalid." + (bLastAny - ? OUString( - " The type 'sequence<any>' is allowed as last" - " parameter only.") + ? u" The type 'sequence<any>' is allowed as last" + " parameter only."_ustr : OUString()) + (bHasXPropertySet - ? OUString( - " The type 'XPropertySet' is allowed only once.") + ? u" The type 'XPropertySet' is allowed only once."_ustr : OUString()) + " Please check your IDL definition."); } diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 3d5bc326f7f7..7106a3d6d132 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -69,7 +69,7 @@ MacrosTest::loadFromDesktop(const OUString& rURL, const OUString& rDocService, args.insert(args.end(), rExtraArgs.begin(), rExtraArgs.end()); uno::Reference<lang::XComponent> xComponent = mxDesktop->loadComponentFromURL( - rURL, "_default", 0, comphelper::containerToSequence(args)); + rURL, u"_default"_ustr, 0, comphelper::containerToSequence(args)); OUString sMessage = "loading failed: " + rURL; CPPUNIT_ASSERT_MESSAGE(OUStringToOString(sMessage, RTL_TEXTENCODING_UTF8).getStr(), xComponent.is()); @@ -139,7 +139,7 @@ void MacrosTest::setUpX509(const test::Directories& rDirectories, const OUString osl::File::copy(aSourceDir + "key4.db", aTargetDir + "/key4.db"); osl::File::copy(aSourceDir + "pkcs11.txt", aTargetDir + "/pkcs11.txt"); - OUString mozCertVar("MOZILLA_CERTIFICATE_FOLDER"); + OUString mozCertVar(u"MOZILLA_CERTIFICATE_FOLDER"_ustr); // explicit prefix with "sql:" needed for CentOS7 system NSS 3.67 osl_setEnvironment(mozCertVar.pData, OUString("sql:" + aTargetPath).pData); #endif @@ -160,7 +160,7 @@ void MacrosTest::setUpGpg(const test::Directories& rDirectories, const OUString& osl::File::copy(aSourceDir + "secring.gpg", aTargetDir + "/secring.gpg"); osl::File::copy(aSourceDir + "trustdb.gpg", aTargetDir + "/trustdb.gpg"); - OUString gpgHomeVar("GNUPGHOME"); + OUString gpgHomeVar(u"GNUPGHOME"_ustr); osl_setEnvironment(gpgHomeVar.pData, aTargetPath.pData); #if HAVE_GPGCONF_SOCKETDIR diff --git a/unotest/source/cpp/officeconnection.cxx b/unotest/source/cpp/officeconnection.cxx index 850b19440d00..fbf4df058439 100644 --- a/unotest/source/cpp/officeconnection.cxx +++ b/unotest/source/cpp/officeconnection.cxx @@ -50,20 +50,20 @@ void OfficeConnection::setUp() { u"soffice", &argSoffice)); if (argSoffice.match("path:")) { - desc = "pipe,name=" + osl::test::uniquePipeName("oootest"); - OUString noquickArg("--quickstart=no"); - OUString norestoreArg("--norestore"); - OUString nologoArg("--nologo"); + desc = "pipe,name=" + osl::test::uniquePipeName(u"oootest"_ustr); + OUString noquickArg(u"--quickstart=no"_ustr); + OUString norestoreArg(u"--norestore"_ustr); + OUString nologoArg(u"--nologo"_ustr); // disable use of the unix standalone splash screen app for the // tests (probably not needed in combination with --headless?) - OUString headlessArg("--headless"); + OUString headlessArg(u"--headless"_ustr); OUString acceptArg("--accept=" + desc + ";urp"); OUString argUser; CPPUNIT_ASSERT( getArgument(u"user", &argUser)); OUString userArg("-env:UserInstallation=" + toAbsoluteFileUrl(argUser)); OUString jreArg( - "-env:UNO_JAVA_JFW_ENV_JREHOME=true"); + u"-env:UNO_JAVA_JFW_ENV_JREHOME=true"_ustr); rtl_uString * args[] = { noquickArg.pData, norestoreArg.pData, nologoArg.pData, headlessArg.pData, acceptArg.pData, userArg.pData, diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 1b5db975e2f2..b3b58b3f4783 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -207,7 +207,7 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools public: SvmTest() : BootstrapFixture(true, false) - , maDataUrl("/vcl/qa/cppunit/svm/data/") + , maDataUrl(u"/vcl/qa/cppunit/svm/data/"_ustr) {} CPPUNIT_TEST_SUITE(SvmTest); @@ -363,22 +363,22 @@ xmlDocUniquePtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile) void SvmTest::checkVirtualDevice(const xmlDocUniquePtr& pDoc) { - assertXPath(pDoc, "/metafile/linecolor[1]"_ostr, "color"_ostr, "#000000"); - assertXPath(pDoc, "/metafile/fillcolor[1]"_ostr, "color"_ostr, "#ffffff"); + assertXPath(pDoc, "/metafile/linecolor[1]"_ostr, "color"_ostr, u"#000000"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[1]"_ostr, "color"_ostr, u"#ffffff"_ustr); assertXPathAttrs(pDoc, "/metafile/rect[1]"_ostr, { {"left", "0"}, {"top", "0"}, {"right", "9"}, {"bottom", "9"} }); - assertXPath(pDoc, "/metafile/linecolor[2]"_ostr, "color"_ostr, "#000000"); - assertXPath(pDoc, "/metafile/fillcolor[2]"_ostr, "color"_ostr, "#ffffff"); + assertXPath(pDoc, "/metafile/linecolor[2]"_ostr, "color"_ostr, u"#000000"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[2]"_ostr, "color"_ostr, u"#ffffff"_ustr); } void SvmTest::checkErase(const xmlDocUniquePtr& pDoc) { - assertXPath(pDoc, "/metafile/linecolor[3]"_ostr, "color"_ostr, "#000000"); - assertXPath(pDoc, "/metafile/fillcolor[3]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDoc, "/metafile/linecolor[3]"_ostr, "color"_ostr, u"#000000"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[3]"_ostr, "color"_ostr, u"#ff0000"_ustr); assertXPathAttrs(pDoc, "/metafile/rect[2]"_ostr, { {"left", "0"}, {"top", "0"}, @@ -490,8 +490,8 @@ void SvmTest::checkRect(const GDIMetaFile& rMetaFile) xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#123456"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, u"#654321"_ustr); assertXPathAttrs(pDoc, "/metafile/rect[3]"_ostr, { {"left", "1"}, {"top", "2"}, @@ -518,8 +518,8 @@ void SvmTest::checkRoundRect(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#123456"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, u"#654321"_ustr); assertXPathAttrs(pDoc, "/metafile/roundrect[1]"_ostr, { {"left", "1"}, {"top", "2"}, @@ -547,8 +547,8 @@ void SvmTest::checkEllipse(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#123456"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, u"#654321"_ustr); assertXPathAttrs(pDoc, "/metafile/ellipse[1]"_ostr, { {"left", "1"}, {"top", "2"}, @@ -575,8 +575,8 @@ void SvmTest::checkArc(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#123456"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, u"#654321"_ustr); assertXPathAttrs(pDoc, "/metafile/arc[1]"_ostr, { {"left", "1"}, {"top", "2"}, @@ -606,8 +606,8 @@ void SvmTest::checkPie(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#123456"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, u"#654321"_ustr); assertXPathAttrs(pDoc, "/metafile/pie[1]"_ostr, { {"left", "11"}, {"top", "12"}, @@ -637,8 +637,8 @@ void SvmTest::checkChord(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, u"#123456"_ustr); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, u"#654321"_ustr); assertXPathAttrs(pDoc, "/metafile/chord[1]"_ostr, { {"left", "21"}, {"top", "22"}, @@ -830,7 +830,7 @@ void SvmTest::checkText(const GDIMetaFile& rMetaFile) {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "2"}, }); - assertXPathContent(pDoc, "/metafile/text[1]/textcontent"_ostr, "xABC"); + assertXPathContent(pDoc, "/metafile/text[1]/textcontent"_ostr, u"xABC"_ustr); } void SvmTest::testText() @@ -839,7 +839,7 @@ void SvmTest::testText() ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); - pVirtualDev->DrawText(Point(4,6), "xABC", 1, 2); + pVirtualDev->DrawText(Point(4,6), u"xABC"_ustr, 1, 2); checkText(writeAndReadStream(aGDIMetaFile)); checkText(readFile(u"text.svm")); @@ -852,8 +852,8 @@ void SvmTest::checkTextArray(const GDIMetaFile& rMetaFile) assertXPathAttrs(pDoc, "/metafile/textarray[1]"_ostr, { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, }); - assertXPathContent(pDoc, "/metafile/textarray[1]/dxarray"_ostr, "15 20 25 "); - assertXPathContent(pDoc, "/metafile/textarray[1]/text"_ostr, "123456"); + assertXPathContent(pDoc, "/metafile/textarray[1]/dxarray"_ostr, u"15 20 25 "_ustr); + assertXPathContent(pDoc, "/metafile/textarray[1]/text"_ostr, u"123456"_ustr); } void SvmTest::testTextArray() @@ -862,7 +862,7 @@ void SvmTest::testTextArray() ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); sal_Int32 const aDX[] = { 10, 15, 20, 25, 30, 35 }; - pVirtualDev->DrawTextArray(Point(4,6), "123456", KernArraySpan(aDX), {}, 1, 4); + pVirtualDev->DrawTextArray(Point(4,6), u"123456"_ustr, KernArraySpan(aDX), {}, 1, 4); checkTextArray(writeAndReadStream(aGDIMetaFile)); checkTextArray(readFile(u"textarray.svm")); @@ -876,7 +876,7 @@ void SvmTest::checkstretchText(const GDIMetaFile& rMetaFile) {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, {"width", "10"} }); - assertXPathContent(pDoc, "/metafile/stretchtext[1]/textcontent"_ostr, "123456"); + assertXPathContent(pDoc, "/metafile/stretchtext[1]/textcontent"_ostr, u"123456"_ustr); } void SvmTest::teststretchText() @@ -884,7 +884,7 @@ void SvmTest::teststretchText() GDIMetaFile aGDIMetaFile; ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); - pVirtualDev->DrawStretchText(Point(4,6), 10, "123456", 1, 4); + pVirtualDev->DrawStretchText(Point(4,6), 10, u"123456"_ustr, 1, 4); checkstretchText(writeAndReadStream(aGDIMetaFile)); checkstretchText(readFile(u"strecthtext.svm")); @@ -897,8 +897,8 @@ void SvmTest::checkTextRect(const GDIMetaFile& rMetaFile) assertXPathAttrs(pDoc, "/metafile/textrect[1]"_ostr, { {"left", "0"}, {"top", "0"}, {"right", "4"}, {"bottom", "4"} }); - assertXPathContent(pDoc, "/metafile/textrect[1]/textcontent"_ostr, "123456"); - assertXPathContent(pDoc, "/metafile/textrect[1]/style"_ostr, "Center"); + assertXPathContent(pDoc, "/metafile/textrect[1]/textcontent"_ostr, u"123456"_ustr); + assertXPathContent(pDoc, "/metafile/textrect[1]/style"_ostr, u"Center"_ustr); } void SvmTest::testTextRect() @@ -906,7 +906,7 @@ void SvmTest::testTextRect() GDIMetaFile aGDIMetaFile; ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); - pVirtualDev->DrawText(tools::Rectangle(Point(0,0), Size(5,5)), "123456", DrawTextFlags::Center); + pVirtualDev->DrawText(tools::Rectangle(Point(0,0), Size(5,5)), u"123456"_ustr, DrawTextFlags::Center); checkTextRect(writeAndReadStream(aGDIMetaFile)); checkTextRect(readFile(u"textrectangle.svm")); @@ -1028,34 +1028,34 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile, bool bIsSvmFile) "742c3e35", #else #if !ENABLE_CAIRO_RGBA - "ac936607", // typical BGRA little-endian config + u"ac936607"_ustr, // typical BGRA little-endian config #else "ecd75a28", // atypical RGBA little-endian config #endif - "4937e32d", + u"4937e32d"_ustr, #if !ENABLE_CAIRO_RGBA - "3789377b", // typical BGRA little-endian config + u"3789377b"_ustr, // typical BGRA little-endian config #else "469f0820", // atypical RGBA little-endian config #endif - "839e8cce", - "236aaf55", // 1-bit - "2949ccc7", // 4-bit color bitmap - same as 8-bit color bitmap - "2949ccc7", - "e5df8aad", + u"839e8cce"_ustr, + u"236aaf55"_ustr, // 1-bit + u"2949ccc7"_ustr, // 4-bit color bitmap - same as 8-bit color bitmap + u"2949ccc7"_ustr, + u"e5df8aad"_ustr, #endif }; static const std::array<OUString, 8> aExpectedContentChecksum { - "26bdebd04e5b18d685cea04982179e273ee3b659", - "f4f52df6ef965a2f0fbccbe6aca35ba3457cf9d5", - "7c953a06d34bbd38897f950d595df2880dbb0f75", - "ca3e5cdde1c395e1ee76d339a5bf6e46fbac3249", - "8a1ebc46f890eb0879464c6e293bffd4ce7fadc0", // 1-bit - "23611fc9f484c23e45bbd457730adb8ab5355509", // 4-bit color bitmap - same as 8-bit color bitmap - "23611fc9f484c23e45bbd457730adb8ab5355509", - "97e499b74104debf12f99a774a2c4edc914d8900", + u"26bdebd04e5b18d685cea04982179e273ee3b659"_ustr, + u"f4f52df6ef965a2f0fbccbe6aca35ba3457cf9d5"_ustr, + u"7c953a06d34bbd38897f950d595df2880dbb0f75"_ustr, + u"ca3e5cdde1c395e1ee76d339a5bf6e46fbac3249"_ustr, + u"8a1ebc46f890eb0879464c6e293bffd4ce7fadc0"_ustr, // 1-bit + u"23611fc9f484c23e45bbd457730adb8ab5355509"_ustr, // 4-bit color bitmap - same as 8-bit color bitmap + u"23611fc9f484c23e45bbd457730adb8ab5355509"_ustr, + u"97e499b74104debf12f99a774a2c4edc914d8900"_ustr, }; assertXPathAttrs(pDoc, "/metafile/bmpex[1]"_ostr, { @@ -1991,8 +1991,8 @@ void SvmTest::testFont() setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); vcl::Font aFont(FontFamily::FAMILY_SCRIPT, Size(15, 15)); aFont.SetWeight(FontWeight::WEIGHT_THIN); - aFont.SetFamilyName("Liberation Sans"); - aFont.SetStyleName("Regular"); + aFont.SetFamilyName(u"Liberation Sans"_ustr); + aFont.SetStyleName(u"Regular"_ustr); aFont.SetFontHeight(12); aFont.SetAverageFontWidth(12); aFont.SetVertical(true); @@ -2273,7 +2273,7 @@ void SvmTest::checkComment(const GDIMetaFile& rMetafile) {"value", "0"} }); - assertXPathContent(pDoc, "/metafile/comment[1]/comment[1]"_ostr, "Test comment"); + assertXPathContent(pDoc, "/metafile/comment[1]/comment[1]"_ostr, u"Test comment"_ustr); assertXPathAttrs(pDoc, "/metafile/comment[2]"_ostr, { {"datasize", "48"} @@ -2287,7 +2287,7 @@ void SvmTest::checkComment(const GDIMetaFile& rMetafile) {"value", "4"} }); - assertXPathContent(pDoc, "/metafile/comment[2]/comment[1]"_ostr, "This is a test comment"); + assertXPathContent(pDoc, "/metafile/comment[2]/comment[1]"_ostr, u"This is a test comment"_ustr); } void SvmTest::testComment() diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx index 29433c561fb7..b022b9141f14 100644 --- a/xmlreader/source/span.cxx +++ b/xmlreader/source/span.cxx @@ -41,7 +41,7 @@ OUString Span::convertFromUtf8() const { RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) { throw css::uno::RuntimeException( - "cannot convert from UTF-8"); + u"cannot convert from UTF-8"_ustr); } return OUString(s, SAL_NO_ACQUIRE); } |