AK: Remove StringBuilder::build() in favor of to_deprecated_string()

Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
This commit is contained in:
Linus Groh 2023-01-26 18:58:09 +00:00
parent da81041e97
commit 6e7459322d
Notes: sideshowbarker 2024-07-18 04:38:32 +09:00
129 changed files with 213 additions and 219 deletions

View file

@ -106,7 +106,7 @@ public:
{
StringBuilder builder;
builder.join(separator, collection, fmtstr);
return builder.build();
return builder.to_deprecated_string();
}
[[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;

View file

@ -52,7 +52,7 @@ DeprecatedString encode_hex(const ReadonlyBytes input)
for (auto ch : input)
output.appendff("{:02x}", ch);
return output.build();
return output.to_deprecated_string();
}
#endif

View file

@ -109,7 +109,7 @@ inline typename Builder::OutputType JsonArray::serialized() const
{
Builder builder;
serialize(builder);
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -139,7 +139,7 @@ inline typename Builder::OutputType JsonObject::serialized() const
{
Builder builder;
serialize(builder);
return builder.build();
return builder.to_deprecated_string();
}
template<typename Builder>
@ -190,7 +190,7 @@ inline typename Builder::OutputType JsonValue::serialized() const
{
Builder builder;
serialize(builder);
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -57,7 +57,7 @@ public:
}
StringView as_string_view() const { return m_builder.string_view(); }
DeprecatedString as_string() const { return m_builder.build(); }
DeprecatedString as_string() const { return m_builder.to_deprecated_string(); }
void append(StringView pattern)
{

View file

@ -118,11 +118,6 @@ DeprecatedString StringBuilder::to_deprecated_string() const
return DeprecatedString((char const*)data(), length());
}
DeprecatedString StringBuilder::build() const
{
return to_deprecated_string();
}
ErrorOr<String> StringBuilder::to_string() const
{
return String::from_utf8(string_view());

View file

@ -62,7 +62,6 @@ public:
}
#ifndef KERNEL
[[nodiscard]] DeprecatedString build() const;
[[nodiscard]] DeprecatedString to_deprecated_string() const;
ErrorOr<String> to_string() const;
#endif

View file

@ -546,7 +546,7 @@ DeprecatedString replace(StringView str, StringView needle, StringView replaceme
last_position = position + needle.length();
}
replaced_string.append(str.substring_view(last_position, str.length() - last_position));
return replaced_string.build();
return replaced_string.to_deprecated_string();
}
ErrorOr<String> replace(String const& haystack, StringView needle, StringView replacement, ReplaceMode replace_mode)

View file

@ -348,7 +348,7 @@ DeprecatedString URL::serialize_origin() const
builder.append(m_host);
if (m_port.has_value())
builder.appendff(":{}", *m_port);
return builder.build();
return builder.to_deprecated_string();
}
bool URL::equals(URL const& other, ExcludeFragment exclude_fragments) const

View file

@ -371,7 +371,7 @@ public:)~~~");
builder.append(", "sv);
}
message_generator.set("message.constructor_call_parameters", builder.build());
message_generator.set("message.constructor_call_parameters", builder.to_deprecated_string());
message_generator.appendln(R"~~~(
return make<@message.pascal_name@>(@message.constructor_call_parameters@);
})~~~");

View file

@ -86,7 +86,7 @@ static ErrorOr<DeprecatedString> decode_html_entities(StringView const& str)
start = entity_end.value() + 1;
}
return decoded_str.build();
return decoded_str.to_deprecated_string();
}
static ErrorOr<ApprovalDate> parse_approval_date(StringView const& str)

View file

@ -1667,7 +1667,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
if (auto region = cldr.unique_strings.get(parsed_locale.region); !region.is_empty())
builder.appendff("-{}", region);
return builder.build();
return builder.to_deprecated_string();
};
while (dates_iterator.has_next()) {

View file

@ -936,7 +936,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString bcp47_path, DeprecatedSt
if (auto region = cldr.unique_strings.get(parsed_locale.region); !region.is_empty())
builder.appendff("-{}", region);
return builder.build();
return builder.to_deprecated_string();
};
while (identity_iterator.has_next()) {

View file

@ -86,7 +86,7 @@ struct AK::Formatter<NumberFormat> : Formatter<FormatString> {
format.zero_format_index,
format.positive_format_index,
format.negative_format_index,
identifier_indices.build());
identifier_indices.to_deprecated_string());
}
};
@ -718,7 +718,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
if (auto region = cldr.unique_strings.get(parsed_locale.region); !region.is_empty())
builder.appendff("-{}", region);
return builder.build();
return builder.to_deprecated_string();
};
while (numbers_iterator.has_next()) {

View file

@ -410,7 +410,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
if (auto region = cldr.unique_strings.get(parsed_locale.region); !region.is_empty())
builder.appendff("-{}", region);
return builder.build();
return builder.to_deprecated_string();
};
while (identity_iterator.has_next()) {

View file

@ -150,7 +150,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString dates_path, CLDR& cldr)
if (auto region = cldr.unique_strings.get(parsed_locale.region); !region.is_empty())
builder.appendff("-{}", region);
return builder.build();
return builder.to_deprecated_string();
};
while (dates_iterator.has_next()) {

View file

@ -45,7 +45,7 @@ static void set_image_path_for_emoji(StringView emoji_resource_path, Emoji& emoj
builder.appendff("U+{:X}", code_point);
}
auto path = DeprecatedString::formatted("{}/{}.png", emoji_resource_path, builder.build());
auto path = DeprecatedString::formatted("{}/{}.png", emoji_resource_path, builder.to_deprecated_string());
if (Core::File::exists(path))
emoji.image_path = move(path);
}
@ -153,7 +153,7 @@ static ErrorOr<void> parse_emoji_serenity_data(Core::Stream::BufferedFile& file,
}
});
auto name = builder.build();
auto name = builder.to_deprecated_string();
if (!any_of(name, is_ascii_lower_alpha))
name = name.to_titlecase();

View file

@ -252,7 +252,7 @@ TEST_CASE(builder_zero_initial_capacity)
{
StringBuilder builder(0);
builder.append(""sv);
auto built = builder.build();
auto built = builder.to_deprecated_string();
EXPECT_EQ(built.is_null(), false);
EXPECT_EQ(built.length(), 0u);
}

View file

@ -101,7 +101,7 @@ static void do_weird_call(size_t attempt, int syscall_fn, size_t arg1, size_t ar
builder.appendff("{:p}", fake_params[i]);
}
builder.append(']');
dbgln("{}", builder.build());
dbgln("{}", builder.to_deprecated_string());
// Actually do the syscall ('fake_params' is passed indirectly, if any of arg1, arg2, or arg3 point to it.
int rc = syscall(Syscall::Function(syscall_fn), arg1, arg2, arg3);

View file

@ -50,7 +50,7 @@ TEST_CASE(overlong_realpath)
expected.append({ tmp_dir, strlen(tmp_dir) });
// But first, demonstrate the functionality at a reasonable depth:
auto expected_str = expected.build();
auto expected_str = expected.to_deprecated_string();
check_result("getwd", expected_str, getwd(static_cast<char*>(calloc(1, PATH_MAX))));
check_result("getcwd", expected_str, getcwd(nullptr, 0));
check_result("realpath", expected_str, realpath(".", nullptr));
@ -74,7 +74,7 @@ TEST_CASE(overlong_realpath)
outln("cwd should now be ridiculously large");
// Evaluate
expected_str = expected.build();
expected_str = expected.to_deprecated_string();
check_result("getwd", {}, getwd(static_cast<char*>(calloc(1, PATH_MAX))));
check_result("getcwd", expected_str, getcwd(nullptr, 0));

View file

@ -43,7 +43,7 @@ static DeprecatedString show(ByteBuffer const& buf)
builder.append('_');
}
builder.append(')');
return builder.build();
return builder.to_deprecated_string();
}
template<typename TArg>

View file

@ -37,7 +37,7 @@ static DeprecatedString show(ByteBuffer const& buf)
builder.append('_');
}
builder.append(')');
return builder.build();
return builder.to_deprecated_string();
}
static bool test_single(Testcase const& testcase)

View file

@ -143,7 +143,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
// First in ere
b.clear();
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -153,7 +153,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append("a|"sv);
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -163,7 +163,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('^');
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -173,7 +173,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('$');
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -184,7 +184,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.append('(');
b.append(ch);
b.append(')');
pattern = b.build();
pattern = b.to_deprecated_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -722,7 +722,7 @@ TEST_CASE(ECMA262_unicode_match)
StringBuilder builder;
for (u32 code_point : space_and_line_terminator_code_points)
builder.append_code_point(code_point);
auto space_and_line_terminators = builder.build();
auto space_and_line_terminators = builder.to_deprecated_string();
struct _test {
StringView pattern;

View file

@ -325,7 +325,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
// First in ere
b.clear();
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -334,7 +334,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append("a|"sv);
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -343,7 +343,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('^');
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -352,7 +352,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('$');
b.append(ch);
pattern = b.build();
pattern = b.to_deprecated_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -362,7 +362,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.append('(');
b.append(ch);
b.append(')');
pattern = b.build();
pattern = b.to_deprecated_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);

View file

@ -51,7 +51,7 @@ void insert_into_table(SQL::Database& db, int count)
StringBuilder builder;
builder.appendff("Test{}", ix);
row["TextColumn"] = builder.build();
row["TextColumn"] = builder.to_deprecated_string();
row["IntColumn"] = ix;
auto maybe_error = db.insert(row);
EXPECT(!maybe_error.is_error());
@ -69,7 +69,7 @@ void verify_table_contents(SQL::Database& db, int expected_count)
for (auto& row : rows_or_error.value()) {
StringBuilder builder;
builder.appendff("Test{}", row["IntColumn"].to_int<i32>().value());
EXPECT_EQ(row["TextColumn"].to_deprecated_string(), builder.build());
EXPECT_EQ(row["TextColumn"].to_deprecated_string(), builder.to_deprecated_string());
count++;
sum += row["IntColumn"].to_int<i32>().value();
}

View file

@ -249,14 +249,14 @@ TEST_CASE(binary_operator)
StringBuilder builder;
builder.append("1 "sv);
builder.append(op.key);
EXPECT(parse(builder.build()).is_error());
EXPECT(parse(builder.to_deprecated_string()).is_error());
builder.clear();
if (op.key != "+" && op.key != "-") { // "+1" and "-1" are fine (unary operator).
builder.append(op.key);
builder.append(" 1"sv);
EXPECT(parse(builder.build()).is_error());
EXPECT(parse(builder.to_deprecated_string()).is_error());
}
}
@ -278,7 +278,7 @@ TEST_CASE(binary_operator)
builder.append("1 "sv);
builder.append(op.key);
builder.append(" 1"sv);
validate(builder.build(), op.value);
validate(builder.to_deprecated_string(), op.value);
}
}
@ -485,12 +485,12 @@ TEST_CASE(match_expression)
StringBuilder builder;
builder.append("1 "sv);
builder.append(op.key);
EXPECT(parse(builder.build()).is_error());
EXPECT(parse(builder.to_deprecated_string()).is_error());
builder.clear();
builder.append(op.key);
builder.append(" 1"sv);
EXPECT(parse(builder.build()).is_error());
EXPECT(parse(builder.to_deprecated_string()).is_error());
}
auto validate = [](StringView sql, SQL::AST::MatchOperator expected_operator, bool expected_invert_expression, bool expect_escape) {
@ -513,19 +513,19 @@ TEST_CASE(match_expression)
builder.append("1 "sv);
builder.append(op.key);
builder.append(" 1"sv);
validate(builder.build(), op.value, false, false);
validate(builder.to_deprecated_string(), op.value, false, false);
builder.clear();
builder.append("1 NOT "sv);
builder.append(op.key);
builder.append(" 1"sv);
validate(builder.build(), op.value, true, false);
validate(builder.to_deprecated_string(), op.value, true, false);
builder.clear();
builder.append("1 NOT "sv);
builder.append(op.key);
builder.append(" 1 ESCAPE '+'"sv);
validate(builder.build(), op.value, true, true);
validate(builder.to_deprecated_string(), op.value, true, true);
}
}

View file

@ -88,7 +88,7 @@ DeprecatedString CookieJar::get_cookie(const URL& url, Web::Cookie::Source sourc
builder.appendff("{}={}", cookie.name, cookie.value);
}
return builder.build();
return builder.to_deprecated_string();
}
void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source)
@ -150,7 +150,7 @@ void CookieJar::dump_cookies()
builder.appendff("\t{}SameSite{} = {:s}\n", attribute_color, no_color, Web::Cookie::same_site_to_string(cookie.same_site));
});
dbgln("{} cookies stored\n{}", total_cookies, builder.build());
dbgln("{} cookies stored\n{}", total_cookies, builder.to_deprecated_string());
}
Vector<Web::Cookie::Cookie> CookieJar::get_all_cookies()

View file

@ -518,7 +518,7 @@ Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
builder.append(".com"sv);
}
}
DeprecatedString final_text = builder.to_deprecated_string();
auto final_text = builder.to_deprecated_string();
auto url = url_from_user_input(final_text);
return url;

View file

@ -90,6 +90,6 @@ void CharacterSearchWidget::search()
StringBuilder builder;
builder.append_code_point(code_point);
model.add_result({ code_point, builder.build(), move(display_name) });
model.add_result({ code_point, builder.to_deprecated_string(), move(display_name) });
});
}

View file

@ -100,7 +100,7 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core:
return {
DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
builder.build()
builder.to_deprecated_string()
};
}
@ -125,7 +125,7 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info
return {
DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid),
builder.build()
builder.to_deprecated_string()
};
}

View file

@ -144,7 +144,7 @@ void do_copy(Vector<DeprecatedString> const& selected_file_paths, FileOperation
auto url = URL::create_with_file_scheme(path);
copy_text.appendff("{}\n", url);
}
GUI::Clipboard::the().set_data(copy_text.build().bytes(), "text/uri-list");
GUI::Clipboard::the().set_data(copy_text.to_deprecated_string().bytes(), "text/uri-list");
}
void do_paste(DeprecatedString const& target_directory, GUI::Window* window)
@ -213,7 +213,7 @@ void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI:
if (!archive_name.ends_with(".zip"sv))
path_builder.append(".zip"sv);
}
auto output_path = path_builder.build();
auto output_path = path_builder.to_deprecated_string();
pid_t zip_pid = fork();
if (zip_pid < 0) {

View file

@ -146,7 +146,7 @@ static DeprecatedString get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMa
TreeNode const* node = treemapwidget.path_node(k);
path_builder.append(node->name());
}
return path_builder.build();
return path_builder.to_deprecated_string();
}
ErrorOr<int> serenity_main(Main::Arguments arguments)

View file

@ -42,7 +42,7 @@ void Cell::set_data(JS::Value new_data)
StringBuilder builder;
builder.append(new_data.to_string_without_side_effects());
m_data = builder.build();
m_data = builder.to_deprecated_string();
m_evaluated_data = move(new_data);
}

View file

@ -43,7 +43,7 @@ DeprecatedString format_double(char const* format, double value)
auto putch = [&](auto, auto ch) { builder.append(ch); };
printf_internal<decltype(putch), PrintfImpl, double, SingleEntryListNext>(putch, nullptr, format, value);
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -745,7 +745,7 @@ DeprecatedString Sheet::generate_inline_documentation_for(StringView function, s
}
builder.append(')');
return builder.build();
return builder.to_deprecated_string();
}
DeprecatedString Position::to_cell_identifier(Sheet const& sheet) const

View file

@ -737,7 +737,7 @@ void Editor::handle_function_parameters_hint_request()
}
html.append("<style>body { background-color: #dac7b5; }</style>"sv);
s_tooltip_page_view->load_html(html.build(), {});
s_tooltip_page_view->load_html(html.to_deprecated_string(), {});
auto cursor_rect = current_editor().cursor_content_rect().location().translated(screen_relative_rect().location());

View file

@ -222,7 +222,7 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole
auto const& entry = insn.source_position_with_inlines.source_position.value();
builder.appendff("{}:{}", entry.file_path, entry.line_number);
}
return builder.build();
return builder.to_deprecated_string();
}
return {};

View file

@ -381,7 +381,7 @@ static RefPtr<Gfx::Bitmap> get_piece(StringView set, StringView image)
builder.append(set);
builder.append('/');
builder.append(image);
return Gfx::Bitmap::load_from_file(builder.build()).release_value_but_fixme_should_propagate_errors();
return Gfx::Bitmap::load_from_file(builder.to_deprecated_string()).release_value_but_fixme_should_propagate_errors();
}
void ChessWidget::set_piece_set(StringView set)

View file

@ -48,7 +48,7 @@ static ErrorOr<DeprecatedString> sem_name_to_path(char const* name)
StringBuilder builder;
TRY(builder.try_append(sem_path_prefix));
TRY(builder.try_append(name_view));
return builder.build();
return builder.to_deprecated_string();
}
struct NamedSemaphore {

View file

@ -641,7 +641,7 @@ int ptsname_r(int fd, char* buffer, size_t size)
return -1;
}
memset(buffer, 0, devpts_path_builder.length() + 1);
auto full_devpts_path_string = devpts_path_builder.build();
auto full_devpts_path_string = devpts_path_builder.to_deprecated_string();
if (!full_devpts_path_string.copy_characters_to_buffer(buffer, size)) {
errno = ERANGE;
return -1;

View file

@ -124,7 +124,7 @@ void vsyslog_r(int priority, struct syslog_data* data, char const* message, va_l
combined.appendff("{}: ", get_syslog_ident(data));
combined.appendvf(message, args);
DeprecatedString combined_string = combined.build();
auto combined_string = combined.to_deprecated_string();
if (data->logopt & LOG_CONS)
dbgputstr(combined_string.characters(), combined_string.length());

View file

@ -390,7 +390,7 @@ size_t strftime(char* destination, size_t max_size, char const* format, const st
return 0;
}
auto str = builder.build();
auto str = builder.to_deprecated_string();
bool fits = str.copy_characters_to_buffer(destination, max_size);
return fits ? str.length() : 0;
}

View file

@ -137,6 +137,6 @@ struct AK::Formatter<Cards::CardStack> : Formatter<FormatString> {
first_card = false;
}
return Formatter<FormatString>::format(builder, "{:<10} {:>16}: {}"sv, type, stack.bounding_box(), cards.build());
return Formatter<FormatString>::format(builder, "{:<10} {:>16}: {}"sv, type, stack.bounding_box(), cards.to_deprecated_string());
}
};

View file

@ -82,7 +82,7 @@ DeprecatedString Square::to_algebraic() const
StringBuilder builder;
builder.append(file + 'a');
builder.append(rank + '1');
return builder.build();
return builder.to_deprecated_string();
}
Move::Move(StringView long_algebraic)
@ -98,7 +98,7 @@ DeprecatedString Move::to_long_algebraic() const
builder.append(from.to_algebraic());
builder.append(to.to_algebraic());
builder.append(char_for_piece(promote_to).to_lowercase());
return builder.build();
return builder.to_deprecated_string();
}
Move Move::from_algebraic(StringView algebraic, const Color turn, Board const& board)
@ -216,7 +216,7 @@ DeprecatedString Move::to_algebraic() const
else if (is_check)
builder.append('+');
return builder.build();
return builder.to_deprecated_string();
}
Board::Board()

View file

@ -105,7 +105,7 @@ DeprecatedString SetOptionCommand::to_deprecated_string() const
builder.append(value().value());
}
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
PositionCommand PositionCommand::from_string(StringView command)
@ -141,7 +141,7 @@ DeprecatedString PositionCommand::to_deprecated_string() const
builder.append(move.to_long_algebraic());
}
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
GoCommand GoCommand::from_string(StringView command)
@ -227,7 +227,7 @@ DeprecatedString GoCommand::to_deprecated_string() const
builder.append(" infinite"sv);
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
StopCommand StopCommand::from_string(StringView command)
@ -256,9 +256,9 @@ IdCommand IdCommand::from_string(StringView command)
}
if (tokens[1] == "name") {
return IdCommand(Type::Name, value.build());
return IdCommand(Type::Name, value.to_deprecated_string());
} else if (tokens[1] == "author") {
return IdCommand(Type::Author, value.build());
return IdCommand(Type::Author, value.to_deprecated_string());
}
VERIFY_NOT_REACHED();
}
@ -274,7 +274,7 @@ DeprecatedString IdCommand::to_deprecated_string() const
}
builder.append(value());
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
UCIOkCommand UCIOkCommand::from_string(StringView command)
@ -317,7 +317,7 @@ DeprecatedString BestMoveCommand::to_deprecated_string() const
builder.append("bestmove "sv);
builder.append(move().to_long_algebraic());
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
InfoCommand InfoCommand::from_string([[maybe_unused]] StringView command)

View file

@ -81,7 +81,7 @@ Vector<DeprecatedString> const& ShellComprehensionEngine::DocumentData::sourced_
auto name_list = const_cast<::Shell::AST::Node*>(filename.ptr())->run(nullptr)->resolve_as_list(nullptr);
StringBuilder builder;
builder.join(' ', name_list);
sourced_files.set(builder.build());
sourced_files.set(builder.to_deprecated_string());
}
}
}

View file

@ -39,7 +39,7 @@ static DeprecatedString get_salt()
auto salt_string = MUST(encode_base64({ random_data, sizeof(random_data) }));
builder.append(salt_string);
return builder.build();
return builder.to_deprecated_string();
}
static Vector<gid_t> get_extra_gids(passwd const& pwd)
@ -196,7 +196,7 @@ void Account::set_password_enabled(bool enabled)
StringBuilder builder;
builder.append('!');
builder.append(m_password_hash);
m_password_hash = builder.build();
m_password_hash = builder.to_deprecated_string();
}
}

View file

@ -77,7 +77,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha
}
long_options.append({ 0, 0, 0, 0 });
DeprecatedString short_options = short_options_builder.build();
auto short_options = short_options_builder.to_deprecated_string();
while (true) {
int c = getopt_long(argc, argv, short_options.characters(), long_options.data(), nullptr);

View file

@ -273,7 +273,7 @@ DeprecatedString DateTime::to_deprecated_string(StringView format) const
}
}
return builder.build();
return builder.to_deprecated_string();
}
Optional<DateTime> DateTime::parse(StringView format, DeprecatedString const& string)

View file

@ -394,7 +394,7 @@ static DeprecatedString get_duplicate_name(DeprecatedString const& path, int dup
if (!lexical_path.extension().is_empty()) {
duplicated_name.appendff(".{}", lexical_path.extension());
}
return duplicated_name.build();
return duplicated_name.to_deprecated_string();
}
ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode)

View file

@ -131,7 +131,7 @@ DeprecatedString Backtrace::Entry::to_deprecated_string(bool color) const
builder.appendff("{:p}: ", eip);
if (object_name.is_empty()) {
builder.append("???"sv);
return builder.build();
return builder.to_deprecated_string();
}
builder.appendff("[{}] {}", object_name, function_name.is_empty() ? "???" : function_name);
builder.append(" ("sv);
@ -158,7 +158,7 @@ DeprecatedString Backtrace::Entry::to_deprecated_string(bool color) const
builder.append(')');
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -32,8 +32,8 @@ void SemanticSyntaxHighlighter::rehighlight(Palette const& palette)
for (Cpp::Token const& token : m_saved_tokens)
previous_tokens_as_lines.appendff("{}\n", token.type_as_deprecated_string());
auto previous = previous_tokens_as_lines.build();
auto current = current_tokens_as_lines.build();
auto previous = previous_tokens_as_lines.to_deprecated_string();
auto current = current_tokens_as_lines.to_deprecated_string();
// FIXME: Computing the diff on the entire document's tokens is quite inefficient.
// An improvement over this could be only including the tokens that are in edited text ranges in the diff.

View file

@ -79,7 +79,7 @@ public:
StringBuilder builder;
builder.append("HMAC-"sv);
builder.append(m_inner_hasher.class_name());
return builder.build();
return builder.to_deprecated_string();
}
#endif

View file

@ -30,7 +30,7 @@ DeprecatedString AESCipherBlock::to_deprecated_string() const
StringBuilder builder;
for (auto value : m_data)
builder.appendff("{:02x}", value);
return builder.build();
return builder.to_deprecated_string();
}
DeprecatedString AESCipherKey::to_deprecated_string() const
@ -38,7 +38,7 @@ DeprecatedString AESCipherKey::to_deprecated_string() const
StringBuilder builder;
for (size_t i = 0; i < (rounds() + 1) * 4; ++i)
builder.appendff("{:02x}", m_rd_keys[i]);
return builder.build();
return builder.to_deprecated_string();
}
#endif

View file

@ -35,7 +35,7 @@ public:
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_CBC"sv);
return builder.build();
return builder.to_deprecated_string();
}
#endif

View file

@ -110,7 +110,7 @@ public:
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_CTR"sv);
return builder.build();
return builder.to_deprecated_string();
}
#endif

View file

@ -50,7 +50,7 @@ public:
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_GCM"sv);
return builder.build();
return builder.to_deprecated_string();
}
#endif

View file

@ -1010,7 +1010,7 @@ DeprecatedString Parser::display_product_name() const
break;
str.append((char)byte);
}
product_name = str.build();
product_name = str.to_deprecated_string();
return IterationDecision::Break;
});
if (result.is_error()) {
@ -1033,7 +1033,7 @@ DeprecatedString Parser::display_product_serial_number() const
break;
str.append((char)byte);
}
product_name = str.build();
product_name = str.to_deprecated_string();
return IterationDecision::Break;
});
if (result.is_error()) {

View file

@ -118,7 +118,7 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
fuzzy_str_builder.append(character);
fuzzy_str_builder.append('*');
}
return fuzzy_str_builder.build();
return fuzzy_str_builder.to_deprecated_string();
};
Vector<CodeComprehension::AutocompleteResultEntry> class_entries, identifier_entries;

View file

@ -854,7 +854,7 @@ void InsertTextCommand::perform_formatting(TextDocument::Client const& client)
++column;
}
}
m_text = builder.build();
m_text = builder.to_deprecated_string();
}
void InsertTextCommand::redo()

View file

@ -25,7 +25,7 @@ DeprecatedString Document::render_to_html() const
}
html_builder.append("</body>"sv);
html_builder.append("</html>"sv);
return html_builder.build();
return html_builder.to_deprecated_string();
}
NonnullRefPtr<Document> Document::parse(StringView lines, const URL& url)

View file

@ -14,7 +14,7 @@ DeprecatedString Text::render_to_html() const
StringBuilder builder;
builder.append(escape_html_entities(m_text));
builder.append("<br>\n"sv);
return builder.build();
return builder.to_deprecated_string();
}
DeprecatedString Heading::render_to_html() const
@ -31,7 +31,7 @@ DeprecatedString UnorderedList::render_to_html() const
builder.append("<li>"sv);
builder.append(escape_html_entities(m_text.substring_view(1, m_text.length() - 1)));
builder.append("</li>"sv);
return builder.build();
return builder.to_deprecated_string();
}
DeprecatedString Control::render_to_html() const
@ -81,7 +81,7 @@ DeprecatedString Link::render_to_html() const
builder.append("\">"sv);
builder.append(escape_html_entities(m_name));
builder.append("</a><br>\n"sv);
return builder.build();
return builder.to_deprecated_string();
}
DeprecatedString Preformatted::render_to_html() const
@ -90,7 +90,7 @@ DeprecatedString Preformatted::render_to_html() const
builder.append(escape_html_entities(m_text));
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -371,7 +371,7 @@ void Job::on_socket_connected()
builder.append(existing_value.value());
builder.append(',');
builder.append(value);
m_headers.set(name, builder.build());
m_headers.set(name, builder.to_deprecated_string());
} else {
m_headers.set(name, value);
}

View file

@ -73,7 +73,7 @@ static DeprecatedString convert_enumeration_value_to_cpp_enum_member(DeprecatedS
builder.append('_');
names_already_seen.set(builder.string_view());
return builder.build();
return builder.to_deprecated_string();
}
namespace IDL {

View file

@ -306,7 +306,7 @@ RefPtr<Promise<Optional<SolidResponse>>> Client::store(StoreMethod method, Seque
flags_builder.join(' ', flags);
flags_builder.append(')');
auto command = Command { uid ? CommandType::UIDStore : CommandType::Store, m_current_command, { sequence_set.serialize(), data_item_name.build(), flags_builder.build() } };
auto command = Command { uid ? CommandType::UIDStore : CommandType::Store, m_current_command, { sequence_set.serialize(), data_item_name.to_deprecated_string(), flags_builder.to_deprecated_string() } };
return cast_promise<SolidResponse>(send_command(move(command)));
}
RefPtr<Promise<Optional<SolidResponse>>> Client::search(Optional<DeprecatedString> charset, Vector<SearchKey>&& keys, bool uid)
@ -363,7 +363,7 @@ RefPtr<Promise<Optional<SolidResponse>>> Client::status(StringView mailbox, Vect
types_list.append('(');
types_list.join(' ', args);
types_list.append(')');
auto command = Command { CommandType::Status, m_current_command, { mailbox, types_list.build() } };
auto command = Command { CommandType::Status, m_current_command, { mailbox, types_list.to_deprecated_string() } };
return cast_promise<SolidResponse>(send_command(move(command)));
}
@ -375,7 +375,7 @@ RefPtr<Promise<Optional<SolidResponse>>> Client::append(StringView mailbox, Mess
flags_sb.append('(');
flags_sb.join(' ', flags.value());
flags_sb.append(')');
args.append(flags_sb.build());
args.append(flags_sb.to_deprecated_string());
}
if (date_time.has_value())
args.append(date_time.value().to_deprecated_string("\"%d-%b-%Y %H:%M:%S +0000\""sv));

View file

@ -41,7 +41,7 @@ DeprecatedString FetchCommand::DataItem::Section::serialize() const
first = false;
}
headers_builder.append(')');
return headers_builder.build();
return headers_builder.to_deprecated_string();
}
case SectionType::Text:
return "TEXT";
@ -57,7 +57,7 @@ DeprecatedString FetchCommand::DataItem::Section::serialize() const
if (ends_with_mime) {
sb.append(".MIME"sv);
}
return sb.build();
return sb.to_deprecated_string();
}
}
VERIFY_NOT_REACHED();
@ -82,7 +82,7 @@ DeprecatedString FetchCommand::DataItem::serialize() const
sb.appendff("<{}.{}>", start, octets);
}
return sb.build();
return sb.to_deprecated_string();
}
case DataItemType::BodyStructure:
return "BODYSTRUCTURE";
@ -111,7 +111,7 @@ DeprecatedString FetchCommand::serialize()
first = false;
}
return AK::DeprecatedString::formatted("{} ({})", sequence_builder.build(), data_items_builder.build());
return AK::DeprecatedString::formatted("{} ({})", sequence_builder.to_deprecated_string(), data_items_builder.to_deprecated_string());
}
DeprecatedString serialize_astring(StringView string)
{
@ -164,7 +164,7 @@ DeprecatedString SearchKey::serialize() const
sb.append(item->serialize());
first = false;
}
return sb.build();
return sb.to_deprecated_string();
},
[&](Seen const&) { return DeprecatedString("SEEN"); },
[&](SentBefore const& x) { return DeprecatedString::formatted("SENTBEFORE {}", x.date.to_deprecated_string("%d-%b-%Y"sv)); },

View file

@ -83,7 +83,7 @@ void Parser::parse_response_done()
}
consume("\r\n"sv);
m_response.m_response_text = response_data.build();
m_response.m_response_text = response_data.to_deprecated_string();
}
void Parser::consume(StringView x)

View file

@ -3762,7 +3762,7 @@ Completion TemplateLiteral::execute(Interpreter& interpreter) const
}
// 7. Return the string-concatenation of head, middle, and tail.
return Value { PrimitiveString::create(vm, string_builder.build()) };
return Value { PrimitiveString::create(vm, string_builder.to_deprecated_string()) };
}
void TaggedTemplateLiteral::dump(int indent) const

View file

@ -142,7 +142,7 @@ void MergeBlocks::perform(PassPipelineExecutable& executable)
builder.append(entry->name());
}
auto new_block = BasicBlock::create(builder.build(), size);
auto new_block = BasicBlock::create(builder.to_deprecated_string(), size);
auto& block = *new_block;
auto first_successor_position = replace_blocks(successors, *new_block);
VERIFY(first_successor_position.has_value());

View file

@ -32,7 +32,7 @@ DeprecatedString ParserError::source_location_hint(StringView source, char const
for (size_t i = 0; i < position.value().column - 1; ++i)
builder.append(spacer);
builder.append(indicator);
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -57,7 +57,7 @@ DeprecatedString Date::iso_date_string() const
builder.appendff("{:03}", ms_from_time(m_date_value));
builder.append('Z');
return builder.build();
return builder.to_deprecated_string();
}
// DayWithinYear(t), https://tc39.es/ecma262/#eqn-DayWithinYear

View file

@ -95,7 +95,7 @@ DeprecatedString Error::stack_string() const
}
}
return stack_string_builder.build();
return stack_string_builder.to_deprecated_string();
}
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \

View file

@ -413,7 +413,7 @@ static ThrowCompletionOr<DeprecatedString> encode(VM& vm, DeprecatedString const
VERIFY(nwritten > 0);
}
}
return encoded_builder.build();
return encoded_builder.to_deprecated_string();
}
// 19.2.6.1.2 Decode ( string, reservedSet ), https://tc39.es/ecma262/#sec-decode
@ -471,7 +471,7 @@ static ThrowCompletionOr<DeprecatedString> decode(VM& vm, DeprecatedString const
}
if (expected_continuation_bytes > 0)
return vm.throw_completion<URIError>(ErrorType::URIMalformed);
return decoded_builder.build();
return decoded_builder.to_deprecated_string();
}
// 19.2.6.4 encodeURI ( uri ), https://tc39.es/ecma262/#sec-encodeuri-uri
@ -521,7 +521,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::escape)
}
escaped.appendff("%u{:04X}", code_point);
}
return PrimitiveString::create(vm, escaped.build());
return PrimitiveString::create(vm, escaped.to_deprecated_string());
}
// B.2.1.2 unescape ( string ), https://tc39.es/ecma262/#sec-unescape-string
@ -543,7 +543,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::unescape)
}
unescaped.append_code_point(code_point);
}
return PrimitiveString::create(vm, unescaped.build());
return PrimitiveString::create(vm, unescaped.to_deprecated_string());
}
}

View file

@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format)
}
// 7. Return result.
return PrimitiveString::create(vm, result.build());
return PrimitiveString::create(vm, result.to_deprecated_string());
}
// 1.4.4 Intl.DurationFormat.prototype.formatToParts ( duration ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.formatToParts

View file

@ -237,7 +237,7 @@ ThrowCompletionOr<DeprecatedString> format_relative_time(VM& vm, RelativeTimeFor
}
// 4. Return result.
return result.build();
return result.to_deprecated_string();
}
// 17.5.5 FormatRelativeTimeToParts ( relativeTimeFormat, value, unit ), https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts

View file

@ -116,7 +116,7 @@ ErrorOr<DeprecatedString, ParseRegexPatternError> parse_regex_pattern(StringView
builder.append_code_point(code_unit);
}
return builder.build();
return builder.to_deprecated_string();
}
ThrowCompletionOr<DeprecatedString> parse_regex_pattern(VM& vm, StringView pattern, bool unicode, bool unicode_sets)

View file

@ -820,13 +820,13 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
// 15. If nextSourcePosition ≥ lengthS, return accumulatedResult.
if (next_source_position >= string.length_in_code_units())
return PrimitiveString::create(vm, accumulated_result.build());
return PrimitiveString::create(vm, accumulated_result.to_deprecated_string());
// 16. Return the string-concatenation of accumulatedResult and the substring of S from nextSourcePosition.
auto substring = string.substring_view(next_source_position);
accumulated_result.append(substring);
return PrimitiveString::create(vm, accumulated_result.build());
return PrimitiveString::create(vm, accumulated_result.to_deprecated_string());
}
// 22.2.5.12 RegExp.prototype [ @@search ] ( string ), https://tc39.es/ecma262/#sec-regexp.prototype-@@search

View file

@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
builder.append(next_sub);
}
}
return PrimitiveString::create(vm, builder.build());
return PrimitiveString::create(vm, builder.to_deprecated_string());
}
// 22.1.2.1 String.fromCharCode ( ...codeUnits ), https://tc39.es/ecma262/#sec-string.fromcharcode

View file

@ -63,7 +63,7 @@ double Token::double_value() const
builder.append(ch);
}
DeprecatedString value_string = builder.to_deprecated_string();
auto value_string = builder.to_deprecated_string();
if (value_string[0] == '0' && value_string.length() >= 2) {
if (value_string[1] == 'x' || value_string[1] == 'X') {
// hexadecimal

View file

@ -372,7 +372,7 @@ void Editor::insert(const u32 cp)
{
StringBuilder builder;
builder.append(Utf32View(&cp, 1));
auto str = builder.build();
auto str = builder.to_deprecated_string();
if (m_pending_chars.try_append(str.characters(), str.length()).is_error())
return;
@ -1750,7 +1750,7 @@ DeprecatedString Style::to_deprecated_string() const
builder.append('}');
return builder.build();
return builder.to_deprecated_string();
}
ErrorOr<void> VT::apply_style(Style const& style, Core::Stream::Stream& stream, bool is_starting)
@ -2182,7 +2182,7 @@ DeprecatedString Editor::line(size_t up_to_index) const
{
StringBuilder builder;
builder.append(Utf32View { m_buffer.data(), min(m_buffer.size(), up_to_index) });
return builder.build();
return builder.to_deprecated_string();
}
void Editor::remove_at_index(size_t index)

View file

@ -36,7 +36,7 @@ void Editor::search_forwards()
ScopedValueRollback inline_search_cursor_rollback { m_inline_search_cursor };
StringBuilder builder;
builder.append(Utf32View { m_buffer.data(), m_inline_search_cursor });
DeprecatedString search_phrase = builder.to_deprecated_string();
auto search_phrase = builder.to_deprecated_string();
if (m_search_offset_state == SearchOffsetState::Backwards)
--m_search_offset;
if (m_search_offset > 0) {
@ -63,7 +63,7 @@ void Editor::search_backwards()
ScopedValueRollback inline_search_cursor_rollback { m_inline_search_cursor };
StringBuilder builder;
builder.append(Utf32View { m_buffer.data(), m_inline_search_cursor });
DeprecatedString search_phrase = builder.to_deprecated_string();
auto search_phrase = builder.to_deprecated_string();
if (m_search_offset_state == SearchOffsetState::Forwards)
++m_search_offset;
if (search(search_phrase, true)) {
@ -237,7 +237,7 @@ void Editor::enter_search()
StringBuilder builder;
builder.append(Utf32View { search_editor.buffer().data(), search_editor.buffer().size() });
if (!search(builder.build(), false, false)) {
if (!search(builder.to_deprecated_string(), false, false)) {
m_chars_touched_in_the_middle = m_buffer.size();
m_refresh_needed = true;
m_buffer.clear();

View file

@ -290,7 +290,7 @@ static ErrorOr<Optional<String>> format_time_zone_offset(StringView locale, Cale
}
// The digits used for hours, minutes and seconds fields in this format are the locale's default decimal digits.
auto result = TRY(replace_digits_for_number_system(*number_system, builder.build()));
auto result = TRY(replace_digits_for_number_system(*number_system, builder.to_deprecated_string()));
return TRY(String::from_utf8(formats->gmt_format)).replace("{0}"sv, result, ReplaceMode::FirstOnly);
}

View file

@ -17,7 +17,7 @@ DeprecatedString BlockQuote::render_to_html(bool) const
builder.append("<blockquote>\n"sv);
builder.append(m_contents->render_to_html());
builder.append("</blockquote>\n"sv);
return builder.build();
return builder.to_deprecated_string();
}
Vector<DeprecatedString> BlockQuote::render_lines_for_terminal(size_t view_width) const

View file

@ -51,7 +51,7 @@ DeprecatedString CodeBlock::render_to_html(bool) const
builder.append("</pre>\n"sv);
return builder.build();
return builder.to_deprecated_string();
}
Vector<DeprecatedString> CodeBlock::render_lines_for_terminal(size_t) const
@ -174,7 +174,7 @@ OwnPtr<CodeBlock> CodeBlock::parse_backticks(LineIterator& lines, Heading* curre
builder.append('\n');
}
return make<CodeBlock>(language, style, builder.build(), current_section);
return make<CodeBlock>(language, style, builder.to_deprecated_string(), current_section);
}
OwnPtr<CodeBlock> CodeBlock::parse_indent(LineIterator& lines)
@ -197,6 +197,6 @@ OwnPtr<CodeBlock> CodeBlock::parse_indent(LineIterator& lines)
builder.append('\n');
}
return make<CodeBlock>("", "", builder.build(), nullptr);
return make<CodeBlock>("", "", builder.to_deprecated_string(), nullptr);
}
}

View file

@ -20,7 +20,7 @@ DeprecatedString CommentBlock::render_to_html(bool) const
// TODO: This is probably incorrect, because we technically need to escape "--" in some form. However, Browser does not care about this.
builder.append("-->\n"sv);
return builder.build();
return builder.to_deprecated_string();
}
Vector<DeprecatedString> CommentBlock::render_lines_for_terminal(size_t) const
@ -69,7 +69,7 @@ OwnPtr<CommentBlock> CommentBlock::parse(LineIterator& lines)
line = *lines;
}
return make<CommentBlock>(builder.build());
return make<CommentBlock>(builder.to_deprecated_string());
}
}

View file

@ -37,7 +37,7 @@ DeprecatedString ContainerBlock::render_to_html(bool tight) const
}
}
return builder.build();
return builder.to_deprecated_string();
}
Vector<DeprecatedString> ContainerBlock::render_lines_for_terminal(size_t view_width) const
@ -97,7 +97,7 @@ OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines)
auto flush_paragraph = [&] {
if (paragraph_text.is_empty())
return;
auto paragraph = make<Paragraph>(Text::parse(paragraph_text.build()));
auto paragraph = make<Paragraph>(Text::parse(paragraph_text.to_deprecated_string()));
blocks.append(move(paragraph));
paragraph_text.clear();
};

View file

@ -35,7 +35,7 @@ DeprecatedString Document::render_to_html(StringView extra_head_contents) const
</body>
</html>)~~~"sv);
return builder.build();
return builder.to_deprecated_string();
}
DeprecatedString Document::render_to_inline_html() const
@ -51,7 +51,7 @@ DeprecatedString Document::render_for_terminal(size_t view_width) const
builder.append("\n"sv);
}
return builder.build();
return builder.to_deprecated_string();
}
RecursionDecision Document::walk(Visitor& visitor) const

View file

@ -32,7 +32,7 @@ Vector<DeprecatedString> Heading::render_lines_for_terminal(size_t) const
break;
}
return Vector<DeprecatedString> { builder.build() };
return Vector<DeprecatedString> { builder.to_deprecated_string() };
}
RecursionDecision Heading::walk(Visitor& visitor) const

View file

@ -35,7 +35,7 @@ DeprecatedString List::render_to_html(bool) const
builder.appendff("</{}>\n", tag);
return builder.build();
return builder.to_deprecated_string();
}
Vector<DeprecatedString> List::render_lines_for_terminal(size_t view_width) const
@ -57,13 +57,13 @@ Vector<DeprecatedString> List::render_lines_for_terminal(size_t view_width) cons
builder.append(first_line);
lines.append(builder.build());
lines.append(builder.to_deprecated_string());
for (auto& line : item_lines) {
builder.clear();
builder.append(DeprecatedString::repeated(' ', item_indentation));
builder.append(line);
lines.append(builder.build());
lines.append(builder.to_deprecated_string());
}
}

View file

@ -25,7 +25,7 @@ DeprecatedString Paragraph::render_to_html(bool tight) const
builder.append('\n');
return builder.build();
return builder.to_deprecated_string();
}
Vector<DeprecatedString> Paragraph::render_lines_for_terminal(size_t) const

View file

@ -44,12 +44,12 @@ Vector<DeprecatedString> Table::render_lines_for_terminal(size_t view_width) con
write_aligned(col.header, width, col.alignment);
}
lines.append(builder.build());
lines.append(builder.to_deprecated_string());
builder.clear();
for (size_t i = 0; i < view_width; ++i)
builder.append('-');
lines.append(builder.build());
lines.append(builder.to_deprecated_string());
builder.clear();
for (size_t i = 0; i < m_row_count; ++i) {
@ -65,7 +65,7 @@ Vector<DeprecatedString> Table::render_lines_for_terminal(size_t view_width) con
size_t width = col.relative_width * unit_width_length;
write_aligned(cell, width, col.alignment);
}
lines.append(builder.build());
lines.append(builder.to_deprecated_string());
builder.clear();
}

View file

@ -266,14 +266,14 @@ DeprecatedString Text::render_to_html() const
{
StringBuilder builder;
m_node->render_to_html(builder);
return builder.build().trim(" \n\t"sv);
return builder.to_deprecated_string().trim(" \n\t"sv);
}
DeprecatedString Text::render_for_terminal() const
{
StringBuilder builder;
m_node->render_for_terminal(builder);
return builder.build().trim(" \n\t"sv);
return builder.to_deprecated_string().trim(" \n\t"sv);
}
RecursionDecision Text::walk(Visitor& visitor) const
@ -323,7 +323,7 @@ Vector<Text::Token> Text::tokenize(StringView str)
return;
tokens.append({
current_token.build(),
current_token.to_deprecated_string(),
left_flanking,
right_flanking,
punct_before,
@ -627,7 +627,7 @@ NonnullOwnPtr<Text::Node> Text::parse_link(Vector<Token>::ConstIterator& tokens)
if (*iterator == ")"sv) {
tokens = iterator;
return make<LinkNode>(is_image, move(link_text), address.build().trim_whitespace(), image_width, image_height);
return make<LinkNode>(is_image, move(link_text), address.to_deprecated_string().trim_whitespace(), image_width, image_height);
}
address.append(iterator->data);

View file

@ -273,7 +273,7 @@ public:
StringBuilder builder;
for (auto ch : data)
builder.append(ch); // Note: The type conversion is intentional.
optional_string_storage = builder.build();
optional_string_storage = builder.to_deprecated_string();
return RegexStringView { T { *optional_string_storage } };
},
[&](Utf32View) {

View file

@ -96,7 +96,7 @@ DeprecatedString Regex<Parser>::error_string(Optional<DeprecatedString> message)
eb.append(' ');
eb.appendff("^---- {}", message.value_or(get_error_string(parser_result.error)));
return eb.build();
return eb.to_deprecated_string();
}
template<typename Parser>

View file

@ -598,7 +598,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_repetition_symbol(ByteCode& byteco
number_builder.append(consume().value());
}
auto maybe_minimum = number_builder.build().to_uint();
auto maybe_minimum = number_builder.to_deprecated_string().to_uint();
if (!maybe_minimum.has_value())
return set_error(Error::InvalidBraceContent);
@ -627,7 +627,7 @@ ALWAYS_INLINE bool PosixExtendedParser::parse_repetition_symbol(ByteCode& byteco
number_builder.append(consume().value());
}
if (!number_builder.is_empty()) {
auto value = number_builder.build().to_uint();
auto value = number_builder.to_deprecated_string().to_uint();
if (!value.has_value() || minimum > value.value() || *value > s_maximum_repetition_count)
return set_error(Error::InvalidBraceContent);
@ -2530,7 +2530,7 @@ DeprecatedFlyString ECMA262Parser::read_capture_group_specifier(bool take_starti
builder.append_code_point(code_point);
}
DeprecatedFlyString name = builder.build();
DeprecatedFlyString name = builder.to_deprecated_string();
if (!hit_end || name.is_empty())
set_error(Error::InvalidNameForCaptureGroup);

View file

@ -211,7 +211,7 @@ ResultOr<Value> MatchExpression::evaluate(ExecutionContext& context) const
builder.append('$');
// FIXME: We should probably cache this regex.
auto regex = Regex<PosixBasic>(builder.build());
auto regex = Regex<PosixBasic>(builder.to_deprecated_string());
auto result = regex.match(lhs_value.to_deprecated_string(), PosixFlags::Insensitive | PosixFlags::Unicode);
return Value(invert_expression() ? !result.success : result.success);
}
@ -226,7 +226,7 @@ ResultOr<Value> MatchExpression::evaluate(ExecutionContext& context) const
builder.append("Regular expression: "sv);
builder.append(get_error_string(err));
return Result { SQLCommand::Unknown, SQLErrorCode::SyntaxError, builder.build() };
return Result { SQLCommand::Unknown, SQLErrorCode::SyntaxError, builder.to_deprecated_string() };
}
auto result = regex.match(lhs_value.to_deprecated_string(), PosixFlags::Insensitive | PosixFlags::Unicode);

View file

@ -109,7 +109,7 @@ Token Lexer::next()
}
}
Token token(token_type, current_token.build(),
Token token(token_type, current_token.to_deprecated_string(),
{ value_start_line_number, value_start_column_number },
{ m_line_number, m_line_column });

View file

@ -41,7 +41,7 @@ DeprecatedString Result::error_string() const
builder.append(error_description);
}
return builder.build();
return builder.to_deprecated_string();
}
}

View file

@ -364,7 +364,7 @@ void TreeNode::dump_if(int flag, DeprecatedString&& msg)
builder.append(", leaf"sv);
}
builder.append(')');
dbgln(builder.build());
dbgln(builder.to_deprecated_string());
}
void TreeNode::list_node(int indent)

View file

@ -173,7 +173,7 @@ DeprecatedString Tuple::to_deprecated_string() const
if (pointer() != 0) {
builder.appendff(":{}", pointer());
}
return builder.build();
return builder.to_deprecated_string();
}
void Tuple::copy_from(Tuple const& other)

Some files were not shown because too many files have changed in this diff Show more