1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:37:45 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -17,7 +17,7 @@ RemoteObjectPropertyModel::RemoteObjectPropertyModel(RemoteObject& object)
int RemoteObjectPropertyModel::row_count(const GUI::ModelIndex& index) const
{
Function<int(const JsonValue&)> do_count = [&](const JsonValue& value) {
Function<int(JsonValue const&)> do_count = [&](JsonValue const& value) {
if (value.is_array())
return value.as_array().size();
else if (value.is_object())
@ -26,7 +26,7 @@ int RemoteObjectPropertyModel::row_count(const GUI::ModelIndex& index) const
};
if (index.is_valid()) {
auto* path = static_cast<const JsonPath*>(index.internal_data());
auto* path = static_cast<JsonPath const*>(index.internal_data());
return do_count(path->resolve(m_object.json));
} else {
return do_count(m_object.json);
@ -46,7 +46,7 @@ String RemoteObjectPropertyModel::column_name(int column) const
GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
auto* path = static_cast<const JsonPath*>(index.internal_data());
auto* path = static_cast<JsonPath const*>(index.internal_data());
if (!path)
return {};
@ -72,7 +72,7 @@ void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI
if (!index.is_valid())
return;
auto* path = static_cast<const JsonPath*>(index.internal_data());
auto* path = static_cast<JsonPath const*>(index.internal_data());
if (path->size() != 1)
return;
@ -83,9 +83,9 @@ void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI
GUI::ModelIndex RemoteObjectPropertyModel::index(int row, int column, const GUI::ModelIndex& parent) const
{
const auto& parent_path = parent.is_valid() ? *static_cast<const JsonPath*>(parent.internal_data()) : JsonPath {};
auto const& parent_path = parent.is_valid() ? *static_cast<JsonPath const*>(parent.internal_data()) : JsonPath {};
auto nth_child = [&](int n, const JsonValue& value) -> const JsonPath* {
auto nth_child = [&](int n, JsonValue const& value) -> JsonPath const* {
auto path = make<JsonPath>();
path->extend(parent_path);
int row_index = n;
@ -135,7 +135,7 @@ GUI::ModelIndex RemoteObjectPropertyModel::parent_index(const GUI::ModelIndex& i
if (!index.is_valid())
return index;
auto path = *static_cast<const JsonPath*>(index.internal_data());
auto path = *static_cast<JsonPath const*>(index.internal_data());
if (path.is_empty())
return {};
@ -168,12 +168,12 @@ GUI::ModelIndex RemoteObjectPropertyModel::parent_index(const GUI::ModelIndex& i
return {};
}
const JsonPath* RemoteObjectPropertyModel::cached_path_at(int n, const Vector<JsonPathElement>& prefix) const
JsonPath const* RemoteObjectPropertyModel::cached_path_at(int n, Vector<JsonPathElement> const& prefix) const
{
// FIXME: ModelIndex wants a void*, so we have to keep these
// indices alive, but allocating a new path every time
// we're asked for an index is silly, so we have to look for existing ones first.
const JsonPath* index_path = nullptr;
JsonPath const* index_path = nullptr;
int row_index = n;
for (auto& path : m_paths) {
if (path.size() != prefix.size() + 1)
@ -195,7 +195,7 @@ const JsonPath* RemoteObjectPropertyModel::cached_path_at(int n, const Vector<Js
return index_path;
};
const JsonPath* RemoteObjectPropertyModel::find_cached_path(const Vector<JsonPathElement>& path) const
JsonPath const* RemoteObjectPropertyModel::find_cached_path(Vector<JsonPathElement> const& path) const
{
for (auto& cpath : m_paths) {
if (cpath.size() != path.size())

View file

@ -41,8 +41,8 @@ public:
private:
explicit RemoteObjectPropertyModel(RemoteObject&);
const JsonPath* cached_path_at(int n, const Vector<JsonPathElement>& prefix) const;
const JsonPath* find_cached_path(const Vector<JsonPathElement>& path) const;
JsonPath const* cached_path_at(int n, Vector<JsonPathElement> const& prefix) const;
JsonPath const* find_cached_path(Vector<JsonPathElement> const& path) const;
RemoteObject& m_object;
mutable NonnullOwnPtrVector<JsonPath> m_paths;

View file

@ -27,7 +27,7 @@ RemoteProcess::RemoteProcess(pid_t pid)
m_client = InspectorServerClient::try_create().release_value_but_fixme_should_propagate_errors();
}
void RemoteProcess::handle_identify_response(const JsonObject& response)
void RemoteProcess::handle_identify_response(JsonObject const& response)
{
int pid = response.get("pid").to_int();
VERIFY(pid == m_pid);
@ -38,7 +38,7 @@ void RemoteProcess::handle_identify_response(const JsonObject& response)
on_update();
}
void RemoteProcess::handle_get_all_objects_response(const JsonObject& response)
void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
{
// FIXME: It would be good if we didn't have to make a local copy of the array value here!
auto objects = response.get("objects");
@ -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, StringView name, const JsonValue& value)
void RemoteProcess::set_property(FlatPtr object, StringView name, JsonValue const& value)
{
m_client->async_set_object_property(m_pid, object, name, value.to_string());
}

View file

@ -22,24 +22,24 @@ public:
void update();
pid_t pid() const { return m_pid; }
const String& process_name() const { return m_process_name; }
String const& process_name() const { return m_process_name; }
RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; }
const NonnullOwnPtrVector<RemoteObject>& roots() const { return m_roots; }
NonnullOwnPtrVector<RemoteObject> const& roots() const { return m_roots; }
void set_inspected_object(FlatPtr);
void set_property(FlatPtr object, StringView name, const JsonValue& value);
void set_property(FlatPtr object, StringView name, JsonValue const& value);
bool is_inspectable();
Function<void()> on_update;
private:
void handle_get_all_objects_response(const JsonObject&);
void handle_identify_response(const JsonObject&);
void handle_get_all_objects_response(JsonObject const&);
void handle_identify_response(JsonObject const&);
void send_request(const JsonObject&);
void send_request(JsonObject const&);
pid_t m_pid { -1 };
String m_process_name;