GMLCompiler: Add a variety of special cases

Headers, enum properties, and associated default includes.
This commit is contained in:
kleines Filmröllchen 2023-05-26 14:10:00 +02:00 committed by Andrew Kaster
parent a24d9f5e22
commit 842a5adfdc
Notes: sideshowbarker 2024-07-17 06:28:38 +09:00

View file

@ -27,10 +27,14 @@ static Optional<StringView> map_class_to_file(StringView class_)
static HashMap<StringView, StringView> class_file_mappings {
{ "GUI::HorizontalSplitter"sv, "GUI/Splitter"sv },
{ "GUI::VerticalSplitter"sv, "GUI/Splitter"sv },
{ "GUI::HorizontalSeparator"sv, "GUI/SeparatorWidget"sv },
{ "GUI::VerticalSeparator"sv, "GUI/SeparatorWidget"sv },
{ "GUI::HorizontalBoxLayout"sv, "GUI/BoxLayout"sv },
{ "GUI::VerticalBoxLayout"sv, "GUI/BoxLayout"sv },
{ "GUI::HorizontalProgressbar"sv, "GUI/Progressbar"sv },
{ "GUI::VerticalProgressbar"sv, "GUI/Progressbar"sv },
{ "GUI::DialogButton"sv, "GUI/Button"sv },
{ "GUI::PasswordBox"sv, "GUI/TextBox"sv },
// Map Layout::Spacer to the Layout header even though it's a pseudo class.
{ "GUI::Layout::Spacer"sv, "GUI/Layout"sv },
};
@ -333,6 +337,8 @@ static ErrorOr<String> generate_cpp(NonnullRefPtr<GUI::GML::GMLFile> gml)
TRY(String::from_utf8("<AK/JsonValue.h>"sv)),
TRY(String::from_utf8("<AK/NonnullRefPtr.h>"sv)),
TRY(String::from_utf8("<AK/RefPtr.h>"sv)),
// For Gfx::ColorRole
TRY(String::from_utf8("<LibGfx/SystemTheme.h>"sv)),
TRY(String::from_utf8("<LibGUI/Widget.h>"sv)),
};
TRY(necessary_includes.try_set_from(always_necessary_includes));