Helper function to generate a C++ enum definition
(name: &str, enum_type: &PlainEnumTypeDef)
| 6334 | |
| 6335 | // Helper function to generate a C++ enum definition |
| 6336 | fn autogen_cpp_enum(name: &str, enum_type: &PlainEnumTypeDef) -> String { |
| 6337 | // Changed name to &str |
| 6338 | |
| 6339 | let type_name = format!("{name}Type"); |
| 6340 | let mut output = UnrealCppAutogen::new(&[], &type_name, false); |
| 6341 | writeln!(output, "UENUM(BlueprintType)"); |
| 6342 | writeln!(output, "enum class E{name}Type : uint8"); |
| 6343 | writeln!(output, "{{"); |
| 6344 | output.indent(1); |
| 6345 | |
| 6346 | for variant in &*enum_type.variants { |
| 6347 | writeln!(output, "{},", variant.deref().to_case(Case::Pascal)); // Ensure variants are PascalCase, common for UE enums |
| 6348 | } |
| 6349 | |
| 6350 | output.dedent(1); |
| 6351 | writeln!(output, "}};"); |
| 6352 | writeln!(output); |
| 6353 | |
| 6354 | // Add BSATN serialization support |
| 6355 | writeln!(output, "namespace UE::SpacetimeDB"); |
| 6356 | writeln!(output, "{{"); |
| 6357 | |
| 6358 | writeln!(output, " UE_SPACETIMEDB_ENABLE_TARRAY(E{name}Type);"); |
| 6359 | |
| 6360 | writeln!(output, "}}"); |
| 6361 | |
| 6362 | output.into_inner() |
| 6363 | } |
| 6364 | |
| 6365 | fn autogen_cpp_sum( |
| 6366 | module_prefix: &str, |
no test coverage detected
searching dependent graphs…