summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-04 14:26:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-05 08:39:23 +0200
commitd15a6560bd445cd1931e9fded6ad8ecfdd54211b (patch)
treedc23fce7925c88620abe8cc032b27f25b0a888e0 /include
parentc895edf3f67f19d8d2012674c084456a7851436e (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 'include')
-rw-r--r--include/comphelper/servicedecl.hxx2
-rw-r--r--include/o3tl/string_view.hxx7
2 files changed, 8 insertions, 1 deletions
diff --git a/include/comphelper/servicedecl.hxx b/include/comphelper/servicedecl.hxx
index 94f5db000753..57da446e68b5 100644
--- a/include/comphelper/servicedecl.hxx
+++ b/include/comphelper/servicedecl.hxx
@@ -118,7 +118,7 @@ public:
css::uno::Sequence< OUString> getSupportedServiceNames() const;
/// @return whether name is in set of supported service names
- bool supportsService( OUString const& name ) const;
+ bool supportsService( std::u16string_view name ) const;
/// @return implementation name
OUString getImplementationName() const;
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx
index 026dc5e167ae..cea4f272b947 100644
--- a/include/o3tl/string_view.hxx
+++ b/include/o3tl/string_view.hxx
@@ -27,6 +27,13 @@ inline bool equalsAscii(std::u16string_view s1, const char* s2)
return rtl_ustr_ascii_compare_WithLength(s1.data(), s1.size(), s2) == 0;
}
+// Like OUString::equalsAsciiL
+inline bool equalsAscii(std::u16string_view s1, std::string_view s2)
+{
+ return rtl_ustr_ascii_shortenedCompare_WithLength(s1.data(), s1.size(), s2.data(), s2.size())
+ == 0;
+}
+
// Like OUString::equalsIgnoreAsciiCase, but for two std::u16string_view:
inline bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
{