Remove the OUString vs. std::u16string_view comparison operators again
...that were introduced ine6dfaf9f44
"Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString" to avoid ambiguities, but which is no longer an issue since46c5de8328
"make *String(string_view) constructors explicit" Change-Id: I0a7a3fe23412f77fa85fb7e90f04e22f9abd9230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108044 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user