From ce8933d63e58ffdad71ba5dbe7268b224cc4339d Mon Sep 17 00:00:00 2001 From: Rubidium Date: Mon, 5 Jun 2023 16:48:57 +0200 Subject: [PATCH] Add: std::back_insert_iterator Utf8Encode function --- src/string.cpp | 5 +++++ src/string_func.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/string.cpp b/src/string.cpp index c16ec8c540..8a092c6969 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -672,6 +672,11 @@ size_t Utf8Encode(std::ostreambuf_iterator &buf, WChar c) return Utf8Encode &>(buf, c); } +size_t Utf8Encode(std::back_insert_iterator &buf, WChar c) +{ + return Utf8Encode &>(buf, c); +} + /** * Properly terminate an UTF8 string to some maximum length * @param s string to check if it needs additional trimming diff --git a/src/string_func.h b/src/string_func.h index d66a992f09..4a85f338c3 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -94,6 +94,7 @@ bool IsValidChar(WChar key, CharSetFilter afilter); size_t Utf8Decode(WChar *c, const char *s); size_t Utf8Encode(char *buf, WChar c); size_t Utf8Encode(std::ostreambuf_iterator &buf, WChar c); +size_t Utf8Encode(std::back_insert_iterator &buf, WChar c); size_t Utf8TrimString(char *s, size_t maxlen);