diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-04 14:26:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-05 08:39:23 +0200 |
commit | d15a6560bd445cd1931e9fded6ad8ecfdd54211b (patch) | |
tree | dc23fce7925c88620abe8cc032b27f25b0a888e0 /comphelper | |
parent | c895edf3f67f19d8d2012674c084456a7851436e (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/servicedecl.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
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 <comphelper/servicedecl.hxx> +#include <o3tl/string_view.hxx> #include <rtl/string.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/sequence.hxx> @@ -115,8 +116,8 @@ uno::Sequence<OUString> 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<OUString> 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); |