mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
Meta+Userland: Allow generating C++ initializer code from GML
This does the exact same thing as the runtime initializer, except it is faster and can catch some errors much earlier. The code generator includes these important features: - Automatic include generation where necessary - Special-casing for TabWidget and ScrollableContainerWidget - No use of DeprecatedString where possible
This commit is contained in:
parent
1e67435ff5
commit
d1645efde9
Notes:
sideshowbarker
2024-07-17 01:00:06 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: d1645efde9
Pull-request: https://github.com/SerenityOS/serenity/pull/17373
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/BenWiederhake ✅
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/linusg
Reviewed-by: https://github.com/me-minus
Reviewed-by: https://github.com/timschumi
6 changed files with 347 additions and 0 deletions
|
@ -188,6 +188,19 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<FallibleFunction<StringView, NonnullRefPtr<JsonValueNode>> Callback>
|
||||
ErrorOr<void> try_for_each_property(Callback callback) const
|
||||
{
|
||||
for (auto const& child : m_properties) {
|
||||
if (is<KeyValuePair>(child)) {
|
||||
auto const& property = static_cast<KeyValuePair const&>(*child);
|
||||
if (property.key() != "layout" && is<JsonValueNode>(property.value().ptr()))
|
||||
TRY(callback(property.key(), static_ptr_cast<JsonValueNode>(property.value())));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_child_object(Callback callback) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue