diff options
author | crupest <crupest@outlook.com> | 2022-01-18 23:31:10 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-18 23:31:10 +0800 |
commit | bcd603a2f3f3e8525f15df1faa85ed1fcbe3a220 (patch) | |
tree | a3671ff3871af16576eb8b20258d1699821880cf /src/common/String.cpp | |
parent | dadfa6e184ff538763fd627c0d859ec85c047864 (diff) | |
parent | 46ced88c30eeb5f84b7fe78a36d18428babe4fcf (diff) | |
download | cru-bcd603a2f3f3e8525f15df1faa85ed1fcbe3a220.tar.gz cru-bcd603a2f3f3e8525f15df1faa85ed1fcbe3a220.tar.bz2 cru-bcd603a2f3f3e8525f15df1faa85ed1fcbe3a220.zip |
Merge branch 'dev'
Diffstat (limited to 'src/common/String.cpp')
-rw-r--r-- | src/common/String.cpp | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/common/String.cpp b/src/common/String.cpp index 21f3f235..9366abeb 100644 --- a/src/common/String.cpp +++ b/src/common/String.cpp @@ -394,56 +394,6 @@ int String::Compare(const String& other) const { } } -namespace details { -std::vector<FormatToken> ParseToFormatTokenList(const String& str) { - std::vector<FormatToken> result; - - auto push_char = [&result](char16_t c) { - if (result.empty() || result.back().type == FormatTokenType::PlaceHolder) { - result.push_back(FormatToken{FormatTokenType::Text, String{}}); - } - result.back().data.append(c); - }; - - bool last_is_left_bracket = false; - for (auto c : str) { - if (c == u'{') { - if (last_is_left_bracket) { - push_char(u'{'); - last_is_left_bracket = false; - } else { - last_is_left_bracket = true; - } - } else if (c == u'}') { - if (last_is_left_bracket) { - result.push_back(FormatToken{FormatTokenType::PlaceHolder, String{}}); - } - last_is_left_bracket = false; - } else { - if (last_is_left_bracket) { - push_char(u'{'); - } - push_char(c); - last_is_left_bracket = false; - } - } - return result; -} - -void FormatAppendFromFormatTokenList( - String& current, const std::vector<FormatToken>& format_token_list, - Index index) { - 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"{}"; - } else { - current += token.data; - } - } -} -} // namespace details - int StringView::Compare(const StringView& other) const { const_iterator i1 = cbegin(); const_iterator i2 = other.cbegin(); |