mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:57:44 +00:00
Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
This commit is contained in:
parent
3f3f45580a
commit
c8585b77d2
86 changed files with 283 additions and 283 deletions
|
@ -28,7 +28,7 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
|||
// Start reading file line by line
|
||||
for (auto object_line : file.lines()) {
|
||||
// Ignore file comments
|
||||
if (object_line.starts_with("#"))
|
||||
if (object_line.starts_with('#'))
|
||||
continue;
|
||||
|
||||
if (object_line.starts_with("vt"sv)) {
|
||||
|
@ -59,7 +59,7 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
|||
}
|
||||
|
||||
// This line describes a vertex (a position in 3D space)
|
||||
if (object_line.starts_with("v")) {
|
||||
if (object_line.starts_with('v')) {
|
||||
auto vertex_line = object_line.split_view(' ');
|
||||
if (vertex_line.size() != 4) {
|
||||
dbgln("Wavefront: Malformed vertex line. Aborting.");
|
||||
|
@ -74,7 +74,7 @@ RefPtr<Mesh> WavefrontOBJLoader::load(Core::File& file)
|
|||
}
|
||||
|
||||
// This line describes a face (a collection of 3+ vertices, aka a triangle or polygon)
|
||||
if (object_line.starts_with("f")) {
|
||||
if (object_line.starts_with('f')) {
|
||||
auto face_line = object_line.substring_view(2).split_view(' ');
|
||||
auto number_of_vertices = face_line.size();
|
||||
if (number_of_vertices < 3) {
|
||||
|
|
|
@ -62,7 +62,7 @@ void URLResult::activate() const
|
|||
|
||||
void AppProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
if (query.starts_with("=") || query.starts_with('$'))
|
||||
if (query.starts_with('=') || query.starts_with('$'))
|
||||
return;
|
||||
|
||||
NonnullRefPtrVector<Result> results;
|
||||
|
@ -81,7 +81,7 @@ void AppProvider::query(String const& query, Function<void(NonnullRefPtrVector<R
|
|||
|
||||
void CalculatorProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete)
|
||||
{
|
||||
if (!query.starts_with("="))
|
||||
if (!query.starts_with('='))
|
||||
return;
|
||||
|
||||
auto vm = JS::VM::create();
|
||||
|
|
|
@ -121,7 +121,7 @@ String Keypad::to_string() const
|
|||
{
|
||||
StringBuilder builder;
|
||||
if (m_negative)
|
||||
builder.append("-");
|
||||
builder.append('-');
|
||||
builder.appendff("{}", m_int_value.value());
|
||||
|
||||
// NOTE: This is so the decimal point appears on screen as soon as you type it.
|
||||
|
|
|
@ -209,7 +209,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
auto& arguments_label = *widget->find_descendant_of_type_named<GUI::Label>("arguments_label");
|
||||
arguments_label.set_text(String::join(" ", crashed_process_arguments));
|
||||
arguments_label.set_text(String::join(' ', crashed_process_arguments));
|
||||
|
||||
auto& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar");
|
||||
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||
|
@ -241,7 +241,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
environment_tab->layout()->set_margins(4);
|
||||
|
||||
auto environment_text_editor = TRY(environment_tab->try_add<GUI::TextEditor>());
|
||||
environment_text_editor->set_text(String::join("\n", environment));
|
||||
environment_text_editor->set_text(String::join('\n', environment));
|
||||
environment_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly);
|
||||
environment_text_editor->set_should_hide_unnecessary_scrollbars(true);
|
||||
|
||||
|
@ -250,7 +250,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
memory_regions_tab->layout()->set_margins(4);
|
||||
|
||||
auto memory_regions_text_editor = TRY(memory_regions_tab->try_add<GUI::TextEditor>());
|
||||
memory_regions_text_editor->set_text(String::join("\n", memory_regions));
|
||||
memory_regions_text_editor->set_text(String::join('\n', memory_regions));
|
||||
memory_regions_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly);
|
||||
memory_regions_text_editor->set_should_hide_unnecessary_scrollbars(true);
|
||||
memory_regions_text_editor->set_visualize_trailing_whitespace(false);
|
||||
|
|
|
@ -201,7 +201,7 @@ void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* w
|
|||
|
||||
StringBuilder path_builder;
|
||||
path_builder.append(output_directory_path.dirname());
|
||||
path_builder.append("/");
|
||||
path_builder.append('/');
|
||||
if (archive_name.is_empty()) {
|
||||
path_builder.append(output_directory_path.parent().basename());
|
||||
path_builder.append(".zip"sv);
|
||||
|
|
|
@ -849,7 +849,7 @@ void MainWidget::update_statusbar()
|
|||
builder.append_code_point(glyph);
|
||||
}
|
||||
|
||||
builder.append(")");
|
||||
builder.append(')');
|
||||
|
||||
auto glyph_name = Unicode::code_point_display_name(glyph);
|
||||
if (glyph_name.has_value()) {
|
||||
|
|
|
@ -169,7 +169,7 @@ struct QueueEntry {
|
|||
|
||||
static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, HashMap<int, int>& error_accumulator, GUI::Label& progresslabel)
|
||||
{
|
||||
VERIFY(!root.m_name.ends_with("/"));
|
||||
VERIFY(!root.m_name.ends_with('/'));
|
||||
|
||||
Queue<QueueEntry> queue;
|
||||
queue.enqueue(QueueEntry(root.m_name, &root));
|
||||
|
@ -177,7 +177,7 @@ static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, Ha
|
|||
|
||||
StringBuilder builder = StringBuilder();
|
||||
builder.append(root.m_name);
|
||||
builder.append("/");
|
||||
builder.append('/');
|
||||
MountInfo* root_mount_info = find_mount_for_path(builder.to_string(), mounts);
|
||||
if (!root_mount_info) {
|
||||
return;
|
||||
|
@ -187,7 +187,7 @@ static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, Ha
|
|||
|
||||
builder.clear();
|
||||
builder.append(queue_entry.path);
|
||||
builder.append("/");
|
||||
builder.append('/');
|
||||
|
||||
MountInfo* mount_info = find_mount_for_path(builder.to_string(), mounts);
|
||||
if (!mount_info || (mount_info != root_mount_info && mount_info->source != root_mount_info->source)) {
|
||||
|
@ -269,7 +269,7 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg
|
|||
} else {
|
||||
builder.append(" times"sv);
|
||||
}
|
||||
builder.append(")");
|
||||
builder.append(')');
|
||||
first = false;
|
||||
}
|
||||
statusbar.set_text(builder.to_string());
|
||||
|
@ -404,7 +404,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
const SpaceAnalyzer::TreeMapNode* node = treemapwidget.path_node(k);
|
||||
|
||||
builder.append("/");
|
||||
builder.append('/');
|
||||
builder.append(node->name());
|
||||
|
||||
breadcrumbbar.append_segment(node->name(), GUI::FileIconProvider::icon_for_path(builder.string_view()).bitmap_for_size(16), builder.string_view(), builder.string_view());
|
||||
|
|
|
@ -22,7 +22,7 @@ void Cell::set_data(String new_data)
|
|||
if (m_data == new_data)
|
||||
return;
|
||||
|
||||
if (new_data.starts_with("=")) {
|
||||
if (new_data.starts_with('=')) {
|
||||
new_data = new_data.substring(1, new_data.length() - 1);
|
||||
m_kind = Formula;
|
||||
} else {
|
||||
|
|
|
@ -140,7 +140,7 @@ private:
|
|||
auto string = String::formatted("{}", FormatIfSupported(entry));
|
||||
|
||||
auto safe_to_write_normally = (m_behaviors & WriterBehavior::QuoteAll) == WriterBehavior::None
|
||||
&& !string.contains("\n")
|
||||
&& !string.contains('\n')
|
||||
&& !string.contains(m_traits.separator);
|
||||
|
||||
if (safe_to_write_normally) {
|
||||
|
|
|
@ -226,9 +226,9 @@ public:
|
|||
"Size", Gfx::TextAlignment::CenterRight,
|
||||
[](const JsonObject& object) {
|
||||
StringBuilder size_builder;
|
||||
size_builder.append(" ");
|
||||
size_builder.append(' ');
|
||||
size_builder.append(human_readable_size(object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64()));
|
||||
size_builder.append(" ");
|
||||
size_builder.append(' ');
|
||||
return size_builder.to_string();
|
||||
},
|
||||
[](const JsonObject& object) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue