diff options
-rw-r--r-- | cui/source/dialogs/scriptdlg.cxx | 5 | ||||
-rw-r--r-- | tools/inc/tools/string.hxx | 52 |
2 files changed, 54 insertions, 3 deletions
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 944ca6f01f0f..959f3a1379c0 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -910,7 +910,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) } for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) { - if (OUString(aNewName+extn) == childNodes[index]->getName()) + if (aNewName+extn == childNodes[index]->getName()) { bFound = sal_True; break; @@ -939,8 +939,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) bValid = sal_True; for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) { - if (OUString(aUserSuppliedName+extn) - == childNodes[index]->getName()) + if (aUserSuppliedName+extn == childNodes[index]->getName()) { bValid = sal_False; String aError( m_createErrStr ); diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index 0adf08cdc1cf..ce81a613ac8c 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -355,6 +355,58 @@ inline bool operator!=(::rtl::OUString const& rLeft, UniString const& rRight) return rLeft != ::rtl::OUString(rRight); } +#ifdef RTL_FAST_STRING +// The above operators make comparisons involving fast string concatenation ambiguous, so provide explicit overloads. +template< typename T1, typename T2 > +inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str ) +{ + return OUString( concat ) == str; +} + +template< typename T1, typename T2 > +inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str ) +{ + return OUString( concat ) == str; +} + +template< typename T1, typename T2 > +inline bool operator==( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat ) +{ + return str == OUString( concat ); +} + +template< typename T1, typename T2 > +inline bool operator!=( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat ) +{ + return str != OUString( concat ); +} + +template< typename T1, typename T2 > +inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str ) +{ + return UniString( concat ) == str; +} + +template< typename T1, typename T2 > +inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str ) +{ + return UniString( concat ) == str; +} + +template< typename T1, typename T2 > +inline bool operator==( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat ) +{ + return str == UniString( concat ); +} + +template< typename T1, typename T2 > +inline bool operator!=( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat ) +{ + return str != UniString( concat ); +} + +#endif + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |