MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / generate_db_connection_class

Function generate_db_connection_class

crates/codegen/src/unrealcpp.rs:4006–4157  ·  view source on GitHub ↗
(
    output: &mut UnrealCppAutogen,
    module_prefix: &str,
    module_name: &str,
    _module: &ModuleDef,
    api_macro: &str,
)

Source from the content-addressed store, hash-verified

4004}
4005
4006fn generate_db_connection_class(
4007 output: &mut UnrealCppAutogen,
4008 module_prefix: &str,
4009 module_name: &str,
4010 _module: &ModuleDef,
4011 api_macro: &str,
4012) {
4013 writeln!(output, "// Main DbConnection class");
4014 writeln!(output, "UCLASS(BlueprintType)");
4015 writeln!(
4016 output,
4017 "class {api_macro} U{module_prefix}DbConnection : public UDbConnectionBase"
4018 );
4019 writeln!(output, "{{");
4020 writeln!(output, " GENERATED_BODY()");
4021 writeln!(output);
4022 writeln!(output, "public:");
4023 writeln!(
4024 output,
4025 " explicit U{module_prefix}DbConnection(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());"
4026 );
4027 writeln!(output);
4028 writeln!(output);
4029 writeln!(output, " UPROPERTY(BlueprintReadOnly, Category=\"SpacetimeDB\")");
4030 writeln!(output, " U{module_prefix}RemoteTables* Db;");
4031 writeln!(output);
4032 writeln!(output, " UPROPERTY(BlueprintReadOnly, Category=\"SpacetimeDB\")");
4033 writeln!(output, " U{module_prefix}RemoteReducers* Reducers;");
4034 writeln!(output);
4035 writeln!(output, " UPROPERTY(BlueprintReadOnly, Category=\"SpacetimeDB\")");
4036 writeln!(output, " U{module_prefix}RemoteProcedures* Procedures;");
4037 writeln!(output);
4038 writeln!(
4039 output,
4040 " // Delegates that allow users to bind with the concrete connection type."
4041 );
4042 writeln!(output, " F{module_prefix}OnConnectDelegate OnConnectDelegate;");
4043 writeln!(output, " F{module_prefix}OnDisconnectDelegate OnDisconnectDelegate;");
4044 writeln!(output);
4045 writeln!(output, " UFUNCTION(BlueprintCallable, Category=\"SpacetimeDB\")");
4046 writeln!(
4047 output,
4048 " U{module_prefix}SubscriptionBuilder* SubscriptionBuilder();"
4049 );
4050 writeln!(output);
4051 writeln!(output, " /** Static entry point for constructing a connection. */");
4052 writeln!(
4053 output,
4054 " UFUNCTION(BlueprintCallable, Category = \"SpacetimeDB\", DisplayName = \"SpacetimeDB {module_name} Builder\")"
4055 );
4056 writeln!(output, " static U{module_prefix}DbConnectionBuilder* Builder();");
4057 writeln!(output);
4058 writeln!(output, " // Error handling");
4059 writeln!(output, " DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(F{module_prefix}OnUnhandledReducerError, const F{module_prefix}ReducerEventContext&, Context, const FString&, Error);");
4060 writeln!(output, " UPROPERTY(BlueprintAssignable, Category=\"SpacetimeDB\")");
4061 writeln!(
4062 output,
4063 " F{module_prefix}OnUnhandledReducerError OnUnhandledReducerError;"

Callers 1

generate_global_filesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…