mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
LibWeb: Convert a bunch of String::format() => String::formatted()
This commit is contained in:
parent
bd57fff6d4
commit
5e157eaf37
7 changed files with 10 additions and 13 deletions
|
@ -151,7 +151,7 @@ public:
|
||||||
{
|
{
|
||||||
if (is_auto())
|
if (is_auto())
|
||||||
return "[auto]";
|
return "[auto]";
|
||||||
return String::format("[%g %s]", m_value, unit_name());
|
return String::formatted("[{} {}]", m_value, unit_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const Length& other) const
|
bool operator==(const Length& other) const
|
||||||
|
|
|
@ -329,7 +329,7 @@ public:
|
||||||
static NonnullRefPtr<ImageStyleValue> create(const URL& url, DOM::Document& document) { return adopt(*new ImageStyleValue(url, document)); }
|
static NonnullRefPtr<ImageStyleValue> create(const URL& url, DOM::Document& document) { return adopt(*new ImageStyleValue(url, document)); }
|
||||||
virtual ~ImageStyleValue() override { }
|
virtual ~ImageStyleValue() override { }
|
||||||
|
|
||||||
String to_string() const override { return String::format("Image{%s}", m_url.to_string().characters()); }
|
String to_string() const override { return String::formatted("Image({})", m_url.to_string()); }
|
||||||
|
|
||||||
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
||||||
|
|
||||||
|
|
|
@ -227,8 +227,8 @@ static OwnPtr<Interface> parse_interface(StringView filename, const StringView&
|
||||||
attribute.unsigned_ = unsigned_;
|
attribute.unsigned_ = unsigned_;
|
||||||
attribute.type = type;
|
attribute.type = type;
|
||||||
attribute.name = name;
|
attribute.name = name;
|
||||||
attribute.getter_callback_name = String::format("%s_getter", snake_name(attribute.name).characters());
|
attribute.getter_callback_name = String::formatted("{}_getter", snake_name(attribute.name));
|
||||||
attribute.setter_callback_name = String::format("%s_setter", snake_name(attribute.name).characters());
|
attribute.setter_callback_name = String::formatted("{}_setter", snake_name(attribute.name));
|
||||||
attribute.extended_attributes = move(extended_attributes);
|
attribute.extended_attributes = move(extended_attributes);
|
||||||
interface->attributes.append(move(attribute));
|
interface->attributes.append(move(attribute));
|
||||||
};
|
};
|
||||||
|
@ -306,8 +306,8 @@ static OwnPtr<Interface> parse_interface(StringView filename, const StringView&
|
||||||
parse_function(extended_attributes);
|
parse_function(extended_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->wrapper_class = String::format("%sWrapper", interface->name.characters());
|
interface->wrapper_class = String::formatted("{}Wrapper", interface->name);
|
||||||
interface->wrapper_base_class = String::format("%sWrapper", interface->parent_name.is_empty() ? "" : interface->parent_name.characters());
|
interface->wrapper_base_class = String::formatted("{}Wrapper", interface->parent_name.is_empty() ? String::empty() : interface->parent_name);
|
||||||
|
|
||||||
return interface;
|
return interface;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
||||||
}
|
}
|
||||||
if (role == GUI::ModelRole::Display) {
|
if (role == GUI::ModelRole::Display) {
|
||||||
if (node.is_text())
|
if (node.is_text())
|
||||||
return String::format("%s", with_whitespace_collapsed(downcast<DOM::Text>(node).data()).characters());
|
return with_whitespace_collapsed(downcast<DOM::Text>(node).data());
|
||||||
if (!node.is_element())
|
if (!node.is_element())
|
||||||
return node.node_name();
|
return node.node_name();
|
||||||
auto& element = downcast<DOM::Element>(node);
|
auto& element = downcast<DOM::Element>(node);
|
||||||
|
|
|
@ -78,9 +78,6 @@ String HTMLToken::to_string() const
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return builder.to_string();
|
||||||
|
|
||||||
//dbg() << "[" << String::format("%42s", state_name(m_state)) << "] " << builder.to_string();
|
|
||||||
//m_current_token = {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ GUI::Variant LayoutTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole
|
||||||
}
|
}
|
||||||
if (role == GUI::ModelRole::Display) {
|
if (role == GUI::ModelRole::Display) {
|
||||||
if (is<Layout::TextNode>(node))
|
if (is<Layout::TextNode>(node))
|
||||||
return String::format("TextNode: %s", with_whitespace_collapsed(downcast<Layout::TextNode>(node).text_for_rendering()).characters());
|
return String::formatted("TextNode: {}", with_whitespace_collapsed(downcast<Layout::TextNode>(node).text_for_rendering()));
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(node.class_name());
|
builder.append(node.class_name());
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
|
|
|
@ -173,7 +173,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
||||||
download->on_buffered_download_finish = [this, success_callback = move(success_callback), error_callback = move(error_callback), download](bool success, auto, auto& response_headers, auto status_code, ReadonlyBytes payload) {
|
download->on_buffered_download_finish = [this, success_callback = move(success_callback), error_callback = move(error_callback), download](bool success, auto, auto& response_headers, auto status_code, ReadonlyBytes payload) {
|
||||||
if (status_code.has_value() && status_code.value() >= 400 && status_code.value() <= 499) {
|
if (status_code.has_value() && status_code.value() >= 400 && status_code.value() <= 499) {
|
||||||
if (error_callback)
|
if (error_callback)
|
||||||
error_callback(String::format("HTTP error (%u)", status_code.value()));
|
error_callback(String::formatted("HTTP error ({})", status_code.value()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
--m_pending_loads;
|
--m_pending_loads;
|
||||||
|
@ -201,7 +201,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_callback)
|
if (error_callback)
|
||||||
error_callback(String::format("Protocol not implemented: %s", url.protocol().characters()));
|
error_callback(String::formatted("Protocol not implemented: {}", url.protocol()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceLoader::load(const URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers)> success_callback, Function<void(const String&)> error_callback)
|
void ResourceLoader::load(const URL& url, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers)> success_callback, Function<void(const String&)> error_callback)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue