(
output: &mut UnrealCppAutogen,
module: &ModuleDef,
visibility: CodegenVisibility,
module_prefix: &str,
api_macro: &str,
module_name: &str,
)
| 1382 | } |
| 1383 | |
| 1384 | fn generate_context_structs( |
| 1385 | output: &mut UnrealCppAutogen, |
| 1386 | module: &ModuleDef, |
| 1387 | visibility: CodegenVisibility, |
| 1388 | module_prefix: &str, |
| 1389 | api_macro: &str, |
| 1390 | module_name: &str, |
| 1391 | ) { |
| 1392 | writeln!(output, "// Context classes for event handling"); |
| 1393 | writeln!(output); |
| 1394 | writeln!(output, "USTRUCT(BlueprintType)"); |
| 1395 | writeln!(output, "struct {api_macro} F{module_prefix}ContextBase"); |
| 1396 | writeln!(output, "{{"); |
| 1397 | writeln!(output, "\tGENERATED_BODY()"); |
| 1398 | writeln!(output); |
| 1399 | writeln!( |
| 1400 | output, |
| 1401 | "\tF{module_prefix}ContextBase() : Db(nullptr), Reducers(nullptr), Procedures(nullptr), Conn(nullptr) {{}};" |
| 1402 | ); |
| 1403 | writeln!( |
| 1404 | output, |
| 1405 | "\tF{module_prefix}ContextBase(U{module_prefix}DbConnection* InConn);" |
| 1406 | ); |
| 1407 | writeln!(output); |
| 1408 | writeln!(output, "\tUPROPERTY(BlueprintReadOnly, Category = \"SpacetimeDB\")"); |
| 1409 | writeln!(output, "\tU{module_prefix}RemoteTables* Db;"); |
| 1410 | writeln!(output); |
| 1411 | writeln!(output, "\tUPROPERTY(BlueprintReadOnly, Category = \"SpacetimeDB\")"); |
| 1412 | writeln!(output, "\tU{module_prefix}RemoteReducers* Reducers;"); |
| 1413 | writeln!(output); |
| 1414 | writeln!(output, "\tUPROPERTY(BlueprintReadOnly, Category = \"SpacetimeDB\")"); |
| 1415 | writeln!(output, "\tU{module_prefix}RemoteProcedures* Procedures;"); |
| 1416 | writeln!(output); |
| 1417 | writeln!(output, "\tbool IsActive() const;"); |
| 1418 | writeln!(output, "\tvoid Disconnect();"); |
| 1419 | writeln!( |
| 1420 | output, |
| 1421 | "\tbool TryGetIdentity(FSpacetimeDBIdentity& OutIdentity) const;" |
| 1422 | ); |
| 1423 | writeln!(output, "\tFSpacetimeDBConnectionId GetConnectionId() const;"); |
| 1424 | writeln!(output, "\tU{module_prefix}SubscriptionBuilder* SubscriptionBuilder();"); |
| 1425 | writeln!(output); |
| 1426 | writeln!(output, "protected:"); |
| 1427 | writeln!(output, "\tUPROPERTY()"); |
| 1428 | writeln!(output, "\tU{module_prefix}DbConnection* Conn;"); |
| 1429 | writeln!(output); |
| 1430 | writeln!(output, "}};"); |
| 1431 | writeln!(output); |
| 1432 | |
| 1433 | // BPLib for F{module_prefix}ContextBase - Needed to allow inheritance in Blueprint |
| 1434 | writeln!(output, "UCLASS()"); |
| 1435 | writeln!( |
| 1436 | output, |
| 1437 | "class {api_macro} U{module_prefix}ContextBaseBpLib : public UBlueprintFunctionLibrary" |
| 1438 | ); |
| 1439 | writeln!(output, "{{"); |
| 1440 | writeln!(output, "\tGENERATED_BODY()"); |
| 1441 | writeln!(output); |
no test coverage detected
searching dependent graphs…