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 <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2022-10-14 12:34:49 +02:00
parent 8195c98dba
commit 6d2a9697c9
3 changed files with 9 additions and 29 deletions

View File

@ -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()

View File

@ -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,

View File

@ -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
{