MCPcopy Create free account
hub / github.com/Tencent/phxrpc / GenerateStubFunc

Method GenerateStubFunc

codegen/client_code_render.cpp:186–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void ClientCodeRender::GenerateStubFunc(const SyntaxTree *const stree, const SyntaxFunc *const func,
187 FILE *write) {
188 string buffer;
189
190 GetStubFuncDeclaration(stree, func, 0, &buffer);
191
192 fprintf(write, "%s {\n", buffer.c_str());
193
194 fprintf(write, " phxrpc::HttpCaller caller(socket_, client_monitor_);\n");
195 fprintf(write, " caller.SetURI(\"/%s/%s\", %d);\n", stree->GetPackageName(),
196 func->GetName(), func->GetCmdID());
197 fprintf(write, " caller.SetKeepAlive(keep_alive_);\n");
198 fprintf(write, " return caller.Call(req, resp);\n");
199
200 fprintf(write, "}\n");
201 fprintf(write, "\n");
202}
203
204void ClientCodeRender::GenerateClientHpp(SyntaxTree *stree, FILE *write, const bool is_uthread_mode) {
205 char file_name[128]{'\0'};

Callers

nothing calls this directly

Calls 3

GetNameMethod · 0.80
GetPackageNameMethod · 0.45
GetCmdIDMethod · 0.45

Tested by

no test coverage detected