mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 23:12:56 +00:00
LibCore: Move CObject serialization into CObject::save_to(JsonObject&)
The idea is for subclasses to override this and add whatever properties are relevant for them, then call up to their base class, etc.
This commit is contained in:
parent
a32123f221
commit
c2213449c0
Notes:
sideshowbarker
2024-07-19 12:35:57 +09:00
Author: https://github.com/awesomekling
Commit: c2213449c0
3 changed files with 16 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/kstdio.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
#include <LibCore/CEventLoop.h>
|
||||
|
@ -125,3 +126,11 @@ void CObject::deferred_invoke(Function<void(CObject&)> invokee)
|
|||
{
|
||||
CEventLoop::current().post_event(*this, make<CDeferredInvocationEvent>(move(invokee)));
|
||||
}
|
||||
|
||||
void CObject::save_to(JsonObject& json)
|
||||
{
|
||||
json.set("class_name", class_name());
|
||||
json.set("address", String::format("%p", this));
|
||||
json.set("name", name());
|
||||
json.set("parent", String::format("%p", parent()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue