1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:27:43 +00:00

LibCore: Support write-only Object properties

Some properties are set and then never retrieved, e.g. GUI icon paths.
Add a helper to create such properties, similar to the read-only helper.
This commit is contained in:
Timothy Flynn 2022-12-08 10:59:30 -05:00 committed by Andreas Kling
parent 58f5deba70
commit 746364d7c1
2 changed files with 15 additions and 1 deletions

View file

@ -26,7 +26,12 @@ public:
return m_setter(value);
}
JsonValue get() const { return m_getter(); }
JsonValue get() const
{
if (!m_getter)
return {};
return m_getter();
}
DeprecatedString const& name() const { return m_name; }
bool is_readonly() const { return !m_setter; }