diff options
author | crupest <crupest@outlook.com> | 2022-01-18 22:40:39 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-18 22:40:39 +0800 |
commit | bc37fdb4b746ce0f5f5c49ad9779464acb488284 (patch) | |
tree | 53aa5b98ebba25016be1ec74a2ff161a70de4762 /src/common/String.cpp | |
parent | d28248cc4ccb1a1d81f0d82b8317767f4e2bff44 (diff) | |
download | cru-bc37fdb4b746ce0f5f5c49ad9779464acb488284.tar.gz cru-bc37fdb4b746ce0f5f5c49ad9779464acb488284.tar.bz2 cru-bc37fdb4b746ce0f5f5c49ad9779464acb488284.zip |
...
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(); |