Merge tag 'v0.21.23'

release v0.21.23
This commit is contained in:
Max Kellermann
2020-04-23 17:54:22 +02:00
20 changed files with 238 additions and 60 deletions

View File

@@ -25,13 +25,23 @@
#include <string_view>
#ifdef _WIN32
#include <wchar.h>
#endif
/**
* This class can compare one string ("needle") with lots of other
* strings ("haystacks") efficiently, ignoring case. With some
* configurations, it can prepare a case-folded version of the needle.
*/
class IcuCompare {
#ifdef _WIN32
/* Windows API functions work with wchar_t strings, so let's
cache the MultiByteToWideChar() result for performance */
AllocatedString<wchar_t> needle;
#else
AllocatedString<> needle;
#endif
public:
IcuCompare():needle(nullptr) {}
@@ -40,12 +50,12 @@ public:
IcuCompare(const IcuCompare &src) noexcept
:needle(src
? AllocatedString<>::Duplicate(src.needle)
? src.needle.Clone()
: nullptr) {}
IcuCompare &operator=(const IcuCompare &src) noexcept {
needle = src
? AllocatedString<>::Duplicate(src.needle)
? src.needle.Clone()
: nullptr;
return *this;
}