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

Method LoadNormal

codegen/proto_utils.cpp:80–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80int ProtoUtils::LoadNormal(const char *file_name, SyntaxTree *stree, map<string, bool> *parsed_file_map,
81 DiskSourceTree &tree) {
82 MyErrorPrinter error;
83
84 Importer importer(&tree, &error);
85
86 const FileDescriptor *fd{importer.Import(file_name)};
87
88 stree->SetPackageName(fd->package().c_str());
89
90 stree->SetProtoFile(file_name);
91
92 for (int i{0}; 1 > i && fd->service_count() > i; ++i) {
93 const ServiceDescriptor * iter = fd->service(i);
94 stree->SetName(iter->name().c_str());
95
96 for (int j{0}; iter->method_count() > j; ++j) {
97 const MethodDescriptor *method{iter->method(j)};
98
99 SyntaxFunc func;
100 func.SetName(method->name().c_str());
101
102 const Descriptor * input_type = method->input_type();
103 const Descriptor * output_type = method->output_type();
104
105 func.GetReq()->SetName("Req");
106 func.GetReq()->SetType(input_type->full_name().c_str());
107
108 func.GetResp()->SetName("Resp");
109 func.GetResp()->SetType(output_type->full_name().c_str());
110
111 stree->GetFuncList()->push_back(func);
112 }
113 }
114
115 return 0;
116}
117
118int ProtoUtils::LoadExtension(const char *file_name, SyntaxTree *stree, DiskSourceTree &tree) {
119 MyErrorPrinter error;

Callers

nothing calls this directly

Calls 7

SetProtoFileMethod · 0.80
SetNameMethod · 0.80
GetReqMethod · 0.80
SetTypeMethod · 0.80
GetRespMethod · 0.80
GetFuncListMethod · 0.80
SetPackageNameMethod · 0.45

Tested by

no test coverage detected