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

Method GetStubFuncDeclaration

codegen/client_code_render.cpp:112–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void ClientCodeRender::GetStubFuncDeclaration(const SyntaxTree *const stree, const SyntaxFunc *const func,
113 int is_header, string *result) {
114 char class_name[128]{'\0'}, type_name[128]{'\0'};
115
116 name_render_.GetStubClassName(stree->GetName(), class_name, sizeof(class_name));
117
118 if (is_header) {
119 phxrpc::StrAppendFormat(result, "int %s(", func->GetName());
120 } else {
121 phxrpc::StrAppendFormat(result, "int %s::%s(", class_name, func->GetName());
122 }
123
124 name_render_.GetMessageClassName(func->GetReq()->GetType(), type_name, sizeof(type_name));
125 phxrpc::StrAppendFormat(result, "const %s &req,\n", type_name);
126
127 name_render_.GetMessageClassName(func->GetResp()->GetType(), type_name, sizeof(type_name));
128 phxrpc::StrAppendFormat(result, " %s *resp", type_name);
129
130 phxrpc::StrAppendFormat(result, ")");
131}
132
133void ClientCodeRender::GenerateStubCpp(SyntaxTree *stree, FILE *write) {
134 char file_name[128]{'\0'};

Callers

nothing calls this directly

Calls 7

StrAppendFormatFunction · 0.85
GetStubClassNameMethod · 0.80
GetNameMethod · 0.80
GetMessageClassNameMethod · 0.80
GetReqMethod · 0.80
GetRespMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected