diff options
-rw-r--r-- | include/rtl/ustring.hxx | 86 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_strings_defaultstringview.cxx | 18 |
2 files changed, 9 insertions, 95 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 270eedd2c32d..ee3cfe170555 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -1950,92 +1950,6 @@ public: /// @endcond #endif -#if defined LIBO_INTERNAL_ONLY - friend bool operator ==(OUString const & lhs, std::u16string_view rhs) { - return - rtl_ustr_reverseCompare_WithLength( - lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size()) - == 0; - } - - friend bool operator !=(OUString const & lhs, std::u16string_view rhs) { - return - rtl_ustr_reverseCompare_WithLength( - lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size()) - != 0; - } - - friend bool operator <(OUString const & lhs, std::u16string_view rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size())) - < 0; - } - - friend bool operator <=(OUString const & lhs, std::u16string_view rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size())) - <= 0; - } - - friend bool operator >(OUString const & lhs, std::u16string_view rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size())) - > 0; - } - - friend bool operator >=(OUString const & lhs, std::u16string_view rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size())) - >= 0; - } - - friend bool operator ==(std::u16string_view lhs, OUString const & rhs) { - return - rtl_ustr_reverseCompare_WithLength( - lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length) - == 0; - } - - friend bool operator !=(std::u16string_view lhs, OUString const & rhs) { - return - rtl_ustr_reverseCompare_WithLength( - lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length) - != 0; - } - - friend bool operator <(std::u16string_view lhs, OUString const & rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length)) - < 0; - } - - friend bool operator <=(std::u16string_view lhs, OUString const & rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length)) - <= 0; - } - - friend bool operator >(std::u16string_view lhs, OUString const & rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length)) - > 0; - } - - friend bool operator >=(std::u16string_view lhs, OUString const & rhs) { - return - (rtl_ustr_compare_WithLength( - lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length)) - >= 0; - } -#endif - /** Returns a hashcode for this string. diff --git a/sal/qa/rtl/strings/test_strings_defaultstringview.cxx b/sal/qa/rtl/strings/test_strings_defaultstringview.cxx index a188886e5d49..591688b31c3c 100644 --- a/sal/qa/rtl/strings/test_strings_defaultstringview.cxx +++ b/sal/qa/rtl/strings/test_strings_defaultstringview.cxx @@ -52,19 +52,19 @@ class Test : public CppUnit::TestFixture OUString("foo").startsWithIgnoreAsciiCase(std::u16string_view())); CPPUNIT_ASSERT_EQUAL(true, OUString("foo").endsWith(std::u16string_view())); CPPUNIT_ASSERT_EQUAL(true, OUString("foo").endsWithIgnoreAsciiCase(std::u16string_view())); - OUString const foo("foo"); // avoid loplugin:stringconstant + OUString const foo("foo"); // avoid loplugin:stringconstant, loplugin:stringview CPPUNIT_ASSERT_EQUAL(false, foo == std::u16string_view()); CPPUNIT_ASSERT_EQUAL(true, foo != std::u16string_view()); - CPPUNIT_ASSERT_EQUAL(false, OUString("foo") < std::u16string_view()); - CPPUNIT_ASSERT_EQUAL(false, OUString("foo") <= std::u16string_view()); - CPPUNIT_ASSERT_EQUAL(true, OUString("foo") > std::u16string_view()); - CPPUNIT_ASSERT_EQUAL(true, OUString("foo") >= std::u16string_view()); + CPPUNIT_ASSERT_EQUAL(false, foo < std::u16string_view()); + CPPUNIT_ASSERT_EQUAL(false, foo <= std::u16string_view()); + CPPUNIT_ASSERT_EQUAL(true, foo > std::u16string_view()); + CPPUNIT_ASSERT_EQUAL(true, foo >= std::u16string_view()); CPPUNIT_ASSERT_EQUAL(false, std::u16string_view() == foo); CPPUNIT_ASSERT_EQUAL(true, std::u16string_view() != foo); - CPPUNIT_ASSERT_EQUAL(true, std::u16string_view() < OUString("foo")); - CPPUNIT_ASSERT_EQUAL(true, std::u16string_view() <= OUString("foo")); - CPPUNIT_ASSERT_EQUAL(false, std::u16string_view() > OUString("foo")); - CPPUNIT_ASSERT_EQUAL(false, std::u16string_view() >= OUString("foo")); + CPPUNIT_ASSERT_EQUAL(true, std::u16string_view() < foo); + CPPUNIT_ASSERT_EQUAL(true, std::u16string_view() <= foo); + CPPUNIT_ASSERT_EQUAL(false, std::u16string_view() > foo); + CPPUNIT_ASSERT_EQUAL(false, std::u16string_view() >= foo); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), OUString("foo").indexOf(std::u16string_view())); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), OUString("foo").lastIndexOf(std::u16string_view())); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), OUString("foo").lastIndexOf(std::u16string_view(), 3)); |