1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:37:35 +00:00

Everywhere: Pass AK::StringView by value

This commit is contained in:
Andreas Kling 2021-11-11 00:55:02 +01:00
parent ad5d217e76
commit 8b1108e485
392 changed files with 978 additions and 978 deletions

View file

@ -36,7 +36,7 @@ struct ClassViewNode {
NonnullOwnPtrVector<ClassViewNode> children;
ClassViewNode* parent { nullptr };
explicit ClassViewNode(const StringView& name)
explicit ClassViewNode(StringView name)
: name(name) {};
};

View file

@ -138,7 +138,7 @@ void EvaluateExpressionDialog::handle_evaluation(const String& expression)
set_output(JS::MarkupGenerator::html_from_value(m_interpreter->vm().last_value()));
}
void EvaluateExpressionDialog::set_output(const StringView& html)
void EvaluateExpressionDialog::set_output(StringView html)
{
auto paragraph = m_output_container->document().create_element("p");
paragraph->set_inner_html(html);

View file

@ -19,7 +19,7 @@ private:
void build(Window* parent_window);
void handle_evaluation(const String& expression);
void set_output(const StringView& html);
void set_output(StringView html);
NonnullOwnPtr<JS::Interpreter> m_interpreter;
RefPtr<GUI::TextBox> m_text_editor;

View file

@ -89,7 +89,7 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var
return String::formatted("type: {} @ {:p}, ", variable.type_name, variable_address);
}
static Optional<u32> string_to_variable_value(const StringView& string_value, const Debug::DebugInfo::VariableInfo& variable)
static Optional<u32> string_to_variable_value(StringView string_value, const Debug::DebugInfo::VariableInfo& variable)
{
if (variable.is_enum_type()) {
auto prefix_string = String::formatted("{}::", variable.type_name);
@ -124,7 +124,7 @@ static Optional<u32> string_to_variable_value(const StringView& string_value, co
return {};
}
void VariablesModel::set_variable_value(const GUI::ModelIndex& index, const StringView& string_value, GUI::Window* parent_window)
void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView string_value, GUI::Window* parent_window)
{
auto variable = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data());

View file

@ -18,7 +18,7 @@ class VariablesModel final : public GUI::Model {
public:
static RefPtr<VariablesModel> create(const PtraceRegisters& regs);
void set_variable_value(const GUI::ModelIndex&, const StringView&, GUI::Window*);
void set_variable_value(const GUI::ModelIndex&, StringView, GUI::Window*);
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }

View file

@ -89,7 +89,7 @@ private:
Vector<Match> m_matches;
};
static RefPtr<SearchResultsModel> find_in_files(const StringView& text)
static RefPtr<SearchResultsModel> find_in_files(StringView text)
{
Vector<Match> matches;
project().for_each_text_file([&](auto& file) {

View file

@ -31,7 +31,7 @@ class ServerConnection
friend class ServerConnectionWrapper;
public:
ServerConnection(const StringView& socket, const String& project_path)
ServerConnection(StringView socket, const String& project_path)
: IPC::ServerConnection<LanguageClientEndpoint, LanguageServerEndpoint>(*this, socket)
{
m_project_path = project_path;

View file

@ -355,12 +355,12 @@ Vector<CppComprehensionEngine::Symbol> CppComprehensionEngine::get_child_symbols
return symbols;
}
String CppComprehensionEngine::document_path_from_include_path(const StringView& include_path) const
String CppComprehensionEngine::document_path_from_include_path(StringView include_path) const
{
static Regex<PosixExtended> library_include("<(.+)>");
static Regex<PosixExtended> user_defined_include("\"(.+)\"");
auto document_path_for_library_include = [&](const StringView& include_path) -> String {
auto document_path_for_library_include = [&](StringView include_path) -> String {
RegexResult result;
if (!library_include.search(include_path, result))
return {};
@ -369,7 +369,7 @@ String CppComprehensionEngine::document_path_from_include_path(const StringView&
return String::formatted("/usr/include/{}", path);
};
auto document_path_for_user_defined_include = [&](const StringView& include_path) -> String {
auto document_path_for_user_defined_include = [&](StringView include_path) -> String {
RegexResult result;
if (!user_defined_include.search(include_path, result))
return {};

View file

@ -117,7 +117,7 @@ private:
void set_document_data(const String& file, OwnPtr<DocumentData>&& data);
OwnPtr<DocumentData> create_document_data_for(const String& file);
String document_path_from_include_path(const StringView& include_path) const;
String document_path_from_include_path(StringView include_path) const;
void update_declared_symbols(DocumentData&);
void update_todo_entries(DocumentData&);
GUI::AutocompleteProvider::DeclarationType type_of_declaration(const Declaration&);

View file

@ -39,7 +39,7 @@ private:
void set_document_data(const String& file, OwnPtr<DocumentData>&& data);
OwnPtr<DocumentData> create_document_data_for(const String& file);
String document_path_from_include_path(const StringView& include_path) const;
String document_path_from_include_path(StringView include_path) const;
void update_declared_symbols(const DocumentData&);
static size_t resolve(const ShellComprehensionEngine::DocumentData& document, const GUI::TextPosition& position);

View file

@ -82,7 +82,7 @@ void RemoteProcess::set_inspected_object(FlatPtr address)
m_client->async_set_inspected_object(m_pid, address);
}
void RemoteProcess::set_property(FlatPtr object, const StringView& name, const JsonValue& value)
void RemoteProcess::set_property(FlatPtr object, StringView name, const JsonValue& value)
{
m_client->async_set_object_property(m_pid, object, name, value.to_string());
}

View file

@ -30,7 +30,7 @@ public:
void set_inspected_object(FlatPtr);
void set_property(FlatPtr object, const StringView& name, const JsonValue& value);
void set_property(FlatPtr object, StringView name, const JsonValue& value);
bool is_inspectable();

View file

@ -215,7 +215,7 @@ void Profile::rebuild_tree()
Optional<MappedObject> g_kernel_debuginfo_object;
OwnPtr<Debug::DebugInfo> g_kernel_debug_info;
ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(const StringView& path)
ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path)
{
auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));

View file

@ -141,7 +141,7 @@ struct ProcessFilter {
class Profile {
public:
static ErrorOr<NonnullOwnPtr<Profile>> load_from_perfcore_file(const StringView& path);
static ErrorOr<NonnullOwnPtr<Profile>> load_from_perfcore_file(StringView path);
GUI::Model& model();
GUI::Model& samples_model();

View file

@ -145,7 +145,7 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return {};
}
Vector<GUI::ModelIndex> ProfileModel::matches(StringView const& searching, unsigned flags, GUI::ModelIndex const& parent)
Vector<GUI::ModelIndex> ProfileModel::matches(StringView searching, unsigned flags, GUI::ModelIndex const& parent)
{
RemoveReference<decltype(m_profile.roots())>* nodes { nullptr };

View file

@ -39,7 +39,7 @@ public:
virtual int tree_column() const override { return Column::StackFrame; }
virtual bool is_column_sortable(int) const override { return false; }
virtual bool is_searchable() const override { return true; }
virtual Vector<GUI::ModelIndex> matches(StringView const&, unsigned flags, GUI::ModelIndex const&) override;
virtual Vector<GUI::ModelIndex> matches(StringView, unsigned flags, GUI::ModelIndex const&) override;
private:
explicit ProfileModel(Profile&);

View file

@ -11,7 +11,7 @@
extern bool g_report_to_debug;
template<typename... Ts>
void reportln(const StringView& format, Ts... args)
void reportln(StringView format, Ts... args)
{
if (g_report_to_debug) {
AK::VariadicFormatParams variadic_format_params { args... };

View file

@ -196,7 +196,7 @@ void SoftCPU::write_memory256(X86::LogicalAddress address, ValueWithShadow<u256>
m_emulator.mmu().write256(address, value);
}
void SoftCPU::push_string(const StringView& string)
void SoftCPU::push_string(StringView string)
{
size_t space_to_allocate = round_up_to_power_of_two(string.length() + 1, 16);
set_esp({ esp().value() - space_to_allocate, esp().shadow() });

View file

@ -78,7 +78,7 @@ public:
void push16(ValueWithShadow<u16>);
ValueWithShadow<u16> pop16();
void push_string(const StringView&);
void push_string(StringView);
void push_buffer(const u8* data, size_t);
u16 segment(X86::SegmentRegister seg) const { return m_segment[(int)seg]; }