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:
kleines Filmröllchen 2023-08-11 15:16:51 +02:00 committed by Jelle Raaijmakers
commit d1645efde9
Notes: sideshowbarker 2024-07-17 01:00:06 +09:00
6 changed files with 347 additions and 0 deletions

View file

@ -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
{