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

Function generate_client_implementation

crates/codegen/src/unrealcpp.rs:4159–4912  ·  view source on GitHub ↗
(
    output: &mut UnrealCppAutogen,
    module: &ModuleDef,
    visibility: CodegenVisibility,
    module_prefix: &str,
    module_name: &str,
)

Source from the content-addressed store, hash-verified

4157}
4158
4159fn generate_client_implementation(
4160 output: &mut UnrealCppAutogen,
4161 module: &ModuleDef,
4162 visibility: CodegenVisibility,
4163 module_prefix: &str,
4164 module_name: &str,
4165) {
4166 let blueprint_query_struct = format!("F{module_prefix}BlueprintQuery");
4167 // U{module_prefix}DbConnection constructor
4168 writeln!(
4169 output,
4170 "U{module_prefix}DbConnection::U{module_prefix}DbConnection(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)"
4171 );
4172 writeln!(output, "{{");
4173 writeln!(
4174 output,
4175 "\tDb = ObjectInitializer.CreateDefaultSubobject<U{module_prefix}RemoteTables>(this, TEXT(\"RemoteTables\"));"
4176 );
4177 writeln!(output, "\tDb->Initialize();");
4178 writeln!(output, "\t");
4179 writeln!(
4180 output,
4181 "\tReducers = ObjectInitializer.CreateDefaultSubobject<U{module_prefix}RemoteReducers>(this, TEXT(\"RemoteReducers\"));"
4182 );
4183 writeln!(output, "\tReducers->Conn = this;");
4184 writeln!(output);
4185 writeln!(
4186 output,
4187 "\tProcedures = ObjectInitializer.CreateDefaultSubobject<U{module_prefix}RemoteProcedures>(this, TEXT(\"RemoteProcedures\"));"
4188 );
4189 writeln!(output, "\tProcedures->Conn = this;");
4190 writeln!(output);
4191
4192 for (name, accessor_name, product_type_ref) in iter_table_names_and_types(module, visibility) {
4193 let struct_name = type_ref_name(module_prefix, module, product_type_ref);
4194 let accessor = accessor_name.deref();
4195 writeln!(
4196 output,
4197 "\tRegisterTable<F{}Type, U{module_prefix}{}Table, F{module_prefix}EventContext>(TEXT(\"{}\"), Db->{});",
4198 struct_name,
4199 accessor.to_case(Case::Pascal),
4200 name.deref(),
4201 accessor.to_case(Case::Pascal)
4202 );
4203 }
4204 writeln!(output, "}}");
4205 writeln!(output);
4206
4207 // F{module_prefix}ContextBase constructor
4208 writeln!(
4209 output,
4210 "F{module_prefix}ContextBase::F{module_prefix}ContextBase(U{module_prefix}DbConnection* InConn)"
4211 );
4212 writeln!(output, "{{");
4213 writeln!(output, "\tDb = InConn->Db;");
4214 writeln!(output, "\tReducers = InConn->Reducers;");
4215 writeln!(output, "\tProcedures = InConn->Procedures;");
4216 writeln!(output, "\tConn = InConn;");

Callers 1

generate_global_filesMethod · 0.85

Calls 10

iter_reducersFunction · 0.85
iter_tablesFunction · 0.85
iter_viewsFunction · 0.85
to_caseMethod · 0.80
type_ref_nameFunction · 0.70
derefMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…