From f87dbe410ff95a373e58e514c11171364352c826 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 14 Jul 2015 13:47:51 +0100 Subject: [PATCH] Add missing support for Codepoint in format --- src/string.cc | 9 +++++++++ src/string.hh | 1 + 2 files changed, 10 insertions(+) diff --git a/src/string.cc b/src/string.cc index 2ed77156..e4b5c0e2 100644 --- a/src/string.cc +++ b/src/string.cc @@ -151,6 +151,15 @@ InplaceString<24> to_string(float val) return res; } +InplaceString<8> to_string(Codepoint c) +{ + InplaceString<8> res; + char* ptr = res.m_data; + utf8::dump(ptr, c); + res.m_length = (int)(ptr - res.m_data); + return res; +} + bool subsequence_match(StringView str, StringView subseq) { auto it = str.begin(); diff --git a/src/string.hh b/src/string.hh index 424e994c..c853ebe4 100644 --- a/src/string.hh +++ b/src/string.hh @@ -277,6 +277,7 @@ InplaceString<16> to_string(int val); InplaceString<24> to_string(size_t val); InplaceString<24> to_string(Hex val); InplaceString<24> to_string(float val); +InplaceString<8> to_string(Codepoint c); template decltype(to_string(std::declval()))