summaryrefslogtreecommitdiff
path: root/include/o3tl
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/o3tl
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/o3tl')
-rw-r--r--include/o3tl/string_view.hxx7
1 files changed, 7 insertions, 0 deletions
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)
{