Changeset - r27530:821f199be514
[Not reviewed]
master
0 2 0
Rubidium - 12 months ago 2023-06-05 14:48:57
rubidium@openttd.org
Add: std::back_insert_iterator<std::string> Utf8Encode function
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/string.cpp
Show inline comments
 
@@ -672,6 +672,11 @@ size_t Utf8Encode(std::ostreambuf_iterat
 
	return Utf8Encode<std::ostreambuf_iterator<char> &>(buf, c);
 
}
 

	
 
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, WChar c)
 
{
 
	return Utf8Encode<std::back_insert_iterator<std::string> &>(buf, c);
 
}
 

	
 
/**
 
 * Properly terminate an UTF8 string to some maximum length
 
 * @param s string to check if it needs additional trimming
src/string_func.h
Show inline comments
 
@@ -94,6 +94,7 @@ bool IsValidChar(WChar key, CharSetFilte
 
size_t Utf8Decode(WChar *c, const char *s);
 
size_t Utf8Encode(char *buf, WChar c);
 
size_t Utf8Encode(std::ostreambuf_iterator<char> &buf, WChar c);
 
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, WChar c);
 
size_t Utf8TrimString(char *s, size_t maxlen);
 

	
 

	
0 comments (0 inline, 0 general)