include/o3tl/string_view.hxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
New commits: commit 7582286258984d790274295aea1cd7eb6ad96602 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Apr 14 14:17:50 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Apr 14 22:35:39 2022 +0200 Add some clarifying comments for o3lt::getToken Change-Id: I417f048cdcd74e0a06b4c08d7d1851ea3e8a7077 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133015 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx index bf72c0b2b976..903cc5ced758 100644 --- a/include/o3tl/string_view.hxx +++ b/include/o3tl/string_view.hxx @@ -48,9 +48,13 @@ inline int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view return rtl_ustr_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), s2.data(), s2.size()); }; -// Similar to O[U]String::getToken, returning the first token of a std::[u16]string_view, starting -// at a given position (and if needed, it can be extended to return the n'th token instead of just -// the first, or support an initial position of npos): +// Similar to O[U]String::getToken, returning the first token of a std::[u16]string_view starting +// at a given position. +// +// Attention: There are two sets of o3tl::getToken overloads here. This first set has an interface +// based on std::size_t length parameters, and its semantics don't match those of +// O[U]String::getToken exactly (buf if needed, it can be extended to return the n'th token instead +// of just the first, and/or support an initial position of npos, to make the semantics match). template <typename charT, typename traits = std::char_traits<charT>> inline std::basic_string_view<charT, traits> getToken(std::basic_string_view<charT, traits> sv, charT delimiter, std::size_t& position) @@ -80,7 +84,11 @@ inline std::u16string_view getToken(std::u16string_view sv, char16_t delimiter, return getToken<char16_t>(sv, delimiter, position); } -// Similar to OUString::getToken +// Similar to O[U]String::getToken. +// +// Attention: There are two sets of o3tl::getToken overloads here. This second set has an +// interface based on sal_Int32 length parameters, and is meant to be a drop-in replacement for +// O[U]String::getToken. template <typename charT, typename traits = std::char_traits<charT>> inline std::basic_string_view<charT, traits> getToken(std::basic_string_view<charT, traits> pStr, sal_Int32 nToken, charT cTok,