From d15a6560bd445cd1931e9fded6ad8ecfdd54211b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 4 May 2022 14:26:53 +0200 Subject: use more string_view found by examining the call sites of OString::getToken which means I needed to add a new o3tl::equalsAscii function Change-Id: I7dc0ea1cf5ce8090a708d44f2cf7c938fa200c5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133826 Tested-by: Jenkins Reviewed-by: Noel Grandin --- comphelper/source/misc/servicedecl.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/misc/servicedecl.cxx b/comphelper/source/misc/servicedecl.cxx index 1955f6b56251..2b16539d1a55 100644 --- a/comphelper/source/misc/servicedecl.cxx +++ b/comphelper/source/misc/servicedecl.cxx @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -115,8 +116,8 @@ uno::Sequence ServiceDecl::getSupportedServiceNames() const OString const str(m_pServiceNames); sal_Int32 nIndex = 0; do { - OString const token( str.getToken( 0, cDelim, nIndex ) ); - vec.emplace_back( token.getStr(), token.getLength(), + std::string_view const token( o3tl::getToken(str, 0, cDelim, nIndex ) ); + vec.emplace_back( token.data(), token.size(), RTL_TEXTENCODING_ASCII_US ); } while (nIndex >= 0); @@ -124,13 +125,13 @@ uno::Sequence ServiceDecl::getSupportedServiceNames() const return comphelper::containerToSequence(vec); } -bool ServiceDecl::supportsService( OUString const& name ) const +bool ServiceDecl::supportsService( std::u16string_view name ) const { OString const str(m_pServiceNames); sal_Int32 nIndex = 0; do { - OString const token( str.getToken( 0, cDelim, nIndex ) ); - if (name.equalsAsciiL( token.getStr(), token.getLength() )) + std::string_view const token( o3tl::getToken(str, 0, cDelim, nIndex ) ); + if (o3tl::equalsAscii(name, token)) return true; } while (nIndex >= 0); -- cgit