include/rtl/ustring.hxx                             |  107 --------------------
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx |   10 +
 2 files changed, 6 insertions(+), 111 deletions(-)

New commits:
commit 1ef0261539ca6ee8ad9f43d91536c9caa4f7ea53
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Nov 11 08:04:02 2021 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Nov 11 10:01:39 2021 +0100

    Drop the OUString vs. OUStringLiteral comparison operator overloads
    
    ...which can be subsumed by their OUString vs. OUString counterparts now 
that
    conversion from OUStringLiteral to OUString is cheap since
    e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a
    consteval'ed, static-refcound rtl_uString".  (The only place that needed
    adaption was the dubious use of temporary OUStringLiteral instances in
    sal/qa/rtl/strings/test_oustring_stringliterals.cxx, which now caused 
"error:
    conversion function from 'rtlunittest::OUStringLiteral<6>' to
    'const rtlunittest::OUString' invokes a deleted function".)
    
    Change-Id: I4f0f96efa2d5331ed5cbc9a29bdfdf3c0f4148a7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125020
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 9a893d3764af..1a5ff2d97d6c 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -1845,113 +1845,6 @@ public:
     }
 #endif
 
-#if defined LIBO_INTERNAL_ONLY
-    /// @cond INTERNAL
-
-    /* Comparison between OUString and OUStringLiteral.
-
-       @since LibreOffice 5.0
-    */
-
-    template<std::size_t N>
-    friend bool operator ==(OUString const & lhs, OUStringLiteral<N> const & 
rhs) {
-        return
-            rtl_ustr_reverseCompare_WithLength(
-                lhs.pData->buffer, lhs.pData->length, rhs.getStr(), 
rhs.getLength())
-            == 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator !=(OUString const & lhs, OUStringLiteral<N> const & 
rhs) {
-        return
-            rtl_ustr_reverseCompare_WithLength(
-                lhs.pData->buffer, lhs.pData->length, rhs.getStr(), 
rhs.getLength())
-            != 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator <(OUString const & lhs, OUStringLiteral<N> const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.pData->buffer, lhs.pData->length, rhs.getStr(), 
rhs.getLength()))
-            < 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator <=(OUString const & lhs, OUStringLiteral<N> const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.pData->buffer, lhs.pData->length, rhs.getStr(), 
rhs.getLength()))
-            <= 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator >(OUString const & lhs, OUStringLiteral<N> const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.pData->buffer, lhs.pData->length, rhs.getStr(), 
rhs.getLength()))
-            > 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator >=(OUString const & lhs, OUStringLiteral<N> const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.pData->buffer, lhs.pData->length, rhs.getStr(), 
rhs.getLength()))
-            >= 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator ==(OUStringLiteral<N> const & lhs, OUString const & 
rhs) {
-        return
-            rtl_ustr_reverseCompare_WithLength(
-                lhs.getStr(), lhs.getLength(), rhs.pData->buffer, 
rhs.pData->length)
-            == 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator !=(OUStringLiteral<N> const & lhs, OUString const & 
rhs) {
-        return
-            rtl_ustr_reverseCompare_WithLength(
-                lhs.getStr(), lhs.getLength(), rhs.pData->buffer, 
rhs.pData->length)
-            != 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator <(OUStringLiteral<N> const & lhs, OUString const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.getStr(), lhs.getLength(), rhs.pData->buffer, 
rhs.pData->length))
-            < 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator <=(OUStringLiteral<N> const & lhs, OUString const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.getStr(), lhs.getLength(), rhs.pData->buffer, 
rhs.pData->length))
-            <= 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator >(OUStringLiteral<N> const & lhs, OUString const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.getStr(), lhs.getLength(), rhs.pData->buffer, 
rhs.pData->length))
-            > 0;
-    }
-
-    template<std::size_t N>
-    friend bool operator >=(OUStringLiteral<N> const & lhs, OUString const & 
rhs) {
-        return
-            (rtl_ustr_compare_WithLength(
-                lhs.getStr(), lhs.getLength(), rhs.pData->buffer, 
rhs.pData->length))
-            >= 0;
-    }
-
-    /// @endcond
-#endif
-
     /**
       Returns a hashcode for this string.
 
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx 
b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 24867050fb7f..9227cac84e7e 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -213,10 +213,12 @@ void 
test::oustring::StringLiterals::checkOUStringLiteral()
     CPPUNIT_ASSERT(
         s1.endsWithIgnoreAsciiCase(rtlunittest::OUStringLiteral(u"EFDE"), 
&s2));
     CPPUNIT_ASSERT_EQUAL(rtl::OUString("d"), s2);
-    CPPUNIT_ASSERT(bool(s1 == rtlunittest::OUStringLiteral(u"defde")));
-    CPPUNIT_ASSERT(bool(rtlunittest::OUStringLiteral(u"defde") == s1));
-    CPPUNIT_ASSERT(s1 != rtlunittest::OUStringLiteral(u"abc"));
-    CPPUNIT_ASSERT(rtlunittest::OUStringLiteral(u"abc") != s1);
+    static constexpr rtlunittest::OUStringLiteral defde(u"defde");
+    CPPUNIT_ASSERT(bool(s1 == defde));
+    CPPUNIT_ASSERT(bool(defde == s1));
+    static constexpr rtlunittest::OUStringLiteral abc(u"abc");
+    CPPUNIT_ASSERT(s1 != abc);
+    CPPUNIT_ASSERT(abc != s1);
     CPPUNIT_ASSERT_EQUAL(
         sal_Int32(3), s1.indexOf(rtlunittest::OUStringLiteral(u"de"), 1));
     CPPUNIT_ASSERT_EQUAL(

Reply via email to