diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-02-26 14:28:20 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-02-26 14:28:20 +0100 |
| commit | ffc5a4a334d5434f42d695f0725fe9131bfea5a9 (patch) | |
| tree | 39c690fdc6be122d181a525e78c1552efdc070fa /src/string.hh | |
| parent | 2726d1110858ae2cb5c5fbb448c25a7ef6181cba (diff) | |
Add a String(Codepoint, CharCount) constructor
Diffstat (limited to 'src/string.hh')
| -rw-r--r-- | src/string.hh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string.hh b/src/string.hh index f86e0661..f93c04d3 100644 --- a/src/string.hh +++ b/src/string.hh @@ -24,6 +24,14 @@ public: String(const String& string) = default; String(String&& string) = default; explicit String(char content, CharCount count = 1) : m_content((size_t)(int)count, content) {} + explicit String(Codepoint cp, CharCount count = 1) + { + std::string str; + auto it = back_inserter(str); + utf8::dump(it, cp); + for (CharCount i = 0; i < count; ++i) + m_content += str; + } template<typename Iterator> String(Iterator begin, Iterator end) : m_content(begin, end) {} |
