aboutsummaryrefslogtreecommitdiff
path: root/src/common/String.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-12 23:13:10 +0800
committerGitHub <noreply@github.com>2022-01-12 23:13:10 +0800
commit276ae73fa444c16f34a379ae9d8f58c883056b4a (patch)
tree96f4d7103976836e918b4fa1db0fdbb80777986e /src/common/String.cpp
parent01f98ce88950cdb729f5db58bf26f2fffa1c326c (diff)
parent65c799c5339ba37bea2217b168e96b15aceaef85 (diff)
downloadcru-276ae73fa444c16f34a379ae9d8f58c883056b4a.tar.gz
cru-276ae73fa444c16f34a379ae9d8f58c883056b4a.tar.bz2
cru-276ae73fa444c16f34a379ae9d8f58c883056b4a.zip
Merge pull request #44 from crupest/dev
Windows development.
Diffstat (limited to 'src/common/String.cpp')
-rw-r--r--src/common/String.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/String.cpp b/src/common/String.cpp
index 1c2ff022..21f3f235 100644
--- a/src/common/String.cpp
+++ b/src/common/String.cpp
@@ -39,13 +39,20 @@ String::String(const_pointer str, Index size) {
this->capacity_ = size;
}
+String::String(size_type size, value_type ch) : String() {
+ reserve(size);
+ for (Index i = 0; i < size; i++) {
+ append(ch);
+ }
+}
+
String::String(std::initializer_list<char16_t> l)
: String(l.begin(), l.size()) {}
#ifdef CRU_PLATFORM_WINDOWS
String::String(const wchar_t* str) : String(str, GetStrSize(str)) {}
String::String(const wchar_t* str, Index size)
- : String(reinterpret_cast<const std::uint16_t*>(str), size) {}
+ : String(reinterpret_cast<const char16_t*>(str), size) {}
#endif
String::String(const String& other) {
@@ -426,7 +433,7 @@ std::vector<FormatToken> ParseToFormatTokenList(const String& str) {
void FormatAppendFromFormatTokenList(
String& current, const std::vector<FormatToken>& format_token_list,
Index index) {
- for (Index i = index; i < format_token_list.size(); i++) {
+ for (Index i = index; i < static_cast<Index>(format_token_list.size()); i++) {
const auto& token = format_token_list[i];
if (token.type == FormatTokenType::PlaceHolder) {
current += u"{}";