diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-01-22 12:24:04 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-01-22 12:27:09 +0100 |
commit | 98e90120119360a2b3e92310f98931fce5c12271 (patch) | |
tree | e11400918175cedbc20632278212032602827be3 /tools | |
parent | fea25896a87aa5826eb243069d34aae7d0333a4c (diff) |
make fast string concat comparisons non-ambiguous
Follow-up to https://gerrit.libreoffice.org/#/c/1803/ .
Change-Id: I9131854a579ef57e38dfef7faa539bec98fc305b
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/string.hxx | 52 |
1 files changed, 52 insertions, 0 deletions
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: */ |