comphelper/qa/string/test_string.cxx | 4 ++-- comphelper/source/misc/string.cxx | 27 +++++++-------------------- include/comphelper/string.hxx | 7 ------- 3 files changed, 9 insertions(+), 29 deletions(-)
New commits: commit 6d2a9697c9933133539773af6d493a42c6fb94a9 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Oct 14 12:34:49 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Oct 14 14:22:55 2022 +0200 Remove unused comphelper::string::reverseString overload Change-Id: Ic1c56c7be9804685fd37b8f6a13aaab039e07afa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141361 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 0a9850ed920f..0b2f3ee05479 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -178,9 +178,9 @@ void TestString::testTokenCount() void TestString::testReverseString() { - OString aOut = ::comphelper::string::reverseString("ABC"); + OUString aOut = ::comphelper::string::reverseString(u"ABC"); - CPPUNIT_ASSERT_EQUAL(OString("CBA"), aOut); + CPPUNIT_ASSERT_EQUAL(OUString("CBA"), aOut); } void TestString::testSplit() diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 4fcd00078bfe..95e936e60142 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -518,29 +518,16 @@ bool isdigitAsciiString(std::u16string_view rString) [](sal_Unicode c){ return rtl::isAsciiDigit(c); }); } -namespace -{ - template <typename T, typename I, typename O> T tmpl_reverseString(I rIn) - { - if (rIn.empty()) - return T(); - - typename I::size_type i = rIn.size(); - O sBuf(static_cast<sal_Int32>(i)); - while (i) - sBuf.append(rIn[--i]); - return sBuf.makeStringAndClear(); - } -} - OUString reverseString(std::u16string_view rStr) { - return tmpl_reverseString<OUString, std::u16string_view, OUStringBuffer>(rStr); -} + if (rStr.empty()) + return OUString(); -OString reverseString(std::string_view rStr) -{ - return tmpl_reverseString<OString, std::string_view, OStringBuffer>(rStr); + std::size_t i = rStr.size(); + OUStringBuffer sBuf(static_cast<sal_Int32>(i)); + while (i) + sBuf.append(rStr[--i]); + return sBuf.makeStringAndClear(); } sal_Int32 indexOfAny(std::u16string_view rIn, diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index cbed62679f3c..cee741bc865e 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -157,13 +157,6 @@ COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(std::u16string_view rIn, sal_Unicod */ COMPHELPER_DLLPUBLIC OUString reverseString(std::u16string_view rStr); -/** Reverse an OString - - @param rIn the input OString - @return the reversed input -*/ -COMPHELPER_DLLPUBLIC OString reverseString(std::string_view rStr); - namespace detail {